For example. I am testing on the 15min chart and I check IsFirstBarOfSession and mark my openingRangeHigh/Low then place StopMarket orders in each direction at the high/low +- TickSize. However I believe this will only result in 1 side of the order. The scenario I am trying to achieve is the following.
First 15min candle closes with a high of 101.99 and a low of 101.01. I would like to enter a long position whenever we hit 102.00 or a short position if we high 101.00. I can use If I am using CrossAbove/CrossBelow with a minute chart and load the 15min bars as well but do not like this hacky approach and would not give accurate backtesting results.
I also understand that some candles will cross both the high & low of my range and at that point some assumptions have to be made about how the candle formed, however I am not finding any documentation on how to achieve my desired result.
if (Bars.IsFirstBarOfSession)
{
openingRangeHigh = High[0];
openingRangeLow = Low[0];
var qty = StrategyHelpers.GetOrderSizeByAmount(OrderAmount, Close[0]);
EnterShortStopMarket(qty, openingRangeLow - TickSize, @"short");
EnterLongStopMarket(qty,openingRangeHigh + TickSize, @"buy");
}​
Comment