Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using MAE for StopLoss

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

    Using MAE for StopLoss

    Hi

    I'm trying to use MAE to caliber a Stop Loss, which should be easy, but I'm having a small technical problem.
    Say I have 10 securities, I run the system without stop loss, and I get my MAE (average of all MAE trades) for each security.
    Now, I want to use such information, i.e. I want to use the MAE of each security to set my stop loss (let's say, 2 * MAE).
    Obviously, when I run again the code with the StopLoss, the MAE will be zero (at the start), so it will keep on stopping out the trades.
    1) Is it possible to plug the MAE value from the previous run, store it somewhere and use it again (one for each security)?
    2) If that's not possible, some kind of Walk Forward? You calculate the MAE without any stop loss on a certain sample and then use a function of that value as a stop loss for the future.

    Thank you

    #2
    stefy,

    1. You can just store the MAE value you want to submit at into a variable and call your stop loss with that value. If you are overwriting your MAE value, you can use a separate variable to keep track of it as well.

    2. Not sure what you mean.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thank you Josh, but I don't understand how to achieve 1.

      1) I run my backtest *without Stop Loss* where I set the variable
      m = Performance.AllTrades.TradesPerformance.Currency.A vgMae

      2) Now I want to run the backtest with StopLoss(m), so I have to set a global variable that I can access? But in this case it won't take into account the security I ran it against...

      I don't know how to store the MAE value into a variable which can be accessed from another backtest and which is dependent on the security.

      If there is a way to do it all at once (I mean in one backtest only), then it becomes easier to store the values and use them, but how, since MAE is the result of all the trades?

      Thanks

      Comment


        #4
        If you are trying to store it from a different run you will not be able to.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        649 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        370 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        576 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X