Thanks
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Day Data File Reference Issue
Collapse
X
-
Day Data File Reference Issue
I'm running a strategy that uses 2 timeframes, 1 minute and 1 day. I've narrowed the problem down to NT not referencing the day data file by using the Print statement. I've googled and also seen that others had this issue. Do you guys know what to do? I cannot post the strategy as it is confidential. It is not due to BarsInProgress or anything like that, I narrowed it all the way down to running a default strategy created by the wizard and then unlocked, using 1 min as primary and referencing 1 day data. It will not reference the day data file.
ThanksTags: None
-
public class Tony : Strategy
{
#region Variables
// Wizard generated variables
private int offer = 1; // Default setting for Offer
private int bid = 1; // Default setting for Bid
private int stop = 1; // Default setting for Stop
// User defined variables (add any user defined variables below)
#endregion
double OpenNatty;
protected override void Initialize()
{
Add(PeriodType.Day,1);
CalculateOnBarClose = true;
}
protected override void OnBarUpdate()
{
OpenNatty = Opens[1][0];
Print(OpenNatty);
Print(5+5);
}
}
Comment
-
This does not work. It doesn't work if I put CalcOnBarClose to true or false. The only time I can make it run the print statements is if I remove the additional time series (and thus the two-dimensional array). Is it something with the array referencing the day data files?
Comment
-
-
This will not fix the problem. There is some bad minute data with missing prints, etc. I need the open high low and close of the day. I would rather not simply try to circumvent the problem. I want to use the day data along with minute.
Comment
-
Hello albazzaztariq,
The 1440 Minute Series is usually good to use since you are already loading up Minute Data as well as you are able to control the Session of the 1440 Minute Series.
With that said, if you want to use Day this should be fine. I suspect that this is either going to be due to an error, no Daily Data, or a "Min bars required" or "BarsRequired" that is throwing off what you would expect.
If it was an error in your strategy you should see this inside of the Log tab of the Strategy Analyzer. You may see something like "You are accessing an index with a value that is invalid since its out of range".
To check to see if you have Daily data you may check this inside of the Historical Data Manager under Tools -> Historical Data Manager -> Edit tab.
My guess would be the "Min Bars Required" or "BarsRequired" setting of your Strategy. If you have verified that you have data and you are not getting an error you may want to change the "Min bars required" setting inside of your Strategy Parameters to 0 and try this again.
Note that you may want to add:
protected override void OnBarUpdate()
{
// Checks to ensure all Bars objects contain enough bars before beginning
if (CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired)
return;
//rest of code
}
To make sure that you do not get an error.
Let me know if that makes your strategy work more like what you are expecting.JCNinjaTrader Customer Service
Comment
-
It was min bars required. Thanks. Using the 1440 min wouldn't work because there were missing prints and I need the open, high, low, and close for the trading day. These were not correct with the minute data but were with day data. That is why I need the day data. Thank you
Comment
-
if (ToTime(Time[0]) == ToTime(18,00,00))
{
OpenNC = Opens[1][0];
Print(OpenNC);
Print(5+5);
}
Why when I add the time variable will it no longer print?
Comment
-
-
The open for natural gas is @ 6 PM. Going back to what I said before "nevermind", I said why does this not work...
if (ToTime(Time[0]) == ToTime(18,00,00))
{
OpenNC = Opens[1][0];
Print(OpenNC);
Print(5+5);
}
at 6 pm, why can it not pull in the open of the bar data from the day data? I even change it to 1 second after and it will not do it. If I change it to 6:01 PM, it works, but this is too late.
Comment
-
Hello albazzaztariq,
This can be due to either the BarsInProgress or BIP has not occurred yet for the Day Data Series or most likely due to the Bar time stamp. NinjaTrader is going to report back the Time[0] for close time of the bar meaning that data from 6:00:00 PM to 6:00:59 PM is going to be reported on the 6:01 PM Bar time stamp.
In real-time if you have CalculateOnBarClose (COBC) set to false using a Minute chart you will want to get the 6:01 PM bar as it is forming since it will get you the data that you are looking for.
For more information about the Time Stamps of a bar you may view our Help Guide at the following link under "Understanding the variables involved in building chart bars".
Let me know if you have any further questions as I would be happy to clarify.JCNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by usazencort, Today, 01:16 AM
|
0 responses
1 view
0 likes
|
Last Post
by usazencort
Today, 01:16 AM
|
||
Started by kaywai, 09-01-2023, 08:44 PM
|
5 responses
603 views
0 likes
|
Last Post Today, 12:32 AM | ||
Started by xiinteractive, 04-09-2024, 08:08 AM
|
6 responses
22 views
0 likes
|
Last Post Today, 12:31 AM | ||
Started by Pattontje, Yesterday, 02:10 PM
|
2 responses
21 views
0 likes
|
Last Post
by Pattontje
Yesterday, 11:49 PM
|
||
Started by flybuzz, 04-21-2024, 04:07 PM
|
17 responses
230 views
0 likes
|
Last Post
by TradingLoss
Yesterday, 11:45 PM
|
Comment