NexusFi: Find Your Edge


Home Menu

 





Gapless indicators


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Fat Tails with 12 posts (84 thanks)
    2. looks_two Big Mike with 7 posts (10 thanks)
    3. looks_3 viki with 6 posts (5 thanks)
    4. looks_4 cory with 4 posts (10 thanks)
      Best Posters
    1. looks_one Fat Tails with 7 thanks per post
    2. looks_two Sim22 with 4 thanks per post
    3. looks_3 cory with 2.5 thanks per post
    4. looks_4 Big Mike with 1.4 thanks per post
    1. trending_up 23,420 views
    2. thumb_up 127 thanks given
    3. group 14 followers
    1. forum 42 posts
    2. attach_file 28 attachments




 
Search this Thread

Gapless indicators

  #11 (permalink)
 viki 
italy
 
Experience: Intermediate
Platform: tradestation
Broker: tradestation
Trading: fesx, es
Posts: 14 since Dec 2009
Thanks Given: 1
Thanks Received: 7

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

In this example of ATR you’ll notice the 14 bars at the session open are artificially high without the “GapLess” code.



It’s the same with PercentR. It takes 14 bars to settle down and return to normal. GL (GapLess) allows PercentR to show a buy signal at the 8th bar of the day which would have been missed on the non-corrected version.



Notice how the Bollinger Band acts at the opening. It gives a false BUY signal on the first bar of the day. The GL version gives a buy signal several bars later, near the relative low of the first twenty bars of the day.



Here’s the GL version of the BB.



You can see the regular RSI gave a false buy signal at the opening bar.

The GL version of RSI gave the first buy signal over twenty bars later near the actual low.



The regular Stochastic is indicating an oversold condition at the market open.

The GL version of the Stochastic indicates the open is overbought and correctly gives a sell signal near the sixth bar of the day.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
What broker to use for trading palladium futures
Commodities
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
How to apply profiles
Traders Hideout
Better Renko Gaps
The Elite Circle
 
  #12 (permalink)
 viki 
italy
 
Experience: Intermediate
Platform: tradestation
Broker: tradestation
Trading: fesx, es
Posts: 14 since Dec 2009
Thanks Given: 1
Thanks Received: 7

The code for each is included below in GAPLESS.ELD.
It includes %R, ATR, RSI, Fast Stochastics and Bollinger Bands

Attached Files
Elite Membership required to download: 20080601080830GAPLESS.ELD
Reply With Quote
Thanked by:
  #13 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


I do not think that the approach of subtracting or adding a gap is valid.

Let us take the following example: Yesterday was a down day for ES that closed near the low. The EMA is some points above the close. During the night session ES retraces 38% of the move.

If you adjust for the gap, you will find the EMA above the open, which is higher than the high of the Globex session. I do not think that this makes sense.

A better approach would be resetting the EMA at the begin of the session. Just replace CurrentBar in the EMA formula of the EMA CurrentSessionBar, where CurrentSessionBar is an integer, which is reset to 0 at the begin of the session and increased by 1 with every new bar -> use FirstTickOfBar.

I have used a similar approach for the CurrentSessionVWAP.

It is important not to pollute the new EMA with any price action from yesterday. The same applies, if you want to use an EMA for the NYSE Tick. It simply does not make sense to include any tick readings from the day before.

Reply With Quote
Thanked by:
  #14 (permalink)
 viki 
italy
 
Experience: Intermediate
Platform: tradestation
Broker: tradestation
Trading: fesx, es
Posts: 14 since Dec 2009
Thanks Given: 1
Thanks Received: 7

examples of indicator using "GapLess" code : Bollinger Bands

 
Code
inputs:
    BollingerPrice( Close ),
    TestPriceUBand( Close ),
    TestPriceLBand( Close ),
    Length( 20 ),
    NumDevsUp( 2 ),
    NumDevsDn( -2 ),
    Displace( 0 ) ;

variables:
    Avg( 0 ),
    SDev( 0 ),
    LowerBand( 0 ),
    UpperBand( 0 ),
    Price( 0 );

    // gapless day transitions - John McCormick May 2008
    
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

price = RelC;
If BollingerPrice=open then price = RelO;
If BollingerPrice=high then price = RelH;
If BollingerPrice=low then price = RelL;
Avg = AverageFC( Price, Length ) ;
SDev = StandardDev( Price, Length, 1 ) ;
UpperBand = Avg + NumDevsUp * SDev;
LowerBand = Avg + NumDevsDn * SDev;

