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

NT8 Managed Orders: How to get list of current orders

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

    NT8 Managed Orders: How to get list of current orders

    I'm using a managed order approach & am having trouble with almost hourly crashouts because of Order rejected due to “OCO ID cannot be reused”
    Then the strategy stops due to RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose; And sometimes leaves an unprotected position.
    I’m moving the stops to follow up price action so probably at some points the target is filled & strat is still trying to move the stop up.

    #1 Is there a way to improve this issue & not have it crash all the time?
    #2 Failing any solution is there a way to check if any outstanding orders exist? What I would like to do is set RealtimeErrorHandling.IgnoreAllErrors
    and every bar if there is a current position I would check if there is a stop & target order. If there’s not orders & an open position I will flatten position.
    My goal is to keep the strategy running without having to stop & restart it every time there’s an error.

    Any help appreciated.

    #2
    Hello saturntd,

    Are you using unique OCO orders or are you attempting to pair these with orders that are filled or cancelled?

    How are you making OCO Ids? Are these using a unique string generator like GetAtmStrategyUniqueId()?
    Are you adding the CurrentBar number to the OCO string?
    Are you adding a datetime to the string to ensure these are unique?
    Are you using a counter to increment each new order pair to ensure they are unique (is the strategy being enabled and re-enabled or are there multiple instances being enabled?)

    You would need to add orders to some array or collection to track them if you want to track working orders. It is possible to do but requires custom code.
    An example that may help is linked below.
    Hello, I've updated the DailyLossLimit and DailyLosLimitMultiTrade examples that were posted on the forum for NinjaTrader 7 for NinjaTrader 8. These are often requested and I felt they are good examples to have for NT8. DailyLossLimitExample_NT7 - http://ninjatrader.com/support/forum...241#post451241 (http://ninjatrader
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea,
      I'm using the Ninja Managed Approach to orders & the orders are part of a named group.
      Ninja is the one creating OCO Ids.
      SetProfitTarget, SetStopLoss, EnterShortLimit all have the same name.

      Comment


        #4
        Hello saturntd,

        I would not expect SetStopLoss() or SetProfitTarget() to re-use OCO ids. EnterShortLimit() cannot use an OCO ID.

        Please send an email to platformsupport [at] ninjatrader [dot] com so that we may request your log and trace files. In the email please include a link to this forum thread.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Jon17, Today, 04:33 PM
        0 responses
        1 view
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        6 views
        0 likes
        Last Post Javierw.ok  
        Started by timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Started by alifarahani, Today, 09:40 AM
        6 responses
        41 views
        0 likes
        Last Post alifarahani  
        Started by Waxavi, Today, 02:10 AM
        1 response
        21 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Working...
        X