Range Bar Time - futures io
futures io futures trading



Range Bar Time


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one zeller4 with 7 posts (10 thanks)
    2. looks_two sefstrat with 2 posts (4 thanks)
    3. looks_3 jmont1 with 2 posts (0 thanks)
    4. looks_4 RJay with 2 posts (0 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 9,658 views
    2. thumb_up 18 thanks given
    3. group 10 followers
    1. forum 19 posts
    2. attach_file 7 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
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

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

 
Search this Thread
 

Range Bar Time

(login for full post details)
  #1 (permalink)
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received

Hello All,

Range bars are new to me since being introduced to this forum. Thanks Mike, Sharky and others who continually share..

I'm not sure if a range timer display would show the bar's duration and if anyone feels that would be good information to show how long a bar is stuck without moving. some of the bars in the screenshot are 10 minutes long (might as well go to lunch)

I'm testing this script but don't know how to set it to display minutes:seconds... Any help would be greatly appreciated.
Kirk

Attached Thumbnails
Click image for larger version

Name:	ZN 09-09  6_26_2009 (4 Range).jpg
Views:	387
Size:	93.3 KB
ID:	400  
Attached Files
Register to download File Type: zip Range_Bar_Duration.zip (1.9 KB, 95 views)
Started this thread Reply With Quote
The following 4 users say Thank You to zeller4 for this post:

Can you help answer these questions
from other members on futures io?
Short Interest Ratio indicator?
ThinkOrSwim
Help Needed: TOS Options Chain IV & IMPL MOVE Calcul …
ThinkOrSwim
Automating strategy optimization for different markets
EasyLanguage Programming
Cross border fund flows / fx correlations
Treasury Notes and Bonds
SimplerOptions
Trading Reviews and Vendors
 
 
(login for full post details)
  #2 (permalink)
Hartford, CT. USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: RTY
 
RJay's Avatar
 
Posts: 688 since Jun 2009
Thanks: 747 given, 780 received

Kirk,,

Range bars are plotting price movement in both X and Y axis on the chart.

There is no fixed time, volume or trade ticks to define when the bar will close.

Same story with Renko bars.

I hope this helps,

RJay

Reply With Quote
 
(login for full post details)
  #3 (permalink)
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received


I understand that RJay,

I'm merely trying to see how long in minutes it took to print the last bar. I believe that will then allow me to place a moving average to that number and see the "speed" of the current price movement. If the current 4 range bars are plotting in 10-30 seconds compared to 5 minute plot per bar, there might be strength or momentum in the current move...

not just a standard momentum indicator...
just a way to show time of one bar's time minus the last
not even sure if this is the best way to do this..
 
Code
Value.Set(ToTime(Time[0]) - ToTime(Time[1]));

Does that make sense?

kz

Started this thread Reply With Quote
 
(login for full post details)
  #4 (permalink)
Hartford, CT. USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: RTY
 
RJay's Avatar
 
Posts: 688 since Jun 2009
Thanks: 747 given, 780 received

OK I getting the picture.

I'm pretty sure Time[0] is a right now data series, it changes every tick.

To get past this, First I would change to bar close update setting.

// CalculateOnBarClose = false;

CalculateOnBarClose = true;

Now its just Time[0] - Time[1] or what ever your criteria is.

Plot the value in a bars off the price chart.

Let me know,

RJay





Reply With Quote
 
(login for full post details)
  #5 (permalink)
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received

Okay, that looks good, now to change time shown as

8297 on the 12:19 bar (which took from 11:36 to 12:19 to form)

to 00:00 for minutes:seconds...

see attached chart, (display data box doesn't come with the attached image)

do you know how to do the re-formatting?

thanks,
kz

Attached Thumbnails
Click image for larger version

Name:	ZN 09-09  6_24_2009 (4 Range).jpg
Views:	187
Size:	73.5 KB
ID:	402  
Started this thread Reply With Quote
 
(login for full post details)
  #6 (permalink)
Dallas
 
 
Posts: 23 since Jun 2009
Thanks: 27 given, 27 received

Hey zeller4, I like the way you are thinking. I can see how your indicator may confirm the 'lunch lull' and other persistent slower price action time frames that might be less conducive to a momentum strategy. I'm curious if there is a direct correlation that will be useful. Thanks for giving this a go.

Neal

Reply With Quote
 
(login for full post details)
  #7 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,785 since Jun 2009
Thanks: 32,314 given, 97,581 received

zeller4,

You are on the right track. It is important to know the length of a bar when compared to an "average" length. If the bar moves incredibly quick, it can signal a change in momentum, whereas if a bar takes a long time, it can signal chop.

I think you should consider adding an additional double to your script to record the average time of a bar, and then maybe paint the Countdown clock in a certain fashion depending if the current bar is above or below the average by a certain threshold, like 50% or something.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #8 (permalink)
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received

great idea Mike,

I'll look into that for the next version...

got some reading to do to figure out the formatting...

kz

Started this thread Reply With Quote
 
(login for full post details)
  #9 (permalink)
Austin, TX
 
Experience: Advanced
Platform: NT/Matlab
Broker: Interactive Brokers
Trading: FX majors
 
sefstrat's Avatar
 
Posts: 285 since Jun 2009
Thanks: 20 given, 760 received

Here is how I do it:

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

series.Set(span.TotalMinutes);

Reply With Quote
The following 3 users say Thank You to sefstrat for this post:
 
(login for full post details)
  #10 (permalink)
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received


Thanks to sefstrat and researching string formatting, I now have the following:

see attached screenshot.

per Mike's suggestion I'm using different colored background if it's less than the EMA(5) - not sure about the 50% level, please update as you see fit.

not sure if 5 is the "right" number for now.

still need help with formatting the EMA value... yes, I'm still in the "learning library"!

Kirk

Attached Thumbnails
Click image for larger version

Name:	ZN 09-09  6_29_2009 (4 Range).jpg
Views:	362
Size:	73.4 KB
ID:	431  
Attached Files
Register to download File Type: zip Range_Time_v01.zip (3.7 KB, 123 views)
Started this thread Reply With Quote
The following 5 users say Thank You to zeller4 for this post:
 
(login for full post details)
  #11 (permalink)
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received


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
Register to download File Type: cs A_1_Range_Time_v01.cs (8.4 KB, 78 views)
Started this thread Reply With Quote
The following user says Thank You to zeller4 for this post:
 
(login for full post details)
  #12 (permalink)
Neubrandenburg, Germany
 
Experience: Advanced
Platform: R
Trading: Stocks
 
wh's Avatar
 
Posts: 538 since Jun 2009
Thanks: 298 given, 504 received

add this on barupdate() methode at the begin:

if(CurrentBar < 5) return;

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

Reply With Quote
The following 2 users say Thank You to wh for this post:
 
(login for full post details)
  #13 (permalink)
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received

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


thanks again
kz

Started this thread Reply With Quote
 
(login for full post details)
  #14 (permalink)
Arcata, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: index futures, oil
 
Saroj's Avatar
 
Posts: 486 since Jun 2009
Thanks: 232 given, 413 received

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

Reply With Quote
 
(login for full post details)
  #15 (permalink)
Austin, TX
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Currencies
 
hondo69's Avatar
 
Posts: 165 since Jun 2009
Thanks: 57 given, 245 received

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:	204
Size:	168.9 KB
ID:	5388  
Reply With Quote
 
(login for full post details)
  #16 (permalink)
Austin, TX
 
Experience: Advanced
Platform: NT/Matlab
Broker: Interactive Brokers
Trading: FX majors
 
sefstrat's Avatar
 
Posts: 285 since Jun 2009
Thanks: 20 given, 760 received

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
The following user says Thank You to sefstrat for this post:
 
(login for full post details)
  #17 (permalink)
Austin, TX
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Currencies
 
hondo69's Avatar
 
Posts: 165 since Jun 2009
Thanks: 57 given, 245 received

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
 
(login for full post details)
  #18 (permalink)
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,251 since May 2011
Thanks: 1,591 given, 917 received


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
 
(login for full post details)
  #19 (permalink)
Las Vegas, NV
 
Experience: Advanced
Platform: Abacus, Slide Rule, HP-65, Metastock, TOS, NT
Trading: Futures
 
aligator's Avatar
 
Posts: 3,424 since Aug 2010
Thanks: 1,057 given, 5,841 received


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 futures io Trade Journal Reply With Quote
The following 2 users say Thank You to aligator for this post:
 
(login for full post details)
  #20 (permalink)
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,251 since May 2011
Thanks: 1,591 given, 917 received


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


futures io Trading Community Platforms and Indicators NinjaTrader > Range Bar Time


Last Updated on July 17, 2012


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 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