View Full Version : Add(PeriodType.Day, 1) Prevents OnBarUpdate on historical bars?
DarrylT
07-02-2007, 05:26 AM
Hi,
I used the TradeStation stragegy to extract the attached data, and imported it into NT (ER2 since 1/2/2007 - oops, the forum doesn't allow attachments this big, file not attached). When I open an output window, create a chart with hourly bars and apply the attached strategy there is only one line printed to the output window from OnBarUpdate, for the last bar on the chart. It appears OnBarUpdate does not execute for the historical bars on the chart. There are no historic trades shown on the chart.
If I then comment out the Add() in Initialize, compile and reload NinjaScript, the output window shows lines for historical bars since 20070617. (I have 'days back' on the chart set to 17, changing 'days back' to 100 gets output lines starting with 20070326.) Historical trades are also displayed on the chart.
A couple of questions:
- How can I create a multi-time frame chart with hourly and daily bars, and get OnBarUpdate to execute for historical bars and historical trades displayed on the chart?
- Would it be possible to expand the size limit for zip file attachments? The current limit of 98k prevented attaching the data file.
Thanks,
Darryl
NinjaTrader_Dierk
07-02-2007, 06:10 AM
- please check out logs if there are some funny messages indicating the cause of the trouble
- make sure you have set "Exit On Session Close" option to False
- we will not expand the attachment limit to protect the forum against spam robots. You always can submit large attachments by Help->Mail to support
- If problem persists: please PM me both data files for daily and intraday data to "dierk AT ninjatrader DOT com" using the Help->Mail to support function.
DarrylT
07-02-2007, 06:27 AM
There are no funny messages in the logs.
The setting of exit on close is the same with or without the Add() commented out, so would appear to be irrelevant.
The problem 'persists', files have been emailed.
Thanks,
Darryl
NinjaTrader_Dierk
07-02-2007, 06:31 AM
Thanks. I PM'ed you.
DarrylT
07-03-2007, 11:35 AM
Hi,
I imported daily data for the same symbol and time window (since 1/2/2007) and plotted a chart, screenshot attached. A couple of highlights:
- The date scale appears to be European (day, month, year) but my system is set for Eastern US (should be month, day, year?).
- Not all the data is plotted. The imported data ends in March, then current simulator data plots a bar. Either the import didn't bring in all the data in the file, or the chart isn't showing it all. How can I tell which, and correct it?
Thanks,
Darryl
NinjaTrader_Dierk
07-03-2007, 12:01 PM
- apparently your local PC settings go with European date formatting. You need to change it to US if you want to have US date formatting
- Did you rename the to ER2 09-07 to make sure you are importing to that expiry?
DarrylT
07-03-2007, 01:54 PM
I already said my time zone is Eastern US. Please see attached screenshot of regional settings to confirm my machine is not set to European date format. Given my machine settings are US, why is NT showing daily chart dates in European format?
Since it wasn't necessary to rename the import data file when importing the one minute bars I didn't think it was necessary to rename the file to import the daily bars. Just for giggles, I renamed the import file to ER2 09-07.txt and imported again, it didn't make any difference. The chart still does not show all the data. What happens when you import the data and create a chart with it?
What else do you need from me to diagnose and correct these problems?
Thanks,
Darryl
NinjaTrader_Dierk
07-03-2007, 02:05 PM
a) My apologized. The formatting bug must have been introduced lately. We'll fix it with next release.
b) I tried importing the file you attached this morning (before and after renaming to ER2 09-07) into an empty DB and it worked well: daily data shows up to 2007-06-29 as expected
DarrylT
07-03-2007, 02:44 PM
I'm glad to hear you were able to import and chart the complete data file. What is it I need to do so I can get the same result?
NinjaTrader_Christian
07-04-2007, 01:39 AM
I already said my time zone is Eastern US. Please see attached screenshot of regional settings to confirm my machine is not set to European date format. Given my machine settings are US, why is NT showing daily chart dates in European format?
Hi Darryl,
Please:
- open a chart
- open chart properties
- set 'Date label format for daily bars' to MM/dd/yyyy
- close chart properties
- context menu -> Templates -> 'Save As Default'
- close chart
- open new daily chart ==> chart has US daily settings
Date format is european, because it was initialized wrong. I changed the initialization, will be available in the next release.
NinjaTrader_Dierk
07-04-2007, 03:37 AM
I'm glad to hear you were able to import and chart the complete data file. What is it I need to do so I can get the same result?
I suggest trying with an empty DB and see if you could reproduce by results.
DarrylT
07-04-2007, 08:07 AM
Christian - thanks, that works great.
Dierk - I tried to use Instrument Manager to delete a symbol, but it doesn't look like that option exists. I can delete an instrument list, and delete a master instrument. But it appears one can only remove a symbol from an instrument list, not sure if that deletes it from the db. When I did the remove and tried to close Instrument Manager it wouldn't, and instead repeatedly gives the Unhandled Exception in the attached screenshot. I tried continue several times, but finally had to quit and send crash information to Microsoft to get out of NT. After re-opening NT the symbol was still present, removing it worked this time (maybe having an open chart during the previous remove attempt caused the Exception). After re-importing the daily data it is all now visible on the chart.
Thanks,
Darryl
NinjaTrader_Dierk
07-04-2007, 08:35 AM
Great you got it resolved. I tried to reproduce what you experienced on the instrument manager, but did not encounter any problem: Instrument in the list was deleted as expected as I removed the "master" on the grid.
I suggest you do a DB repair: Tools->Options->Misc->Repair DB