NexusFi: Find Your Edge


Home Menu

 





Range Bar Time


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one zeller4 with 7 posts (10 thanks)
    2. looks_two RJay with 2 posts (0 thanks)
    3. looks_3 hondo69 with 2 posts (0 thanks)
    4. looks_4 sefstrat with 2 posts (4 thanks)
      Best Posters
    1. looks_one aligator with 2 thanks per post
    2. looks_two sefstrat with 2 thanks per post
    3. looks_3 wh with 2 thanks per post
    4. looks_4 zeller4 with 1.4 thanks per post
    1. trending_up 11,990 views
    2. thumb_up 18 thanks given
    3. group 10 followers
    1. forum 19 posts
    2. attach_file 7 attachments




 
Search this Thread

Range Bar Time

  #11 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
Thanks Received: 404


sefstrat View Post
Here is how I do it:

 
Code
TimeSpan span = Bars.GetTime(CurrentBar) - Bars.GetTime(CurrentBar -1);              
 
series.Set(span.TotalMinutes);


hey sefstrat,
i've started to look at this again, the "span" works

what would you do if you want the previous bar'sspan? I tried this but it gives
 
Code

TimeSpan span1 = Bars.GetTime(CurrentBar-1) - Bars.GetTime(CurrentBar -2);
error message is:
 
Code
                            
Error on calling the 'OnBarUpdate' method for indicator 'A_1_Range_Time_v01' on bar 1Bar index needs to be greater/equal 0 

thanks for your help

Attached Files
Elite Membership required to download: A_1_Range_Time_v01.cs
Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
ZombieSqueeze
Platforms and Indicators
MC PL editor upgrade
MultiCharts
Cheap historycal L1 data for stocks
Stocks and ETFs
How to apply profiles
Traders Hideout
 
  #12 (permalink)
 
wh's Avatar
 wh 
Neubrandenburg, Germany
 
Experience: Advanced
Platform: R
Trading: Stocks
Posts: 538 since Jun 2009
Thanks Given: 298
Thanks Received: 512

add this on barupdate() methode at the begin:

if(CurrentBar < 5) return;

so your barindex would be greater than 0 ... 4

Reply With Quote
Thanked by:
  #13 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
Thanks Received: 404


thanks wh
can't believe i let that elementary problem get me like that


thanks again
kz

Started this thread Reply With Quote
  #14 (permalink)
 
Saroj's Avatar
 Saroj 
Arcata, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: index futures, oil
Posts: 485 since Jun 2009
Thanks Given: 232
Thanks Received: 415

That's what happens when you go on vacation...

Reply With Quote
  #15 (permalink)
 
hondo69's Avatar
 hondo69 
Austin, TX
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Currencies
Posts: 162 since Jun 2009
Thanks Given: 57
Thanks Received: 248

I like your idea and have had similar thoughts for an indicator such as this. But my idea would plot the reverse of what you have so that range bars that plot very fast would cause the indicator to rise, like a speedometer.

My idea is to capture quick market moves and turn it into an auto trader. These are the times when the market moves so quickly there is not time to enter orders manually. In the image below I've superimposed the proposed indicator onto the price panel, even though it would be in Panel 2.

Start with a 2 range chart
Have the indicator calculate average time per bar

You might set the Period to 50, for example, and it would average the time per bar over the past 50 bars. Let's say that value is 20 seconds.

You'd then have 20 seconds be the zero line of the indicator. As each new bar forms it divides that average by the time of each new bar.

When a fast move appears, it would cause the indicator to spike. As shown in the image below, that spike would be caused by bars that plot every 1 or 2 seconds. The spike data would be something like this:

20/1, 20/2, 20/1, 20/1, 20/1, 20/2, 20/1, 20/1, etc.

For an auto trader strategy, you'd look for the indicator to rise above some value (10, for example) then go long. Set the target for 5 pips or so. You'd be able to benefit from quick moves that manual traders would miss.

