Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how do I know that the Atm has been closed

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

    how do I know that the Atm has been closed

    Hello,

    If using AtmStrategyClose() how do I know that the Atm has been closed? For example the order has been closed.



    Note: A method return value of true in NO WAY indicates that the strategy in fact is closed. It indicates that the the specified ATM strategy was found and the internal close routine was triggered.
    How to understand this sentence?

    What about using GetAtmStrategyStopTargetOrderStatus()?




    Thank you

    #2
    Hello jetheil2,

    How to understand this sentence?
    The ATM is an external strategy to the NinjaScript strategy, that means that even if the method returns true that does not mean the strategy was closed at that point. It specifically means the second part of the description: It indicates that the the specified ATM strategy was found and the internal close routine was triggered.
    It signaled to the ATM to start closing down. The NinjaScript strategy has no direct control on that ATM so it just can signal it to start its internal processes.

    What about using GetAtmStrategyStopTargetOrderStatus()?
    You can check the status however because an ATM is an external strategy it will reach a point where using those methods with the given ID will not produce any results because the strategy is closed. The best suggestion for working with ATM's that close/open a new one would be to look at how the SampleATMStrategy resets its variables to continue placing new ATMs.


    Comment


      #3
      Thank you, Jesse

      Comment


        #4
        Originally posted by NinjaTrader_Jesse View Post
        Hello jetheil2,

        You can check the status however because an ATM is an external strategy it will reach a point where using those methods with the given ID will not produce any results because the strategy is closed.
        Hello,
        If take profit/stop loss Filled, I can still get the return value(State Filled).
        (It's not "it will reach a point where using those methods with the given ID will not produce any results because the strategy is closed").

        If atm's Take Profit or Stop Loss is filled, is the ATM not closed at this time?
        Is it the different from AtmStrategyClose()?

        Comment


          #5
          Hello jetheil2,

          AtmStrategyClose is used to notify the ATM to start shutting down and close its orders/positions. That is different than knowing if an order was filled.


          Comment


            #6
            Hello jetheil2,

            If take profit/stop loss is completely Filled, the ATM will not be displayed on the chart, Is it closed?


            Specifically, I can't use AtmStrategyClose when I need to query the order status of take profit and stop loss, right?

            Comment


              #7
              Hello jetheil2,

              If take profit/stop loss is completely Filled, the ATM will not be displayed on the chart, Is it closed?
              If the ATM was complete then yes it would be closed.

              Specifically, I can't use AtmStrategyClose when I need to query the order status of take profit and stop loss, right?
              AtmStrategyClose is not used to get a status so that is correct, you would not use AtmStrategyClose to query the order status. AtmStrategyClose can be used to tell the ATM to shut down. Here is the description from the help guide of what happens when you use AtmStrategyClose:
              Cancels any working orders and closes any open position of a strategy using the default ATM strategy close behavior.

              Comment


                #8
                Hello

                Originally posted by NinjaTrader_Jesse View Post
                Hello jetheil2,


                You can check the status however because an ATM is an external strategy it will reach a point where using those methods with the given ID will not produce any results because the strategy is closed. The best suggestion for working with ATM's that close/open a new one would be to look at how the SampleATMStrategy resets its variables to continue placing new ATMs.

                What I'm wondering here is that if the Take Profit and Stop Loss are completely filled, then I can't find out whether the status is filled through GetAtmStrategyStopTargetOrderStatus?

                Comment


                  #9
                  Hello jetheil2,

                  Based on the help guide description the answer would be no. You can only work with still active ATM's. an ATM is external so you can only observe it while its active, if you need to work with orders in a more logical way then you need to use the managed or unmanaged strategy approach instead.


                  Gets the current order state(s) of the specified stop or target order of a still-active ATM strategy.


                  Notes:

                  1.If the method can't find the specified order(s), an empty array is returned.


                  Comment


                    #10
                    Originally posted by NinjaTrader_Jesse View Post
                    Hello jetheil2,


                    The ATM is an external strategy to the NinjaScript strategy, that means that even if the method returns true that does not mean the strategy was closed at that point. It specifically means the second part of the description: It indicates that the the specified ATM strategy was found and the internal close routine was triggered.
                    It signaled to the ATM to start closing down. The NinjaScript strategy has no direct control on that ATM so it just can signal it to start its internal processes.



                    You can check the status however because an ATM is an external strategy it will reach a point where using those methods with the given ID will not produce any results because the strategy is closed. The best suggestion for working with ATM's that close/open a new one would be to look at how the SampleATMStrategy resets its variables to continue placing new ATMs.

                    Hello Jesse,

                    I have tested and found that when the ATM is closed GetAtmStrategyRealizedProfitLoss(atmId)
                    GetAtmStrategyMarketPosition(atmId) can get the correct value.

                    This is also reasonable, because if the ATM is closed and RealizedProfitLoss cannot take a value, then RealizedProfitLoss does not make sense.

                    But GetAtmStrategyStopTargetOrderStatus can't get the value.
                    Last edited by jetheil2; 03-04-2022, 06:53 AM.

                    Comment


                      #11
                      Hello jetheil2,

                      This is Jim responding on behalf of Jesse who is out of the office at this time.

                      This is related to the same limitation mentioned in the thread below. My colleague NinjaTrader_BrandonH also has some insight on how you can workaround this by listening to Account.OrderUpdate events.

                      Hi, I have implemented a Strategy that use ATM strategy to manage the order. I have used the code of the sample provided with the platform. It works fine except when market is fast and the OCO order are rejected. this is an error message of that situation: 2021-12-10 14:30:03:821|1|32|Order='b32dcc5c81de44309ab98a6e6


                      We have also tracked your impact in our internal ticket SFT-4832. (We cannot offer an ETA or promise of fulfillment, but your impact on this limitation is tracked for improvement in the future.)

                      When new enhancements are implemented, they will be listed in the Release Notes page of the Help Guide. The ID number will be different than the internal feature request tracking ID, but the description of the feature will let you know if that feature has been implemented.

                      Release Notes - https://ninjatrader.com/support/help...ease_notes.htm

                      Comment


                        #12
                        Hello Jim,


                        Thank you .

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by NullPointStrategies, Yesterday, 05:17 AM
                        0 responses
                        56 views
                        0 likes
                        Last Post NullPointStrategies  
                        Started by argusthome, 03-08-2026, 10:06 AM
                        0 responses
                        132 views
                        0 likes
                        Last Post argusthome  
                        Started by NabilKhattabi, 03-06-2026, 11:18 AM
                        0 responses
                        73 views
                        0 likes
                        Last Post NabilKhattabi  
                        Started by Deep42, 03-06-2026, 12:28 AM
                        0 responses
                        45 views
                        0 likes
                        Last Post Deep42
                        by Deep42
                         
                        Started by TheRealMorford, 03-05-2026, 06:15 PM
                        0 responses
                        49 views
                        0 likes
                        Last Post TheRealMorford  
                        Working...
                        X