I am attempting to create a bool that tells my strategy whether or not a stop loss order was filled.
in OnExecution update I ahve something like:
if (OrderFilled(execution.Order)) { if (IsEntryOrder(execution.Order)) { _entryPrice = execution.Order.AverageFillPrice; SetCurrentPositionType(execution.Order); if (IsLongPosition()) { // do this } else if (IsShortPosition()) { // do this } } else if (IsExitOrder(execution.Order)) { if (execution.Order.Name == StopLoss) { _stopLossTriggered = true; } } else { SetCurrentPositionType(execution.Order); } }
else if (BarsInProgress == 1) { if (IsFirstTickOfBar) { _stopLossTriggered = false; }
However, I am unable to get this to work. Just looking for a point in the right direction. This his stumped me.
Comment