Gapless indicators - NinjaTrader Programming | futures io social day trading
futures io futures trading


Gapless indicators
Updated: Views / Replies:11,925 / 42
Created: by Big Mike Attachments:28

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 28  
 
Thread Tools Search this Thread
 

Gapless indicators

  #1 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,221 received

Gapless indicators

I'm putting this in the NT programming section since there are more NT users here

I need some help creating some gapless indicators. Let's just start with a simple request, a gapless EMA. I will convert it to EasyLanguage after.

Let's say my chart is a RTH chart. The opening session gaps down 100 ticks from the prior day close. I would like to have my EMA 20 "close that gap". In other words, the first bar of the new session would take into account the gap (from session to session) and then it would automagically close the gap.

Some suggestions on making this happen? I can measure the gap, but then what action should I be taking? Should I use the length of the MA (ie, 20) and then do what with it? You guys know my math skills are terrible, so I'm just stuck here trying to figure out how to properly handle this.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Italy - Roma
 
Futures Experience: Intermediate
Platform: Sierra Chart
Broker/Data: IB
Favorite Futures: Index futures
 
jagui's Avatar
 
Posts: 195 since Jul 2010
Thanks: 248 given, 278 received


Don't know if I understand well... for the 20 ema the logic could be:

- if the 20 bars are all in the same session, then calculate ema normally
- if some of this 20 bars are in the previous session, then add (or subtract) the gap to the bars of the previuos session and calculate ema accordingly.

This way you should have an ema that "gaps with the price".

Reply With Quote
 
  #4 (permalink)
Elite Member
las vegas
 
Futures Experience: Intermediate
Platform: Sierra Chart
Broker/Data: Velocity/IB
Favorite Futures: 6E
 
Posts: 1,147 since Feb 2010
Thanks: 304 given, 836 received

i don't know if it would work, but i would try to create new data series that builds on the first bar and then feed it into any calculation,

if bar = bar1 then nclose[0] = close[0]
if bar > bar1 then nclose[0] = nclose[1] + close[0] - open[0]
EMA = EMA(nclose[0],period)


you know what i mean?

Reply With Quote
 
  #5 (permalink)
Elite Member
Santa Maria
 
Futures Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker/Data: Mirus/Zen-Fire
Favorite Futures: ES
 
Posts: 295 since May 2010
Thanks: 101 given, 320 received

Gap adjusted EMA

I'm really not sure I understand the goal, but if I do, then I think it's easy for an EMA. Attached is how I'd approach it.

Attached Thumbnails
Gapless indicators-jhlemagapadj.png  
Attached Files
Register to download File Type: zip jhlEMAGapAdj.zip (4.6 KB, 117 views)
Reply With Quote
The following user says Thank You to fluxsmith for this post:
 
  #6 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,221 received


fluxsmith View Post
I'm really not sure I understand the goal, but if I do, then I think it's easy for an EMA. Attached is how I'd approach it.

Thanks, I think you got it right. Sometimes I just can't see simple solutions I will convert to EasyLanguage when I have some time.

Thank you
Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #7 (permalink)
Elite Member
CA
 
Futures Experience: Master
Platform: Marketdelta and Ninja
Broker/Data: Velocity
Favorite Futures: NQ
 
Posts: 670 since Apr 2010
Thanks: 64 given, 521 received

Is there any way to do that for the Wolume weighted moving average for ninja( not VWAP)?
Thanks

Reply With Quote
 
  #8 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


Big Mike View Post
I'm putting this in the NT programming section since there are more NT users here

I need some help creating some gapless indicators. Let's just start with a simple request, a gapless EMA. I will convert it to EasyLanguage after.

Let's say my chart is a RTH chart. The opening session gaps down 100 ticks from the prior day close. I would like to have my EMA 20 "close that gap". In other words, the first bar of the new session would take into account the gap (from session to session) and then it would automagically close the gap.

Some suggestions on making this happen? I can measure the gap, but then what action should I be taking? Should I use the length of the MA (ie, 20) and then do what with it? You guys know my math skills are terrible, so I'm just stuck here trying to figure out how to properly handle this.

Mike

I understand that you want to create a moving average that reflects the current session only. So you would want to restart it again and again, when the session starts.

There is a catch: The EMA or SMA formulae may not work, because the logic used only applies to continuous moving averages. I encountered this problem, when coding the anchored VWMA for the current session. I wanted to smooth it with a SMA(3). Could not use the native Ninja SMA for smoothing, because it would look back into the previous session. So only smoothed starting from the third bar of the new session onwards.

If you want to use a session related moving average, the anchored VWAP is quite interesting. You can then use the difference between an EMA(20) and the anchored VWAP as a trend filter.

Reply With Quote
 
  #9 (permalink)
Elite Member
italy
 
