protected override void OnExecution(IExecution execution)
{
//We advise monitoring OnExecution to trigger submission of stop/target orders instead of OnOrderUpdate() since OnExecution() is called after OnOrderUpdate()
//which ensures your strategy has received the execution which is used for internal signal tracking.
// Stop-Loss order 3 ATR below our entry price
// Resets the entryOrder object to null after the order has been filled or partially filled
if (_entryBOrder != null)
{
if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
{
_stopSOrder = ExitLongStop(1, execution.Order.AvgFillPrice - ((3*atr_indicator[0])));
// _targetBOrder = ExitLongLimit(1, execution.Order.AvgFillPrice + (target * TickSize));
if (execution.Order.OrderState != OrderState.PartFilled)
{
_entryBOrder = null;
}
}
}
//We advise monitoring OnExecution to trigger submission of stop/target orders instead of OnOrderUpdate() since OnExecution() is called after OnOrderUpdate()
//which ensures your strategy has received the execution which is used for internal signal tracking.
// Stop-Loss order 3 ATR above our entry price
// Resets the entryOrder object to null after the order has been filled or partially filled
if (_entrySOrder != null)
{
if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
{
_stopBOrder = ExitShortStop(1, execution.Order.AvgFillPrice + (3*atr_indicator[0]));
// targetSOrder = ExitShortLimit(1, execution.Order.AvgFillPrice - (target * TickSize));
if (execution.Order.OrderState != OrderState.PartFilled)
{
_entrySOrder = null;
}
}
}
}
My entries are working fine but my stop loss are not....
Thanks

Comment