In my strategy backtested using 30 min. historical data I set up trailing stop like that in OnBarUpdate():
if (Position.MarketPosition == MarketPosition.Long && trailingStop == false && Close[0] - entryOrderLong2.AvgFillPrice >= 200*TickSize) {
SetTrailStop("MyEntryLong2", CalculationMode.Ticks, 10, false); // Trailing stop orders are modified in real-time and NOT on the close of a bar.
trailingStop = true;
}
protected override void OnPositionUpdate(IPosition position) {
Print(Time[0] + " OnPositionUpdate(): " + position.ToString());
if (position.MarketPosition == MarketPosition.Flat) {
trailingStop = false;
}
2009-04-16 02:30:00 Entered internal SetStopTarget() method: Type=TrailStop FromEntrySignal='MyEntryLong2' Mode=Ticks Value=10 Currency=0 Simulated=False
What can be wrong?

Comment