The trick would be having the indicator detect if the market is rising or falling. Without this detection, it would spike in both rising and falling markets.

Attached Thumbnails
Click image for larger version

Name:	2_range_speed.jpg
Views:	327
Size:	168.9 KB
ID:	5388  
Reply With Quote
  #16 (permalink)
 
sefstrat's Avatar
 sefstrat 
Austin, TX
 
Experience: Advanced
Platform: NT/Matlab
Broker: Interactive Brokers
Trading: FX majors
Posts: 285 since Jun 2009
Thanks Given: 20
Thanks Received: 768

If you try to implement this I think you will find that it is much more difficult than it seems it would be.

First off there are many, many small quick spikes in any given day.. on a 2 range chart in an active market you may have a 4-5 bar spike where they are all within 1 second of each other several times within an hour, that alone would set off your 20 second filter. Also you will find that many times there will be a very fast turnaround, ie 4 downbars then 2 upbars all within the same second or two, then it stalls.. how do you determine direction in that case? Generally it is just as likely to immediately continue down as it is to be a tradeable pullback. It is possible to create a good filter for these kind of trades but in my experience it is not easy.

Then you have to worry about slippage, I don't think such a strategy would be feasible without using limit orders.. if you enter market orders there will be many occasions where you get filled at the bottom of a stop hunt and immediately stopped out (likely with slippage on the exit also, in a very fast market you can easily rack up 5-10 ticks slippage beyond your stop limit, even more in some news release scenarios)

I spent quite a while working on a strategy like this, and I did get it working to some degree.. but in the end I abandoned it because it was not worth the effort, there are much easier ways to create an automated strategy.

That said, monitoring the time between bars is quite useful and I do still use it, but only as a secondary criteria. IMO it is most useful for detecting stop hunts and then jumping in once it reverses.


hondo69 View Post
I like your idea and have had similar thoughts for an indicator such as this. But my idea would plot the reverse of what you have so that range bars that plot very fast would cause the indicator to rise, like a speedometer.

My idea is to capture quick market moves and turn it into an auto trader. These are the times when the market moves so quickly there is not time to enter orders manually. In the image below I've superimposed the proposed indicator onto the price panel, even though it would be in Panel 2.

Start with a 2 range chart
Have the indicator calculate average time per bar

You might set the Period to 50, for example, and it would average the time per bar over the past 50 bars. Let's say that value is 20 seconds.

You'd then have 20 seconds be the zero line of the indicator. As each new bar forms it divides that average by the time of each new bar.

When a fast move appears, it would cause the indicator to spike. As shown in the image below, that spike would be caused by bars that plot every 1 or 2 seconds. The spike data would be something like this:

20/1, 20/2, 20/1, 20/1, 20/1, 20/2, 20/1, 20/1, etc.

For an auto trader strategy, you'd look for the indicator to rise above some value (10, for example) then go long. Set the target for 5 pips or so. You'd be able to benefit from quick moves that manual traders would miss.

The trick would be having the indicator detect if the market is rising or falling. Without this detection, it would spike in both rising and falling markets.


Reply With Quote
Thanked by:
  #17 (permalink)
 
hondo69's Avatar
 hondo69 
Austin, TX
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Currencies
Posts: 162 since Jun 2009
Thanks Given: 57
Thanks Received: 248

Thanks for the great information as it definitely makes sense to me. I feel you've saved me a lot of time and trouble and that's greatly appreciated.

Isn't that what makes this forum so great!!! Sharing great information.

Reply With Quote
  #18 (permalink)
 jmont1 
New York, NY
 
Experience: Intermediate
Platform: NinjaTrader8
Broker: Data = Rithmic -- Gives 70 Level II Data
Trading: 6C (Low Margin,) 6E, CL, GC, ES and Maybe DX for smaller tick value
Posts: 1,394 since May 2011
Thanks Given: 1,719
Thanks Received: 1,020


