Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to use GetLow(), GetHigh(), etc
Collapse
X
-
How to use GetLow(), GetHigh(), etc
When using Calculate.OnBarClose, how would I access the current high/low of the bar that is currently developing? -
Hello Lumbeezl,
Thanks for your post.
With Calculate.OnBarClose your script will only run once at the end of the bar and can only access the historical data. The bars ago of [0] will point to the just closed bar.
If you need to access the currently forming bar, you will need to use either Calculate.OnEachTick or Calculate.OnPriceChange. The bars ago of [0] will point to the currently forming bar and [1] will point to the just closed bar.
The recommendation would be to use Calculate.OnEachTick or Calculate.OnPriceChange and segment your code so that some parts will run only once per bar and other parts that need the information of the currently forming bar can operate on each tick or price change. We have a working example of this in the educational section of the help guide, here is a direct link to the example: https://ninjatrader.com/support/help...either_cal.htm
Paul H.NinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Balage0922, Today, 07:38 AM
|
0 responses
3 views
0 likes
|
Last Post
by Balage0922
Today, 07:38 AM
|
||
Started by JoMoon2024, Today, 06:56 AM
|
0 responses
6 views
0 likes
|
Last Post
by JoMoon2024
Today, 06:56 AM
|
||
Started by Haiasi, 04-25-2024, 06:53 PM
|
2 responses
19 views
0 likes
|
Last Post
by Massinisa
Today, 05:32 AM
|
||
Started by Creamers, Today, 05:32 AM
|
0 responses
6 views
0 likes
|
Last Post
by Creamers
Today, 05:32 AM
|
||
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
12 responses
1,786 views
0 likes
|
Last Post
by Leafcutter
Today, 05:30 AM
|
Comment