I want to compare and build a logic around where to place my stop orders.
I have a long that executes:
EnterLong(Convert.ToInt32(PositionSize), @"myLong L");
This is where it places my stop and target orders:
//////////////////////////////////////////////////////////////////////
protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
{
if (Position.MarketPosition == MarketPosition.Long)
{
// Stop-Loss order 4 ticks below our entry price
stopOrder = ExitLongStopMarket(0, true, execution.Order.Filled, execution.Order.AverageFillPrice - StopLoss * TickSize, "myLong LSTOP", "myLong L");
// Target order 8 ticks above our entry price
targetOrder = ExitLongLimit(0, true, execution.Order.Filled, execution.Order.AverageFillPrice + ProfitTarget * TickSize, "myLong T", "myLong L");
}
}
////////////////////////////////////////////////////////
I want to change my stopOrder couple of times based on price.
Then I want to move stop only if current stopOrder is lower then my expected price.
I'm not sure what the exact syntax would be:
if (Close[0] >= stopOrder.ToString.Value?? + 10 * TickSize) < --- is this right?
{
.
.
.
}
Comment