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

Custom Performance Metric

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

    Custom Performance Metric

    Chris,

    I downloaded your two files, and I am looking first at the 'CustomSampleCumProfit" code.

    I see the reference to the performance metric of 'Profit' in this satement:

    Values[(int)Cbi.PerformanceUnit.Currency] += trade.ProfitCurrency;

    I am just now learning how to write custom performance metrics, so this is a newbie question: If I wanted to create a CumMAE metric (cumulative MAE)--would I change this and the other 'Values[] assignment statements to reference 'Mae' instead of Profit? ((I'm just using this as a hypothetical example to ask this question))

    #2
    Hello EminiTrader, thanks for your post.

    I have moved your question to a new thread from the original:

    Hey guys! so for the past day i have been trying to learn how performance metric code works and cant seem to figure it out... is there any material out there


    That is correct, you would reference trade.MaeCurrency (or any other MAE type: pips, ticks, etc) See the Cbi.Trade object here:



    Please let me know if you have any questions.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chris!

      I have 2 new questions after looking at the examples:

      1) Using this hypothetical MAE measure, the built-in MAE metric when used as an optimization fitness measure, it is set to find the MINAvgMAE. Is it possible to use the MAX MAE? (this is just an example, what I am really asking is whether a performance metric that sorts by Min or Max when used as an optimization fitness measure be changed to the opposite?

      2) My actual use case is I want to track the MIN Cumulative Profit during the course of all the trades to make sure it doesn't fall below a certain threshold. Since CumProfit is defaulted to finding the max value when used to optimize on, this won't work. Can this be changed, or is there a way to do what I am wanting to do?

      Comment


        #4
        Hello EminiTrader,

        I will research this and I will let you know what I find.

        I appreciate your patience.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello EminiTrader,

          I wanted to clarify with you your goal. You are trying to use the logic from the included MinAvgMae OptimizationFitness script which subtracts the average Mae from 1 to reverse the sorting.
          You want to reverse the sorting, is this correct?
          Copy this script, then remove the '1.0 - ' from the calculation so that this is not creating a negative value.

          With the CustomNetProfit, this when used optimizing returns the backtest results that rank the highest. The performance metric itself is not a max or min, but cumulative.
          I'm thinking your inquiry is not about ranking the results, but preventing new orders if the cumulative profit performance metric is too small, is this correct?
          (Or are you wanting to reverse the sorting by subtracting the value from 1 to make this negative?)
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by algospoke, 04-17-2024, 06:40 PM
          6 responses
          49 views
          0 likes
          Last Post algospoke  
          Started by arvidvanstaey, Today, 02:19 PM
          4 responses
          11 views
          0 likes
          Last Post arvidvanstaey  
          Started by samish18, 04-17-2024, 08:57 AM
          16 responses
          61 views
          0 likes
          Last Post samish18  
          Started by jordanq2, Today, 03:10 PM
          2 responses
          9 views
          0 likes
          Last Post jordanq2  
          Started by traderqz, Today, 12:06 AM
          10 responses
          21 views
          0 likes
          Last Post traderqz  
          Working...
          X