Futures Experience: Intermediate
Platform: tradestation
Broker/Data: tradestation
Favorite Futures: fesx, es
 
Posts: 14 since Dec 2009
Thanks: 1 given, 7 received


Big Mike View Post
I'm putting this in the NT programming section since there are more NT users here

I need some help creating some gapless indicators. Let's just start with a simple request, a gapless EMA. I will convert it to EasyLanguage after.

Let's say my chart is a RTH chart. The opening session gaps down 100 ticks from the prior day close. I would like to have my EMA 20 "close that gap". In other words, the first bar of the new session would take into account the gap (from session to session) and then it would automagically close the gap.

Some suggestions on making this happen? I can measure the gap, but then what action should I be taking? Should I use the length of the MA (ie, 20) and then do what with it? You guys know my math skills are terrible, so I'm just stuck here trying to figure out how to properly handle this.

Mike

I have used this method that i found at Tradestation forums, the author is John Mc.
The code is free and it is for Tradestation but it should work without problems for MULTICHART
My English is not good so I make the cut and paste of the explanation:

"
thought I’d share a method I use for handling opening gaps that seems to work well for both indicators and strategies.

There are approximately 17 hours between the close of the market one day and the open the next day. Significant trading volume may occur during after-hour trading. The opening gap up or down from the previous day's close is misleading. Trading just prior to the open may be sideways or converging from the opposite direction. Usually traders have to either restart their indicators at day beginning or allow enough bars to pass for their indicators to settle down.

I use a routine I call, "gapless," which avoids these problems by treating separate days in a manner similar to continuous contracts.

Vars:
RelO(0), // Relative Open
RelH(0), // Relative High
RelL(0), // Relative low
RelC(0), // Relative Close
gap(0), // the opening gap (modified by the gap coefficient)
GapCoef(1.0), // Gap Coefficient
Accum(0); // The sum of all the daily gaps

if date<>date[1] then
begin
gap = GapCoef*(O-C[1]);
Accum = Accum+gap;
end;

RelO = O-Accum;
RelC = C-Accum;
RelH = H-Accum;
RelL = L-Accum;

// Gapless - end

Reply With Quote
The following user says Thank You to viki for this post:
 
  #10 (permalink)
Elite Member
italy
 
Futures Experience: Intermediate
Platform: tradestation
Broker/Data: tradestation
Favorite Futures: fesx, es
 
Posts: 14 since Dec 2009
Thanks: 1 given, 7 received

Taming Opening Gaps


This is how it works: The opening “gap” is recorded for the first bar of each trading day.

A relative stream of OHLC's are calculated by subtracting this “gap” from the actual prices. This relative stream of OHLC’s are maintained right along side of the real OHLC’s. If the EL programmer needs to convert between the relative prices and the real price data, the sum of all the gap values is stored in the variable, “accum,” which makes the conversion simple.

If you’re squeamish about eliminating the opening gap altogether, I’ve included a “GapCoef,” that you can set between 0.00 and 1.00 to reduce part or all of the gap as you choose. For example, set the coefficient to 0.5 to reduce the gap by half. I prefer to eliminate the gap altogether so I set the coefficient to 1.0, which eliminates 100% of the opening gap.

Indicators, such as RSI and Stochastics, (see below examples) work fine with this relative price stream and never need to be converted back to real prices.

If you have an indicator that needs to be displayed on the same scale as the underlying data, simply add “accum,” i.e. (indicator + accum) as the last step prior to plotting. You can see an example of this with the Bollinger Band below (code included below in Gapless.ELD).

In order to work correctly, all manipulations (adding, averaging, etc...) should only be done with the relative data (RelO, RelH, RelL and RelC), then if the data needs to be returned to the real domain the variable "accum" is added as the last step.

Below, I've included several examples of indicators using "GapLess" code. The code for each is included below in GAPLESS.ELD. It includes %R, ATR, RSI, Fast Stochastics and Bollinger Bands. You'll see from the examples that any indicator or stategy can take advantage of this code.

The images below show the dramatic difference this approach can make.

Reply With Quote
The following 2 users say Thank You to viki for this post:

Reply



futures io > > > > > Gapless indicators

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Which indicators are leading indicators masood Traders Hideout 17 March 3rd, 2013 07:13 PM
Installed indicators all end up looking like RSI indicators! Angelo1 NinjaTrader 4 July 15th, 2011 06:10 AM
Market Analyzer Indicators to Summarize Chart Indicators nirajkrishna The Elite Circle 5 March 18th, 2011 08:13 PM
Indicators, to have them or not to have them?! George Psychology and Money Management 11 September 6th, 2009 11:30 AM
Way too many indicators! ntsst3 Traders Hideout 1 July 31st, 2009 09:19 PM


All times are GMT -4. The time now is 05:19 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-13 in 0.15 seconds with 20 queries on phoenix via your IP 54.92.194.75