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 cmoran13, Yesterday, 01:02 PM
        0 responses
        29 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        21 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        160 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        95 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        148 views
        2 likes
        Last Post CaptainJack  
        Working...
        X