I am working on strategy development with a rather limited knowledge of #C. I have been successful in adding a secondary 1-tick data series as shown in the sample intrabar granularity example thats posted to the forums. However, this example does not make it clear how to get intrabar granularity for profit targets. My backtests show exact price level fills on entries (I use the EnterLong(1, 1, "entry signal") but my exits are always calculated 1 bar later. Backtest exits at the correct price but if the next bar does not hit target, when the previous bar (entry) did, then it will not register as hitting my profit target. My strategy often has entry and profit targets hit on the same bar so it is important that I get this working for generating accurate backtests.
Profit Targets are set:
else if (State == State.Configure) { //Hardcode secondary data series (tick) in order to backtest with intrabar granularity AddDataSeries(BarsPeriodType.Tick, 1); //Set Profit Targets and Stop losses SetProfitTarget("Long Entry", CalculationMode.Ticks, 36); SetProfitTarget("Short Entry", CalculationMode.Ticks, 22); SetStopLoss(CalculationMode.Ticks, 44); }
if (session_check) { if (take_trade && IBThreshold) { if (CrossAbove(Close, IBHigh, 1)) EnterLong(1, 1, "Long Entry"); if (CrossBelow(Close, IBLow, 1)) EnterShort(1, 1, "Short Entry"); } } else { ExitLong("Long Entry"); ExitShort("Short Entry"); }
Thanks!
Comment