Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MAE for a single trade

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

    MAE for a single trade

    Would it be possible to get the MAE value of a single trade in the TradeCollection method?

    #2
    Hello guillembm,

    Thanks for your post.

    This is possible in NinjaTrader 8, but not in NinjaTrader 7.

    In NinjaTrader 8, you may fetch MAE from a Trade object, within the Trade collection.

    For example:

    Code:
    if (SystemPerformance.RealTimeTrades.Count > 0)
    {
        // Check to make sure there is at least one trade in the collection
        Trade lastTrade = SystemPerformance.RealTimeTrades[SystemPerformance.RealTimeTrades.Count - 1];
    
        // Calculate the PnL for the last completed real-time trade
        double myMAE = lastTrade.MaeCurrency;
    
        Print(myMAE);
    }
    Trade object - https://ninjatrader.com/support/help.../nt8/trade.htm

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      Would it be possible to use it in an optimization metric?

      Comment


        #4
        Hello guillembm,

        Optimization fitness metrics would still pull from TradePerformance from within SystemPerformance for the strategy and we will be back to trying to reference individual trades from there, and then trying to fetch MAE/MFE from an individual trade. NinjaTrader 7 does not have this for individual trades so we would not be successful there.

        You could try to calculate it on your own within the strategy logic, but this will not integrate well with the Strategy Analyzer. I would recommend using NinjaTrader 8 for this kind of task.

        NinjaTrader 7 statistics - https://ninjatrader.com/support/help...efinitions.htm

        Please let us know if there is anything else we can do to help.
        JimNinjaTrader Customer Service

        Comment


          #5
          Would it be possible to pass the value of "lastTrade.MaeCurrency" to the optimizer?

          Comment


            #6
            Hello guillembm,

            This property is not available in NinjaTrader 7, but you could reference this in NinjaTrader 8 and use it in an Optimization Fitness Metric if you like.
            JimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Brevo, Today, 01:45 AM
            0 responses
            6 views
            0 likes
            Last Post Brevo
            by Brevo
             
            Started by aussugardefender, Today, 01:07 AM
            0 responses
            5 views
            0 likes
            Last Post aussugardefender  
            Started by pvincent, 06-23-2022, 12:53 PM
            14 responses
            242 views
            0 likes
            Last Post Nyman
            by Nyman
             
            Started by TraderG23, 12-08-2023, 07:56 AM
            9 responses
            384 views
            1 like
            Last Post Gavini
            by Gavini
             
            Started by oviejo, Today, 12:28 AM
            0 responses
            6 views
            0 likes
            Last Post oviejo
            by oviejo
             
            Working...
            X