protected override void Initialize() { ...................GENERIC CODE CUT HERE................... Add("ES 12-10", PeriodType.Minute, 1); Add("YM 12-10", PeriodType.Minute, 1); Add("NQ 12-10", PeriodType.Minute, 1); SetStopLoss("Long", CalculationMode.Ticks, 16, false); SetProfitTarget("Long", CalculationMode.Ticks, 70); SetStopLoss("Short", CalculationMode.Ticks, 15, false); SetProfitTarget("Short", CalculationMode.Ticks, 80); } protected override void OnBarUpdate() { if(BarsInProgress == 0){ tfTrade(); } if(BarsInProgress == 1){ esTrade(); } if(BarsInProgress == 2){ ymTrade(); } if(BarsInProgress == 3){ nqTrade(); if(something) EnterLong(0, Quantity, "Long"); else EnterShort(0, Quantity, "Short"); }
I noticed that if I don't enter the trade from the last BarsInProgress (in this case 3) that it will enter the trade a bar late. However when doing this the stop doesn't become active for an extra bar. When I do everything from BarsInProgress == 0 there is no problem. However I would like to use this extra market data if possible.
Am I missing something obvious?
Comment