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

Doubt - Verification Error (Filled)

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

    Doubt - Verification Error (Filled)

    Could someone help me with this problem, if I perform this verification, an error occurs.

    ================================================== ============================
    // One time only, as we transition from historical
    // Convert any old historical order object references to the live order submitted to the real-time account

    if (OrderCompra != null && OrderCompra.IsBacktestOrder && State == State.Realtime)
    OrderCompra = GetRealtimeOrder(OrderCompra);

    if (order.Name == "C1" && orderState != OrderState.Filled)
    OrderCompra = order;

    if (order.Name == "C2" && orderState != OrderState.Filled)
    OrderCompra = order;

    if (order.Name == "C3" && orderState != OrderState.Filled)
    OrderCompra = order;

    if (OrderCompra != null && OrderCompra == order)
    {
    if (order.OrderState == OrderState.Cancelled && order.Filled == 0)
    OrderCompra = null;

    if (order.OrderState == OrderState.Filled)
    OrderCompra = null;
    }
    ================================================== ============================
    NinjaScript-Output
    (Error on calling 'OnBarUpdate' method on bar 94: Object reference not set to an instance of an object.)

    ================================================== ============================​

    #2
    Hello WenisCR,

    Your code is trying to set 3 different orders to the same variable, that will eventually lead to a null error like you displayed.

    If you have "C1" C2" and C3" orders you need 3 separate order variables. OrderCompra would only represent a single order such as C1.

    The logic you have shown would need to be replicated 3 times if you have 3 orders.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,
      Thanks for the info, I'll try.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by realblubb, Today, 09:28 AM
      0 responses
      2 views
      0 likes
      Last Post realblubb  
      Started by AaronKoRn, Yesterday, 09:49 PM
      1 response
      18 views
      0 likes
      Last Post Rikazkhan007  
      Started by ageeholdings, Today, 07:43 AM
      0 responses
      12 views
      0 likes
      Last Post ageeholdings  
      Started by pibrew, Today, 06:37 AM
      0 responses
      4 views
      0 likes
      Last Post pibrew
      by pibrew
       
      Started by rbeckmann05, Yesterday, 06:48 PM
      1 response
      14 views
      0 likes
      Last Post bltdavid  
      Working...
      X