Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trade Performance Statistics

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

    Trade Performance Statistics

    Hello,

    Can you please confirm what exactly does the below explain?

    Code:
    SystemPerformance.AllTrades.TradesPerformance.RSquared
    I understand the definition of R^2. But I'm not sure what the inputs are for the above .Trades.Performance.RSquared are. Are the inputs:

    input1: trade logic for the strategy
    input2: price of the underlying data

    In other words, r2 by definition explains the proportional variability between Y and X variable. Is the Y in the above Price and X the trade logic for the price? Or is it something completely different.

    In your guide https://ninjatrader.com/support/helpGuides/nt8/en-us/

    It says,

    protected override void OnBarUpdate()
    {
    // Print out the R2 value of all trades
    Print("R-Squared is: " + SystemPerformance.AllTrades.TradesPerformance.RSqu ared);
    }
    That still does not answer my question as to what the inputs are being used to derive r2 for "all trades."

    Thank you
    Last edited by staycool3_a; 12-12-2017, 11:04 AM.

    #2
    Hello calhawk01,

    Thanks for opening the thread.

    The actual algorithm used to calculate this is closed source, so I will be limited to comment on the gist of the statistic.

    RSquared for TradesPerformance will calculate a "Coefficient of determination" in reference to PnL. X would be the PnL and Y would be the predicted PnL.

    I found the Investopedia page on "Coefficient of Determination" to be useful in understanding how this statistic can be adapted for other uses, like PnL. I will provide a link below.

    Investopedia Coefficient of Determination - https://www.investopedia.com/terms/c...ermination.asp

    Please let me know if I can be of further assistance.
    Last edited by NinjaTrader_Jim; 12-12-2017, 01:42 PM.
    JimNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jim View Post
      Hello calhawk01,

      Thanks for opening the thread.

      The actual algorithm used to calculate this is closed source, so I will be limited to comment on the gist of the statistic.

      RSquared for TradesPerformance will calculate a "Coefficient of determination" in reference to PnL. X would be the PnL and Y would be the predicted PnL.

      I found the Investopedia page on "Coefficient of Determination" to be useful in understanding how this statistic can be adapted for other uses, like PnL. I will provide a link below.

      Investopedia Coefficient of Determination - https://www.investopedia.com/terms/c...ermination.asp

      Please let me know if I can be of further assistance.
      "In reference to PnL. X would be the PnL and Y would be the predicted PnL."

      Above statement still needs more clarity. As of right now I can think of two scenarios:

      1. it seems it's essentially looking at the actual strategy equity curve plot and based on that, it's making a prediction as to what the next value will be, and hence deriving to the final r2 value.
      2. It's looking at the individual pnl values for the last X trades and making a prediction. What's the N in this scenario?
      3. It's giving a binary up/down prediction for the "next" pnl, based on the last C trades. In this case this would have to be a r2 relating to logistic regression rather than linear regression. Is this linear or logistic r2?

      Thanks in advance. This is extremely important information as all scenarios are different and can impact differently. I'm making a strategy based on r2 and I need to allocate funds based on which strategy logic is performing better so I need this information.

      Thanks

      Comment


        #4
        Hello calhawk01,

        I've received more information on how this item is calculated and I put together an example strategy that can calculate the same results for R^2 that NinjaTrader does. As far as I can see, there are no deviations in the results. This could no longer be the case if NinjaTrader's implementation changes.

        Since we don't have this documented, I will request that the calculation that NinjaTrader uses gets published in the helpguide. The documentation will always be the best place to reference these items when they are locked into place. If you find something like a performance statistic that is not documented we can always request to have it documented.

        Please let me know if I may be of further assistance.
        Attached Files
        Last edited by NinjaTrader_Jim; 12-14-2017, 11:25 AM.
        JimNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Jim View Post
          Hello calhawk01,

          I've received more information on how this item is calculated and I put together an example strategy that can calculate the same results for R^2 that NinjaTrader does. As far as I can see, there are no deviations in the results. This could no longer be the case if NinjaTrader's implementation changes.

          Since we don't have this documented, I will request that the calculation that NinjaTrader uses gets published in the helpguide. The documentation will always be the best place to reference these items when they are locked into place. If you find something like a performance statistic that is not documented we can always request to have it documented.

          Please let me know if I may be of further assistance.
          Thank you. This was helpful!

          Comment


            #6
            Code:
            SystemPerformance.AllTrades.TradesPerformance.Currency.CumProfit
            https://t.ninjatrader.com/support/he...?cumprofit.htm

            Does the above only keep cum. profit on trades that have been closed? Or does it also include unrealized positions P&L?

            Thank you

            Comment


              #7
              Hello calhawk01,

              The Trade object in the AllTrades collection would represent closed trades with an entry and exit, so it would include the realized PnL.
              JimNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by AlexsOptions, Today, 05:42 PM
              0 responses
              2 views
              0 likes
              Last Post AlexsOptions  
              Started by philli4093, Today, 05:20 PM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_ShawnB  
              Started by memonolog, Today, 04:58 PM
              0 responses
              1 view
              0 likes
              Last Post memonolog  
              Started by robvul, Today, 04:20 PM
              1 response
              10 views
              0 likes
              Last Post NinjaTrader_ShawnB  
              Started by sandman, Today, 01:54 PM
              3 responses
              23 views
              0 likes
              Last Post NinjaTrader_Jim  
              Working...
              X