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

Potential flaw in ATM methods

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

    Potential flaw in ATM methods

    I have developed a strategy and using ATM to open position and use AtmStrategyClose to close order.
    As you can see in the attachment when I use the method to close orders afterward TotalPnL drops 19$ even though market is not high-speed.



    Last edited by bosajin; 01-21-2021, 03:36 PM.

    #2
    Hello bosajin, thanks for your post.

    GetAtmStrategyMarketPosition will report the current market position, so is the strategy closing the open position if this reports Long or Short? Did you add Print methods to the strategy to see why the exit method was called in this case? What conditions became true to enact the close position behavior?

    I look forward to hearing from you.

    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Sorry CrhisL,

      I use AtmStrategyClose.it was typo and corrected
      Last edited by bosajin; 01-21-2021, 03:38 PM.

      Comment


        #4
        Hello bosajin, thanks for your reply.

        You will need to look further into the data coming from the strategy. What conditions became true for the ATMStrategyClose method to be called?

        I look forward to hearing from you.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Hello ChrisL

          Thanks for swift reply.

          the following code is being used to close ATM order.


          Code:
          protected override void OnBarUpdate()
          {
          //in this case MaxProfit = 37
          
               if(NetPnL > MaxProfit)
               {
                     MyAtmStrategyClose(strategyId);
               }
          
          }
          
          double NetPnL
          {
               get
               {
                    var realized = Account.Get(AccountItem.RealizedProfitLoss, Currency.UsDollar);
                    var unrealized = PositionAccount.GetUnrealizedProfitLoss(Performanc eUnit.Currency);
                    var result = realized + unrealized ;
                    return result;
               }
          }

          Comment


            #6
            Hello,

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

            I tried setting this up in a test strategy, but I have been unable to reproduce. Could you test my strategy and modify it as needed so I can reproduce the issue? If there are any specific steps I should be taking or if the ATM strategy that is used makes a difference, please let me know.

            Below is a demonstration showing how I have tested.

            Demo - https://drive.google.com/file/d/1yNn...w?usp=drivesdk

            Please also be sure that you are testing on the latest version of the platform, release 23.2. Update installer can be downloaded below.

            Update - https://ninjatrader.com/PlatformDirect

            I look forward to hearing from you.
            Attached Files
            JimNinjaTrader Customer Service

            Comment


              #7
              Hi Jim,

              I am not able to reproduce the issue on Playback , just on continuum account and Simulated data feed.
              Please let me know , how I can send you my code.

              Continuum Account:


              Simulated Data Feed :





              Click image for larger version  Name:	Reproduce Issue again.JPG Views:	0 Size:	83.2 KB ID:	1138279
              Last edited by bosajin; 01-25-2021, 12:47 PM.

              Comment


                #8
                Hello bosajin,

                Thanks for your reply.

                Jim is out of the office today.

                Please send to PlatformSupport[at]Ninjatrader[dot]com. Mark the e-mail Ticket# 2930049, Atten: Jim.
                In the body of the e-mail please include a link to reference this thread.

                Thanks in advance for your patience.

                Paul H.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
                4 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
                20 views
                0 likes
                Last Post NinjaTrader_LuisH  
                Working...
                X