hondo69 View Post
I like your idea and have had similar thoughts for an indicator such as this. But my idea would plot the reverse of what you have so that range bars that plot very fast would cause the indicator to rise, like a speedometer.

My idea is to capture quick market moves and turn it into an auto trader. These are the times when the market moves so quickly there is not time to enter orders manually. In the image below I've superimposed the proposed indicator onto the price panel, even though it would be in Panel 2.

Start with a 2 range chart
Have the indicator calculate average time per bar

You might set the Period to 50, for example, and it would average the time per bar over the past 50 bars. Let's say that value is 20 seconds.

You'd then have 20 seconds be the zero line of the indicator. As each new bar forms it divides that average by the time of each new bar.

When a fast move appears, it would cause the indicator to spike. As shown in the image below, that spike would be caused by bars that plot every 1 or 2 seconds. The spike data would be something like this:

20/1, 20/2, 20/1, 20/1, 20/1, 20/2, 20/1, 20/1, etc.

For an auto trader strategy, you'd look for the indicator to rise above some value (10, for example) then go long. Set the target for 5 pips or so. You'd be able to benefit from quick moves that manual traders would miss.

The trick would be having the indicator detect if the market is rising or falling. Without this detection, it would spike in both rising and falling markets.

Was this version of the indicator ever developed? I am using A_1 for the time as a panel but it would be great to also be able to have it asa floating indicator on the primary chart. Seems difficult to me due to the varying scales but the image here looks perfect. Was it ever a reality?

Reply With Quote
  #19 (permalink)
 
aligator's Avatar
 aligator 
Las Vegas, NV
Legendary Market Wizard
 
Experience: Advanced
Platform: Abacus, Slide Rule, HP-65
Trading: Futures, Stocks, Options
Posts: 3,621 since Aug 2010
Thanks Given: 1,071
Thanks Received: 5,994


jmont1 View Post
Was this version of the indicator ever developed? I am using A_1 for the time as a panel but it would be great to also be able to have it asa floating indicator on the primary chart. Seems difficult to me due to the varying scales but the image here looks perfect. Was it ever a reality?

@jmont1,

Not sure, but here my new bar time indicator here:


Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #20 (permalink)
 jmont1 
New York, NY
 
Experience: Intermediate
Platform: NinjaTrader8
Broker: Data = Rithmic -- Gives 70 Level II Data
Trading: 6C (Low Margin,) 6E, CL, GC, ES and Maybe DX for smaller tick value
Posts: 1,394 since May 2011
Thanks Given: 1,719
Thanks Received: 1,020



aligator View Post
@jmont1,

Not sure, but here my new bar time indicator here:


Thanks. I have your indicator and it works well.

The one in this thread is showing in the instrument's main panel and would be an interesting take on it.

Currently I am running your mahBar and in the same panel also running Range_Time_v01 (modified to show less text) that displays text of the current bar and the average of previous RENKO bars. I have been trying to figure out how to get the text to also show the time of the previous bar but this would take a real coder.

Is it possible to add features to your indicator:

Current bar in text - Now - 00:11:55; old - 00:11:55; Avg 00:11:55 (this would be selectable of # of bars to use for average) Allow the text to be in the indicator panel or in the primary panel with all the locations, i.e... lower right, etc...; especially if it is possible to put it smack in the center but no more than two rows of text:

00:11:55 - now; 00:11:55 avg

00:12:45 Bar -1; + 00:01:55 (this would be the previous bar comparison to the avge.)


Then add a sound indicator (user sound selectable with a rearm timer) for bars ending in a short period of time, as well as an option to put the alert in the alert panel.

Alligator, I know this could be requested in the free section but it seems appropriate here, especially since you are following this thread. Thanks for your generosity of sharing your coding efforts.

Reply With Quote




Last Updated on July 17, 2012


© 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