if Displace >= 0 or CurrentBar > AbsValue( Displace ) then 
    begin
    Plot1[Displace]( UpperBand + accum, "UpperBand" ) ;
    Plot2[Displace]( LowerBand + accum, "LowerBand" ) ;
    Plot3[Displace]( Avg + accum, "MidLine" ) ;

    { Alert criteria }
    if Displace <= 0 then
        begin
        if TestPriceLBand crosses over LowerBand then
            Alert( "Price crossing over lower price band" ) 
        else if TestPriceUBand crosses under UpperBand then
            Alert( "Price crossing under upper price band" ) ;
        end ;
    end ;


{ ** Copyright (c) 2005 TradeStation Technologies, Inc. All rights reserved. ** 
  ** TradeStation reserves the right to modify or overwrite this analysis technique 
     with each release. ** }

Reply With Quote
Thanked by:
  #15 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090

some visual of gap chart vs gapless chart

Attached Thumbnails
Click image for larger version

Name:	ES 12-10 (5 Min)  gap 10_1_2010.jpg
Views:	424
Size:	49.0 KB
ID:	21567   Click image for larger version

Name:	ES 12-10 (5 Min)  gapless 10_1_2010.jpg
Views:	347
Size:	48.4 KB
ID:	21569  
Reply With Quote
  #16 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


cory View Post
some visual of gap chart vs gapless chart

You are kdding.

You do not want to backadjust ES every day. That way you will lose all relevant information on support and resistance, just to get a (useless) moving average.

I do not think that any professional trader would use such a chart.

But on the other hand there are no laws banning the use of gapless charts. And maybe I just do not understand them.

Reply With Quote
Thanked by:
  #17 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090


Fat Tails View Post
You are kdding.

You do not want to backadjust ES every day. That way you will lose all relevant information on support and resistance, just to get a (useless) moving average.

I do not think that any professional trader would use such a chart.

But on the other hand there are no laws banning the use of gapless charts. And maybe I just do not understand them.

then maybe this illustration can shine some light on this murky subject

Attached Thumbnails
Click image for larger version

Name:	ES 12-10 (5 Min)  10_1_2010.jpg
Views:	334
Size:	51.2 KB
ID:	21591   Click image for larger version

Name:	MK 2010 10 01 5ES.png
Views:	336
Size:	146.4 KB
ID:	21596  
Reply With Quote
  #18 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103

You lose the following information with a gapless chart

- fib retracements
- support area
- resistance area
- when the gap is closed
- information on yesterday's high, low and close

Losing more than you will gain. That's the reason these charts are barely used.

Attached Thumbnails
Click image for larger version

Name:	ES 12-10 (5 Min)  01_10_2010.jpg
Views:	289
Size:	129.5 KB
ID:	21601  
Reply With Quote
Thanked by:
  #19 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,464 since Jun 2009
Thanks Given: 33,242
Thanks Received: 101,662


Fat Tails View Post
You are kdding.

You do not want to backadjust ES every day. That way you will lose all relevant information on support and resistance, just to get a (useless) moving average.

I do not think that any professional trader would use such a chart.

But on the other hand there are no laws banning the use of gapless charts. And maybe I just do not understand them.

I am not trying to create a gapless chart, but a gapless indicator. Instead of an ema 20, for instance, taking 20 bars to catch up on a RTH chart after a big gap, I wanted to experiment with having a gapless EMA that would not be 'lagging' simply because of the gap. In other words, it's a 'smart' ema that could be set to 'ignore' the gap, thereby showing what an EMA 20 would look like (close) if the chart was ETH instead of RTH for the first 20 bars after the open.

Mike



Join the free Markets Chat beta: one platform, all the trade rooms!

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #20 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103



Big Mike View Post
I am not trying to create a gapless chart, but a gapless indicator. Instead of an ema 20, for instance, taking 20 bars to catch up on a RTH chart after a big gap, I wanted to experiment with having a gapless EMA that would not be 'lagging' simply because of the gap. In other words, it's a 'smart' ema that could be set to 'ignore' the gap, thereby showing what an EMA 20 would look like (close) if the chart was ETH instead of RTH for the first 20 bars after the open.

Mike

This can only be achieved, if the indicator can access the data of the ETH session prior to the start of the RTH session. As far as I have seen, Multicharts also allows to use session times for each instrument.

On option would be to use a session template that starts 2 hours prior to the open. You could then start with a recursive EMA(1) formula and run that up to EMA (20) on the 20th bar. This would come close enough at the session start.

I have used a similar approach with NT 7.0, the only problem was that I used an SMA, which due to its recursive formula produced a significant rounding error. This problem could be solved with the setting MaximumBarsLookback.Infinite, but this is a specific NT problem.

Reply With Quote
Thanked by:




Last Updated on February 4, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts