Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom column in Trades grid & custom graph in Analysis

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

    Custom column in Trades grid & custom graph in Analysis

    I have created a custom performance metric based on ATR, I can successfully see this metric being displayed as part of the Strategy Analyzer Summary screen. What I would like to accomplish is:
    1. Showing the metric on a per trade row level by adding another column in the Trades grid
    2. Creating a custom graph where items like Avg MAE, Avg MFE are displayed within the Analysis of the Strategy Analyzer.

    Would either of the items I mentioned be possible and have any documentation?

    Thank you in advance for the support.

    #2
    Hello proptradingshop,

    Thank you for your post.

    Unfortunately, custom performance metrics cannot be added to any displayed other than the 'Summary' display. So it's not possible to display custom performance metrics on the Trades or Analysis display.

    Please let us know if you have any further questions.

    Comment


      #3
      Thanks Gaby,

      I found this example of a custom performance metric https://forum.ninjatrader.com/forum/...de-performance
      however I don't this would work as you can't access a new DataSeries in the custom performance metric.

      Is there any example you would be able to provide that shows how to get the the dataseries for the strategy to the performance metric as it only seems like we have the trade object to work with within the custom performance metric.

      thank you

      Comment


        #4
        Hello proptradingshop,

        It is not supported to use AddDataSeries() in custom performance metrics. You can use a BarsRequest instead, as shown in the sample script you linked.

        Comment


          #5
          Thanks Gaby,

          I tried the example provided but it has compilation errors because Values is never instantiated, and even when it is the you get the error message 'EMA' tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state. Attempted to load SPY Default: 1 Minute

          ​So then I added the AddDataSeries("SPY", BarsPeriodType.Minute, 1); to my strategy but still faced the same issue.

          Do we have a working example of this? Is it possible to derive the BarsPeriod as well from the strategy inside the custom performance metric?

          Comment


            #6
            Hello,

            Apologies I'm not clear on what you are trying to accomplish. Are you trying to load additional data in your strategy, or in a custom performance metric?

            You can use AddDataSeries() in a strategy. You cannot use AddDataSeries() in a custom performance metric. You would need to use a BarsRequest in a custom performance metric script.

            Additionally, I am not getting any compile errors when I test out the example script you linked to.

            Edit: Neglected to mention, I am looking into being able to pull the strategy's BarsPeriod into a custom performance metric script. However if you're having other issues with compile errors please post a screenshot.
            Last edited by NinjaTrader_Gaby; 04-10-2025, 08:03 AM.

            Comment


              #7
              No worries. Sorry I didn't mean to say compilation errors but runtime error of Null reference when running a strategy backtest because Values array is not instantiated. Even once insantiated the Array, you can try running the example and you will see the error message when it reaches the EMA call passing in the BarsDictionary. 'EMA' tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state. Attempted to load SPY Default: 1 Minute

              You will also notice that if you run it and look at the Summary of the backtest it does not actually produce any values for the performance metric.

              My end goal is to be able to get the ATR values for the symbol and bar period that the backtest is running on withing the custom performance metric to calculate a specific metric. I have a work around using SystemPerformance​ within the strategy but it would be great to get it as a performance metric row within the backtest summary.

              Edit: Added screenshots
              Attached Files
              Last edited by proptradingshop; 04-10-2025, 03:01 PM.

              Comment


                #8
                Hello proptradingshop,

                Thanks for clarifying, I do also see that this script has several run-time errors. Apologies, it's not a suitable example script.

                Regarding getting the BarsPeriodValue from a strategy in a custom PerformanceMetric script, unfortunately, this is not possible as the PerformanceMetric is only provided the Trade object and not the strategy.

                Additionally, for getting additional data in a custom PerformanceMetric, I've asked my team lead for further insight. They've let me know that while a BarsRequest can be used to get additional data, we would not advise doing this as this would cause a massive performance impact.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Today, 05:17 AM
                0 responses
                50 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                126 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                69 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                42 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                46 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X