Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

input string error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    input string error

    I went from using market orders to stop limit and I get this image error
    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");
    }
    }​​
    Attached Files

    #2
    Hello, thanks for writing in. The order handling rules will prevent a managed strategy from submitting two entry orders that go in opposite directions. Im not sure if this part of your snippet is how the code is written or if this is just to demonstrate what you are using, but be aware of this rule:

    EnterLongStopLimit(ContratosBuy, PrecioEntrada + 2 * TickSize, PrecioEntrada, @"LARGOS");
    EnterShortStopLimit(ContratosSell, PrecioEntrada - 2 * TickSize, PrecioEntrada, @"CORTOS");​

    These rules are listed here:

    https://ninjatrader.com/support/help...rnalOrderHandl ingRulesThatReduceUnwantedPositions

    Methods that generate orders to enter a position will be ignored if:
    The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction​.

    The error "Input string was not in a correct format" could be coming from some internationalization or Unicode character you are using in OnOrderUpdate that is not supported. First, try appending an @ sign to all strings in OnExcutionUpdate.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    579 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X