Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATM PnL

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

    ATM PnL

    Hello All

    I have the question about ATM PnL.

    I have the strategy which use some ATM and in this strategy I count PnL by Account without any problem.
    I know that I can't count the Strategy PnL when I use ATM because it's not the strategy position.
    My question:
    How can I find information about PnL of the all ATM trades? I see that in the 'Trade Performance' window I can choose the 'Template' for the ATM and can see thr ATM PnL.
    How can I calculate it in the Strategy? If I understand correctly - need to use 'SystemPerformance.AllTrades' and after that need to create some filter by ATM name, but I can't find information about it.
    Could you help me with it?
    Thanks.


    #2
    Hello vitaly_p,

    You can only access the pnl of the currently running ATM from a strategy, there is otherwise not a way to access atm pnl. https://developer.ninjatrader.com/do...izedprofitloss
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse

      Thank you for your answer.

      I mean that I would like to calculate ALL PnL ATM trades by the current Account and current Instrument. For example, my strategy use ATM with name "MyATM". How can I count all trades by current account and current instrument with this ATM name ( Finished Trades) ?

      Comment


        #4
        Hello vitaly_p,

        There is not a way to do that, you can only access the currently active ATM that the strategy submitted. You can also get its realized PnL but only the strategy that submitted that ATM can access that instance using the ATM methods shown in the help guide link I provided.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Ok, how 'Trade Performance' calculate PnL for each ATM? Is it use 'SystemPerformance.AllTrades'?
          Click image for larger version

Name:	image.png
Views:	42
Size:	6.6 KB
ID:	1327070

          If I can use this filter in this window - I understand that it's possible to do in the code too.
          How create the similar condition in the strategy code?
          This is the filter 'by ATM Name'

          Or I wrong?

          Comment


            #6
            Hello vitaly_p,

            I don't have any details on how the internal tools work to provide that context, through NinjaScript there is no way to do that with ATM's specifically. A strategy can calculate PnL from an active atm and then you could save that data but there is no collection of that information on the account level that can be accessed.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Ok Jesse, thank you.

              I tried to use the ATM PnL but I have the problem with next: for example, I have the ATM Long position. At the some moment my strategy generate the opposite signal, closing the current Long and opening ATMShort. My first ATM didn't close any orders before the opposite signal. At the moment of closing position the Strategy have some PnL result (I see it by print with unrealized ATM PnL) but (!!!) I don't have ANY results when I tried to use GetAtmStrategyRealizedProfitLoss()​. I know that this commant working just when the first AMT goes to flat and I check it. I added the pause for a few seconds (for tests) but I still don't have any results, the ATM realized PnL always '0'... could you tell me why? Or how can I take the realized PnL in my situation?

              Thank you

              Comment


                #8
                Hello vitaly_p,

                Was there actually any realized pnl in the control center when the atm had closed? Depending on when you call the method it will return either 0 or a realized pnl if it was called after there was some amount of realized pnl for the strategy.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  Yes, I saw realized pnl in the control center when the atm had closed. I created the condition which check ATM market position ( GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat) and call realized PnL when the first ATM is close and position is Flat , before opening the opposite ATM... I know that AtmStrategyClose(id) send the signal to close the current ATM but it's not the same that the ATM is Close therefore I chech position state by GetAtmStrategyMarketPosition(atmStrategyId). Shoul I use some delay before calling GetAtmStrategyRealizedProfitLoss​()?

                  Comment


                    #10
                    Hello vitaly_p,

                    It could have been a delay problem or the timing of when you called the method. The ATM is an external strategy so there are situations where you may call the method before the atm has had a chance to update.
                    JesseNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by mjairg, 07-31-2024, 11:48 AM
                    7 responses
                    100 views
                    0 likes
                    Last Post Ducman_nl  
                    Started by meatskin, Today, 03:07 PM
                    0 responses
                    12 views
                    0 likes
                    Last Post meatskin  
                    Started by Pa_Baz, 12-14-2024, 09:40 PM
                    26 responses
                    373 views
                    1 like
                    Last Post MarioM94  
                    Started by crystalet, 12-06-2022, 06:59 AM
                    2 responses
                    52 views
                    1 like
                    Last Post mrmark123  
                    Started by ClauTrade, Today, 02:26 PM
                    2 responses
                    10 views
                    0 likes
                    Last Post ClauTrade  
                    Working...
                    X