Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
indicator values for non-daily bars not consistent with daily bars?
Collapse
X
-
Chelsea,
The problem you identified in the previous post must be fixed. Thank you for that.
However, focusing on just the ‘getdaybar’ function, it still appears that ‘getdaybar’ is not returning yesterday’s OHLC values consistent with yesterday’s actual day bar. If that is correct then the indicator will not be the same for minute bars and their day bar counterparts.
The day bar values shown in the output window are the same as for the bars shown on the analyzer chart.
Please run the attached indicator/strategy for day bars and 60 minute bars and take a look at the output window, and let me know what you think.
p.s. Why does the info in the output windows repeat?
-
Hello joemiller,
The PlotXXO plot is different for minute and daily bars because you are using two different values to calculate this.
For minute bars you use this to calculate the XXOpen:
XXOpen=((XXCloseyest+Bars.GetDayBar(1).Open)*0.5);
For day bars you use:
XXOpen=((XXCloseyest+PlotXXO[1])*0.5);
The minute bars use the open of the previous session open to calculate the XXOpen. The day bars use the previous value of PlotXXO. These are two very different values and will give very different results.
Leave a comment:
-
I am painfully aware that I can be dead wrong...so thanks for your continued help.
run the strategy with the indicator I have attached and I think you will see that the 60 minute bar redline indicator values are not the same as for those day bars.
Leave a comment:
-
Hello joemiller,
Please look back at my post #26.
http://www.ninjatrader.com/support/f...5&postcount=26
In this I am comparing the open high low close of a daily bar that is preformed by the data provider, and a 60 minute bar.
Notice the open high low close values. I am showing these as exactly the same whether using High[0] as with daily bars or Bars.GetDayBar(1).High as with the 60 minute bar.
I am still uncertain of the issue.
Could you provide me data and highlight (or embolden) the descrepancies?
Leave a comment:
-
I clearly understand what the problem is…that is not the issue.
To me a day bar has a high, open, low, close. If a simulation of that day bar does not simulate the day bar, then it is not a valid simulation and is useless as a day bar.
Yes I would like it to work differently. I would like it to simulate the day bar when it says it is simulating the day bar....simulation meaning exact same values of OHLC , not an approximation. that is the day bar I need.
I would suggest it works in the manner you suggest. NT software is great at doing such calculations for such situations. . . That’s why I am so impressed by NT. I don’t have time to mickey mouse around doing it myself, especially when it would have to be tailored for different instruments. The situation is what it is. Get Day Bar does not do what I hoped it would do. it is what it is.
Leave a comment:
-
Hi joemiller,
The Bars.GetDayBar(1) call will return the day bar for the previous session. On a day bar this is straight forward as each bar is a complete session and will always return the previous session. On a minute bar this is not as straight forward because a minute bar could be part of different sessions depending on when the bar is made.
If you would like this to work differently with a minute bar and not reference the previous session how would you suggest this works?
Regarding your script, we can modify this so that it is working the way you would like.
If a bar comes out after 5 PM Eastern you can ignore that bar, or you can have it reference the second previous session to match the call made by bars before 5..
For example:
This may not be exactly what you need, however, this shows that you can change the logic so that minute bars are returning the data you desire.Code:if (ToTime(Time[0]) < 170000) { Print(Bars.GetDayBar(1); } else { Print(Bars.GetDayBar(2); }
If a bar is after 5 PM, what would you like to see from it? The current session starting at 5, the previous session starting at 5 the previous day, or the session before that starting at 5 2 days previous?
Leave a comment:
-
I don't question why it happens.
My concern is that I cannot test how my indicator strategy based on day bars will perform when tested on a minute by minute basis. Assumptions that have to be made with day bars are eliminated with the minute bars.
The way it is now, it is not the same indicator in both cases [ie] day bars and minute bars. The strong implication to me of the Bars.GetDayBar function is that it should do just that, pure and simple. I think programming wise it could be done by NT?
Leave a comment:
-
Hello joemiller,
The Bars.GetDayBar method uses the session template to find the previous day.
A daily bar will also use the session template. With the daily bar though, the bar is already formed using the Forex session template of 5:00 PM Eastern to 5:00 PM Eastern the next day.
When using a minute bar this is not done automatically for you. A minute bar that forms at 5:01 PM is going to be the first bar of the day.
This is why using get day bar with a minute series will return a different day if used on bar that is part a different session.
A minute bar made at 4:59 PM Eastern on 8/12/2013 will be part of the of the 8/11 day bar. A minute bar made at 5:01 PM Eastern on 8/12/2013 will be part of the 8/12 day bar.
This means that this is working correctly for what is printing. However, I think you may have some confusion about how session templates work.
Please take a look at the following help guide document under the section 'Understanding Session Templates'.
http://www.ninjatrader.com/support/h...on_manager.htm
Leave a comment:
-
NT is going to be rendered almost useless to me if I cannot use minute bars. If I understand the issue then most or all 24 hour exchanges are equally impacted?
I have been so overwhelmed by the power and sophistication of NT that I am surprised [shocked] that they have not addressed the problem as I perceive it.
I am aware that I am jumping to conclusions and overreacting ... and it may be a non problem.
Leave a comment:
-
are you saying that GetDayBar is always based on a calendar 24 hour day even when the forex day is defined to straddle calendar days? is that correct?
in any event, please tell me whatever you can think of to solve the problem.
many thanks
Leave a comment:
-
Hello joemiller,
Thanks for the updated script.
From your code I am seeing that the GetDayBar is matching a Daily bar.
I think you are getting confused about the session template. With forex, any bar that comes out after 5:00 PM Eastern will reference the same day it was created while any bar that comes out before 5:00 will reference the previous day.
For example:
The daily bar output
indicator 05/08/13 3:00PM//15:00
daybars open= 1.3078
daybars high= 1.3193
daybars low= 1.3070
daybars close= 1.3152
daybars indicator= 1.3096
The 360 minute bar output
indicator 05/08/13 9:00PM//21:00
minutebars open= 1.3078
minutebars high= 1.3193
minutebars low= 1.3070
minutebars close= 1.3152
minutebars indicator= 1.3101
indicator 05/09/13 3:00AM//03:00
minutebars open= 1.3078
minutebars high= 1.3193
minutebars low= 1.3070
minutebars close= 1.3152
minutebars indicator= 1.3101
indicator 05/09/13 9:00AM//09:00
minutebars open= 1.3078
minutebars high= 1.3193
minutebars low= 1.3070
minutebars close= 1.3152
minutebars indicator= 1.3101
indicator 05/09/13 3:00PM//15:00
minutebars open= 1.3078
minutebars high= 1.3193
minutebars low= 1.3070
minutebars close= 1.3152
minutebars indicator= 1.3101
indicator 05/09/13 9:00PM//21:00
minutebars open= 1.3152
minutebars high= 1.3176
minutebars low= 1.3009
minutebars close= 1.3041
minutebars indicator= 1.3123
Notice the only bar not showing yesterday's is the minute bar made after 9:00 PM.
Leave a comment:
-
strategy you are getting this output from?
print to output window code is in the indicator, not the strategy
thanks ChelseaAttached Files
Leave a comment:
-
Hi joemiller,
May I have an export of the strategy you are getting this output from?
To export your script do the following:- Click File -> Utilities -> Export NinjaScript
- Enter a unique name for the file in the value for 'File name:'
- Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
- Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message
By default your exported file will be in the following location:- (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>
Below is a link to the help guide on Exporting NinjaScripts.
Leave a comment:
-
“Bars.GetDayBar” returning incorrect values ?
Hi Chelsea,
I am hurriedly getting this sent to catch you in an attempt to generate a reply before you guys leave for the weekend. I can of course send more attachments, etc.
May8 day bars: open= 1.3078, high= 1.3193, low= 1.3070, close= 1.3152
May8 6 hour bars: open= 1.3075, high= 1.3131, low= 1.3067, close= 1.3078
Above is a summary of the results of a strategy analyzer run, suggesting that “Bars.GetDayBar” is returning incorrect values. The day bar values are correct. The 6 hour bar values are different and therefore incorrect.
the 2 line summary above is from the following output window display
from output window for day bars:
indicator 05/08/13 5:00PM//17:00
daybars open= 1.3078
daybars high= 1.3193
daybars low= 1.3070
daybars close= 1.3152
daybars indicator= 1.3096
from output window for 6 hour bars:
indicator 05/07/13 11:00PM//23:00
minutebars open= 1.3075
minutebars high= 1.3131
minutebars low= 1.3067
minutebars close= 1.3078
minutebars indicator= 1.3081
indicator 05/08/13 5:00AM//05:00
minutebars open= 1.3075
minutebars high= 1.3131
minutebars low= 1.3067
minutebars close= 1.3078
minutebars indicator= 1.3081
indicator 05/08/13 11:00AM//11:00
minutebars open= 1.3075
minutebars high= 1.3131
minutebars low= 1.3067
minutebars close= 1.3078
minutebars indicator= 1.3081
indicator 05/08/13 5:00PM//17:00
minutebars open= 1.3075
minutebars high= 1.3131
minutebars low= 1.3067
minutebars close= 1.3078
minutebars indicator= 1.3081
Leave a comment:
-
Hello joemiller,
Using a strategy plot does not work in the Strategy Analyzer.
Adding an indicator that plots using the Add() method does work in the strategy analyzer.
The sample I provided uses the Add() method.
This also works in historical on a chart.
Leave a comment:
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
60 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
148 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
162 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
97 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
284 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Leave a comment: