![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Jan 2012
Posts: 47
Thanks: 26
Thanked 0 times in 0 posts
|
Hi all,
If 'Calculate on bar close' if False are the values of Open[0], Close[0], High[0] and Low[0] modified with each tick before OnBarUpdate gets called? I'm guessing the answer is yes but want to confirm. john |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hi John,
Thanks for the post. The standard Open ,High, Low, Close values for your bars would be considered price data, so they will update independent of CalculateOnBarClose settings. There isn't available a COBC setting for standard price bars. If you use Open[0], Close[0], etc in a script, then their values will update according to the scripts' CalculateOnBarClose settings. If CalculateOnBarClose = false, then OnBarUpate() will be raised with each tick. If COBC = true, then OnBarUpdate() is raised only on bar close.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_RyanM for this post: |
|
|
|
#3 |
|
Member
Join Date: Jan 2012
Posts: 47
Thanks: 26
Thanked 0 times in 0 posts
|
Thank you for your response. I didn't ask the question well. I understand that onbarupdate is called differently based on the CalculateOnBarClose setting.
The scenario I was exploring was if CalculateOnBarClose is false and OnBarUpdate is called with each tick. In that scenario are High[0] and Low[0] updated by the platform with each tick or is High[0] only set at the end of the time frame? I want to be absolutely sure. john |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
Hi John, they would be updated with each tick as well, so as new Highs and Lows are seen. With CalculateOnBarClose set to 'false' index 0 always means the currently developing / updating bar. With CalculateOnBarClose set to 'true' index 0 means the last completed bar.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Feb 2012
Location: Canary Islands
Posts: 16
Thanks: 2
Thanked 0 times in 0 posts
|
Hi Ryan,
On historical testing I understand the setting 'calculate on bar close' = false is irrelevant as it is always calculated as 'calculate on bar close' = true. I have a strategy that enters a limit order 3 pips lower than the high of the last bar. What I would like the strategy to do is that: "IF two bars have passed since the limit order was placed and the limit order is not filled, cancel the limit order". I have done this for historical testing by assigning an integer variable (called 'barcount') thats adds 1 to itself each time OnBarUpdate is called, and when 'barcount' = 3 then do not resubmit the limit order. This works on historical testing because OnBarUpdate is called on each bar for historical testing ('calculate on bar close' = true). So...my question is how do I achieve the same thing for live testing when 'Calculate on bar close' = false, as each OnBarUpdate will calculate on each tick.? Many thanks. |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hi adam_norsworthy,
You can check when property FirstTickOfBar == true which is only once per bar. A sample showing best way to combine bar close/every tick logic is available here: http://www.ninjatrader.com/support/f...ad.php?t=19387
Ryan M
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_RyanM for this post: |
|
|
|
#7 |
|
Junior Member
Join Date: Feb 2012
Location: Canary Islands
Posts: 16
Thanks: 2
Thanked 0 times in 0 posts
|
Perfect. Thanks Ryan.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Is there a data structure that holds Close,Open,Low, High of a bar? | freewind | General Programming | 5 | 02-27-2011 08:24 PM |
| How can I get the High, Low, Open, Close from BarsArray? | atrader | General Programming | 2 | 04-24-2009 08:47 AM |
| Charting high/low/close and open/close widths | gluebunny | Charting | 11 | 09-29-2008 10:47 AM |
| Plotting Open, High, Low, and Close. | strategy1 | General Programming | 1 | 07-22-2008 03:20 PM |
| Trouble with Open, High, Low, Close | SuzyG | Indicator Development | 4 | 03-05-2007 04:03 AM |