PDA

View Full Version : Order entry based on open condition in EOD backtest


whipsaw
02-16-2010, 03:31 AM
I'm looking for a way to implement a rather simple (pattern based) EOD strategy for backtesting. The strategy should EnterShort ONLY IF the open is above the previous day's high,if (Open[0]>High[1])
EnterShort(..)

If implemented like this, the order can obviously only be fulfilled the next day but not on the very day when the condition is fulfilled.
If I understand correctly, an order is always submitted before OnBarUpdate/after the end of the previous bar. So how can an order be linked with an open condition?

I did a cursory search in the forum but didn't find anything suitable. Any help would be highly appreciated.

NinjaTrader_Tim
02-16-2010, 06:29 AM
Hi whipsaw,

Thank you for your post, I will have someone respond on this query later today.

NinjaTrader_Josh
02-16-2010, 07:11 AM
whipsaw,

You would have to use CalculateOnBarClose = false and it would only work in real-time. In backtesting, it will behave as you have experienced in that it can only submit to the next day since your granularity is only EOD snap shots that provide you OHLC all at once and not Open then High then Low then Close.

whipsaw
02-16-2010, 08:33 AM
Josh

Hoped there would be a smart workaround. Anyhow, thanks a lot for clarification.

Baruch
02-16-2010, 08:52 AM
You can work on 1 minute bars and calculate previos day high.

Baruch