I am trying to program what you think would be a simple program...Yet I am struggling..Please help
I would like to test based on entering trades on the open of a time frame (i.e 5min,30min,1hr,4hr etc.)
and then exiting on the close of that bar or timeframe... This seems to be more difficult than I thought as I have only novice programming experience.. Any Help or a nudge in the right direction on this would be greatly appreciated. This is for backtesting purposes.
There is no simple way to do it with Ninjatrder. By default, orders happen at the open of the next bar, at least in backtests. The only alternative with Ninjatrader is to use a lower time-frame bar to execute orders on, but even that is not perfect. So if you have daily bars and you want to enter at the close, you can, say, have a second price series of 1min bars and if you want to exit on the close at 4pm you have to examine the 1min bar and do your executions at 3:59 just before it closes. Or some variation of that. The smaller the timeframe of your secondary data series, the longer your backtests will take to run.
You should read through this and look at the "SampleMultiTimeFrame" sample strategy that comes with Ninjatrader.
To be honest, it's not much of an issue with intradtay data, which usually doesn't have gaps, but if you're dealing with daily bars it's a much bigger issue.
The following user says Thank You to shodson for this post: