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 timmbbo, Today, 08:59 AM
      1 response
      2 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by KennyK, 05-29-2017, 02:02 AM
      2 responses
      1,280 views
      0 likes
      Last Post marcus2300  
      Started by fernandobr, Today, 09:11 AM
      0 responses
      2 views
      0 likes
      Last Post fernandobr  
      Started by itrader46, Today, 09:04 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by bmartz, 03-12-2024, 06:12 AM
      5 responses
      33 views
      0 likes
      Last Post NinjaTrader_Zachary  
      Working...
      X