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

Trouble with unmanaged

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

    Trouble with unmanaged

    I'm having a problem that I hope someone can set me straight on.


    1) Current Ask is 500. I'm putting in multiple buy prices. The first at 400 and the second at 300.
    2) The first buy price is hit when it pulls back to 350. The price then moves up to its exit/target price.
    3) Since the second buy price @ 300 (which was entered at the same time as the first buy) was never reached on the pullback, I now need to cancel that order.

    1 & 2 are working fine. However, for whatever reason, I cannot get #3 to happen. In the:

    protected override void OnOrderUpdate(IOrder order)

    section, I'm putting in the following:

    Code:
                if (targetOrder1 == order)
                {
                    Print(order.ToString());
                    if (order.OrderState == OrderState.Filled)
                        CancelOrder(entryOrder2);
                }
    The idea is that once the first target has been reached and filled, the second order ("entryOrder2") should be canceled if it was not filled to begin with. However, it isn't happening.

    Could someone tell me what is wrong with my methodology?

    Thanks

    #2
    I seemed to have fixed the problem. Not exactly sure what was going on. I'm still a little confused by the whole Unmanaged situation.

    Anyhow. While I have your attention. Is there a command to cancel all pending orders? Or do I have to do each individually?

    Comment


      #3
      lookOutBelow, unfortunately there is not a method to close out all pending orders. At the moment, it is necessary to cancel each individually.
      AustinNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Tim-c, Today, 02:10 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Taddypole, Today, 02:47 PM
      0 responses
      2 views
      0 likes
      Last Post Taddypole  
      Started by chbruno, 04-24-2024, 04:10 PM
      4 responses
      50 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      10 responses
      399 views
      1 like
      Last Post beobast
      by beobast
       
      Started by lorem, Yesterday, 09:18 AM
      5 responses
      25 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X