Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by techgetgame, Yesterday, 11:42 PM
    0 responses
    9 views
    0 likes
    Last Post techgetgame  
    Started by sephichapdson, Yesterday, 11:36 PM
    0 responses
    2 views
    0 likes
    Last Post sephichapdson  
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,615 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Yesterday, 05:56 PM
    0 responses
    10 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    20 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Working...
    X