Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

atmStrategy not cancelled

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

    atmStrategy not cancelled

    My strategy entered a trade and updated unrealizedPnL properly.

    I cancelled the strategy from the Strategies tab. I know I cancelled the right strategy as it showed the same unrealizedPnL in the Strategies tab as in the chart. The Positions tab showed I was flat. The Strategies tab showed Realized for the trade and Unrealized as 0 as it does for a closed strategy.

    The chart however is still updating unrealizedPnL. How can this be? My cs checks the atmStrategyID to see if it is closed. Somehow it is getting data saying the position is still open.

    There are no errors in the Log.

    Under what conditions can this occur?

    Thanks.

    ps. beta 10

    #2
    Asking the question another way....

    I am using this code to close the position:

    if ( atmStrategyIdBreak.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyIdBreak) != Cbi.MarketPosition.Flat )
    AtmStrategyClose(atmStrategyIdBreak);

    How can this code then return a working position:

    GetAtmStrategyMarketPosition(atmStrategyIdBreak)

    Should NT not retire/cancel that atmStrategyID?

    Comment


      #3
      No, the ATM object still exists and could hold a virtual position.

      Example:

      Go long in ATM (Entry execution exists internal to the strategy)
      Terminate the ATM strategy (assuming that no exit execution made it into this object)
      This object will still be long 1 even if terminated.
      RayNinjaTrader Customer Service

      Comment


        #4
        thanks Ray

        Is there a better way then to close the position?

        I tried adding:
        atmStrategyIdBreak = string.Empty;

        This stops the unrealizedPnL updates...however does not terminate the strategy.

        I need code that not just closes the position but also terminates the strategy so that when I use get... it returns closed just as though an exit execution made it to the object.

        This is key to what I am doing.

        Any solutions within NT?

        Comment


          #5
          Off the top of my head nothing comes to my mind. You really would have to take the supported methods and check them out to see what options you may have...Ultimately, that's what I would have to do.
          RayNinjaTrader Customer Service

          Comment


            #6
            I have coded around the problem...still...it seems to me the Close statement is pretty limited....i.e. what is the point in closing a position without closing the originating strategy

            Comment


              #7
              Some people may have some use for the ATM strategy for maintaining some routines or what not after they "close" their positions.
              Josh P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

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