Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

performance monitoring strategy

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

    performance monitoring strategy

    Hello,
    I am looking for clarification for the following samplePnL strategy found here:


    I am a discretionary trader using chart trader and ATM strategies to place my orders and I would like to know if this strategy could essentially run in the background and 'calculate' on each new bar update my cumulative trade performance as i go about my trading. Instead of the strategy actually placing trades all i want it to do is send out an alert or an e-mail once a profit or loss threshold is reached.

    Is anything like this possible to essentially have an active strategy which acts as my live performance monitor?

    Thanks,
    Evan

    #2
    Hi Evan, for this specific script - it would be used as technique inside the given strategy script only to monitor it's own trades pnl and thus shut actions down for the session for example if a certain threshold is reached.

    You could have a monitoring strategy that would read the live account realized pnl for example and notify you via email or an alert if you've reached a certain value - http://www.ninjatrader.com/support/h...etaccountvalue

    Comment


      #3
      Hi Bertrand,
      This is great to hear!

      So just to make sure I understand this correctly. If I have this strategy run on a 1 minute SPY chart for example and I have all of this logic in the onBarUpdate method, this will be able to check my global pnl each minute, regardless of what instrument I am actually trading? Am I correct that the data series time & frequency would play a roll in how often it would run its check ?

      Second question, is there anyway I can get current unrealized profit as well? I know GetAtmStrategyUnrealizedProfitLoss() is available for ATM strategies and I am not sure if it would be applicable here.

      Much thanks.

      Evan

      Comment


        #4
        You are correct in understanding, it would poll the account info for non historical data in your OnBarUpdate() interval if desired and yes it would be at the account level as seen in NT's accounts tab so not limited per instrument.

        For the account items, we could only support the three documented in the link - however deeper options are on our feedback list for the next major release and I will make sure to note your request for them as well.

        Comment


          #5
          Bertrand,
          Thanks for the quick response.

          One more question now along the lines of unrealized profit which might actually solve my #2 question. If I make the following call:

          GetAccountValue(AccountItem.CashValue)

          and lets say I have a position open currently that is down $100. Will GetAccountValue factor in that unrealized loss when it gets the account value? Is it a current snapshot of my balance or is it only realized trades effecting CashValue?

          Thanks!

          Comment


            #6
            You are welcome, it would unfortunately not update 'intratrade' but only once that position is closed.

            Comment


              #7
              Hi Bernard,
              I was just running some tests now the market is open on a SIM account. I added the strategy to a 1 minute SPY data series and have calculate on close = true.

              Problem is, it is spamming a ton of e-mails with each new tick instead of a close bar like I would have expected it too? Do you know offhand if there are any other settings I need to make so it only checks and sends an e-mail every 1 minute bar close?

              Thanks again!

              Comment


                #8
                That I would not expect Evan, when COBC is indeed set to true for the script instance. Is the 1 min series the only one in the script? Just try to remove the SendMail call for now and just print it with the timestamp and currentbar info - would you see the same outcome?

                Comment


                  #9
                  Hi Bertrand,
                  I directed the output to the console and as soon as I put the strategy on it just floods the window with my output:

                  current performance update
                  REALIZED PnL: 0<br><br>ACCOUNT VALUE: 0
                  2:44 PM
                  current performance update
                  REALIZED PnL: 0<br><br>ACCOUNT VALUE: 0
                  2:44 PM
                  current performance update
                  REALIZED PnL: 0<br><br>ACCOUNT VALUE: 0
                  ....etc...etc.


                  The logic is within onBarUpdate and I tried this on a 1 minute and 5 calculate on bar close = true. Any other thoughts here?

                  Comment


                    #10
                    Is there any logic outside of OnBarUpdate? For example in OnMarketData, OnOrderUpdate, etc?
                    MatthewNinjaTrader Product Management

                    Comment


                      #11
                      nothing at all. Just a custom e-mail send function and thats it.

                      Comment


                        #12
                        It sounds like then there is another script running somewhere.

                        To check for this, please shut down NinjaTrader--> navigate to Documents\NinjaTrader 7\workspaces and delete the file named _workspaces.xml

                        Once deleted, restart NinjaTrader, reconnect to your data feed and start your script.

                        Do you still see this behavior written to the output window or the additional emails send when not expected?
                        MatthewNinjaTrader Product Management

                        Comment


                          #13
                          Thanks, I will try this in a moment, currently in a live position I am watching.

                          Also I just recreated everything in a new fresh strategy and I notice on the strategies tab my new strategy has a connection listed as "KinetickRealtime" and the previous one i was testing just has nothing listed.

                          My current connections are #1 kinetick realtime, #2 interactive brokers account, #3 a second interactive brokers account.

                          would there be any issue with my connections?

                          Thanks!

                          Comment


                            #14
                            no luck deleting the _workspaces.xml , still the same effect. It is nonstop printing out a ton of lines per minute.

                            Comment


                              #15
                              slocumtrader, on which account were running / testing the script - the live IB account or the internal Sim101? Would you mind emailing us the script to support at ninjatrader dot com so we could check it out and see what might contribute to the outcomes seen?

                              Thanks

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by argusthome, Yesterday, 10:06 AM
                              0 responses
                              20 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              18 views
                              0 likes
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              14 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Started by TheRealMorford, 03-05-2026, 06:15 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post TheRealMorford  
                              Started by Mindset, 02-28-2026, 06:16 AM
                              0 responses
                              38 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Working...
                              X