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 frslvr, 04-11-2024, 07:26 AM
    9 responses
    120 views
    1 like
    Last Post caryc123  
    Started by rocketman7, Today, 09:41 AM
    4 responses
    15 views
    0 likes
    Last Post rocketman7  
    Started by selu72, Today, 02:01 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Zachary  
    Started by WHICKED, Today, 02:02 PM
    2 responses
    13 views
    0 likes
    Last Post WHICKED
    by WHICKED
     
    Started by f.saeidi, Today, 12:14 PM
    8 responses
    21 views
    0 likes
    Last Post f.saeidi  
    Working...
    X