Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AtmStrategyClose question NT65

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

    AtmStrategyClose question NT65

    Hi

    I was hoping to get some direction with respect to the AtmStrategyClose()
    It says in the online manual that if it returns TRUE in "NO WAY" indicates that the strategy in fact has been closed.

    I believe may automated strategy is suffering from this problem.
    99% of the time if price closes through the volatility stop the ATM order is cancelled and a new order is issued.

    However, very seldomly the order does not close and a new order is triggered.
    So I end up with 2 orders.... the problem is that since both orders have stops and targets and it is difficult to tell which one belongs to the other so the only way to get around the close the ATMs so the strategy needs to be restarted

    Is there a proper way to confirm an order is truly closed or should i preserve the ATMStrategyID and check it on the next bar to see if it is truly closed.

    Any thoughts or direction would be greatly appreciated

    Thank you

    Sammy

    #2
    Hi Sammy,

    Correct - it indicates true only when it finds the ATMStrategy with the given ID.

    The ATMStrategyClose routine moves your limit order on other side of the market so that it fills, so you can work off fill state of this order to identify if you are closed.


    Because this method requires AtmStrategyID, you'll have to be sure you don't reset this until you verify fill state of this order.

    You could also check if you're flat with:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the info

      I think i will save the atmstrategyID and then check to see if it is flat for a couple of bars after the new entry. if it is not flat i will re-issue the atmstrategyclose command

      i do not understand though why there is no positive check to confirm the order is truly cancelled.... will something be done in the future to correct this.... it seems a little too loose.

      thank you

      Sammy

      Comment


        #4
        Hi Sammy,

        It would be great to eliminate this, but in-flight executions are a known risk of electronic trading.

        To minimize this risk, your stop order should not be within close range of market when calling AtmStrategyClose()
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Ryan

          I have had this problem of an order not closing correctly whether the stop was near the market price or far away, (10 ticks away).

          My strategy using an ATR method which reverses a trade when price closes through the volatility stop.
          sometime the stop is near by other times it is far away depending on how far price has travelled since the previous entry. I want to reverse position closing the previous order and creating another in the other direction. You mention if the stop is near the market price this error can occur? why is this... is NT getting confused with the ATMStrategyclose and the stop? either way the order shoul dhave been closed.

          My strategy currently is running on calculateonbarclose=TRUE. For me to check to see if the order was actually closed would require a bar to close again ( i would save the previous atmstrategyID and if it was not flat i could issue the ATMStrategyClose() again for that order.)

          I try and duplicate the error on replay but it does not occur. Why would this be?

          Should i switch the strategy to calulateonbarclose=false? so i will be able to check it again sooner?
          I know this entails alot of changes in my code. Having orders fire on the first tick of the new bar... etc

          What do you suggest? The thing is that most of the time it works just fine.... and the few times that it does not work leaves me not trusting the code.

          Regards and Thank you

          Sammy

          Comment


            #6
            Sammy, if the error does not occur on replay, where does it occur? Could you perhaps share your code so we can take a closer look?
            AustinNinjaTrader Customer Service

            Comment


              #7
              Ryan or someone
              could you kindly please respond to the below
              Thank you
              Sammy

              Originally posted by SammyC View Post
              Ryan

              I have had this problem of an order not closing correctly whether the stop was near the market price or far away, (10 ticks away).

              My strategy using an ATR method which reverses a trade when price closes through the volatility stop.
              sometime the stop is near by other times it is far away depending on how far price has travelled since the previous entry. I want to reverse position closing the previous order and creating another in the other direction. You mention if the stop is near the market price this error can occur? why is this... is NT getting confused with the ATMStrategyclose and the stop? either way the order shoul dhave been closed.

              My strategy currently is running on calculateonbarclose=TRUE. For me to check to see if the order was actually closed would require a bar to close again ( i would save the previous atmstrategyID and if it was not flat i could issue the ATMStrategyClose() again for that order.)

              I try and duplicate the error on replay but it does not occur. Why would this be?

              Should i switch the strategy to calulateonbarclose=false? so i will be able to check it again sooner?
              I know this entails alot of changes in my code. Having orders fire on the first tick of the new bar... etc

              What do you suggest? The thing is that most of the time it works just fine.... and the few times that it does not work leaves me not trusting the code.

              Regards and Thank you

              Sammy

              Comment


                #8
                Hi Sammy,

                If there's an issue with the platform, we need it isolated to a reproducible scenario with as simple script as possible. Since it doesn't happen everytime, you will first have to look at isolating the exact conditions and simplifying code until you can identify what is contributing.
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                670 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                379 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                111 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                575 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                582 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X