I have analyzed the chains of the input and stop and target orders and I can't find what it is due to
before with stop market orders it was perfect
EnterLongStopLimit(ContratosBuy, PrecioEntrada + 2 * TickSize, PrecioEntrada, @"LARGOS");
EnterShortStopLimit(ContratosSell, PrecioEntrada - 2 * TickSize, PrecioEntrada, @"CORTOS");
// Enviar órdenes de salida para rellenos parciales
but only change the type of order and it doesn't even open the correct target and stop amount
if (execution.Order.OrderState == OrderState.PartFilled)
{
if (Largos)
{
OrdenStop = ExitLongStopMarket(0, true, execution.Order.Filled, StopLoss, "STOP", "LARGOS");
OrdenProfit = ExitLongLimit(0, true, execution.Order.Filled, Target, "TARGET", "LARGOS");
}
if (Cortos)
{
OrdenStop = ExitShortStopMarket(0, true, execution.Order.Filled, StopLoss, "STOP", "CORTOS");
OrdenProfit = ExitShortLimit(0, true, execution.Order.Filled, Target, "TARGET", "CORTOS");
}
}
// Actualice las cantidades de nuestras órdenes de salida una vez que el estado de la orden se complete y
// hayamos visto que las cantidades de ejecución coinciden con las cantidades de las órdenes
else if (execution.Order.OrderState == OrderState.Filled && sumFilled == execution.Order.Filled)
{
// Orden Stop-Loss para OrderState.Filled
if (Largos)
{
OrdenStop = ExitLongStopMarket(0, true, execution.Order.Filled, StopLoss, "STOP", "LARGOS");
OrdenProfit = ExitLongLimit(0, true, execution.Order.Filled, Target, "TARGET", "LARGOS");
}
if (Cortos)
{
OrdenStop = ExitShortStopMarket(0, true, execution.Order.Filled, StopLoss, "STOP", "CORTOS");
OrdenProfit = ExitShortLimit(0, true, execution.Order.Filled, Target, "TARGET", "CORTOS");
}
}
Comment