I was hoping to find a very simple Day of Week, and possibly Day of Month strategy to buy the open and sell the close each day to test weekly or monthly bias. I have not been able to find anything yet for NinjaTrader. Apologies if it is already here and I missed it. Could anyone help? I am not a programmer and have stumbled around trying to create it from scratch.
I should add that I am simply using daily charts with end of day data.
Last edited by hoohickle; July 30th, 2015 at 06:27 AM.
Reason: Added more info
This post has been selected as an answer to the original posters question
You can't buy at the open of a bar and sell at the close of the same bar with Ninjatrader. The orders will always happen at the open of the next bar so you'll have to deal with overnight gaps.
The way around this limitation with Ninjatrader is to use a lower time-frame bar to execute your trades on. If you're wanting to do this with daily bars you'll need intraday data/bars for the order execution.
The other way is to use a two-pass approach: run through the daily bars and cache the closing price of each bar in the first pass. Then, in the second pass through the data enter your trade as normal and place a limit or stop order to exit at the already-known closing price so the trade will occur at the closing price of the day. That's a little trickier to code though.
The following user says Thank You to shodson for this post:
I, too, ran into this problem. . was initially frustrated at the inability to do something so simple within ninja, as well as frustrated at the fact that 'exit on close' does not, actually, exit on close, when you're using 1-day bar increments.
Hodson is right. . and I've just programmed a few templates to do precisely what you're doing, feel free to msg me if you'd like the code!