Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATR Stoploss

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

    ATR Stoploss

    I'm trying to use the strategy wizard to set a stoploss 2 times the ATR and it doesnt seem to be working right. Hopefully you can tell me where I am going wrong.

    In the Conditions and Actions box...
    In the "Do the Following Section"
    I have...
    Variable0=(ATR(20)(0))*(1+200)


    That breaks down to mean a 20 period ATR for the current bar with a "percent" offset of 200. I'm setting a variable here so I can set that variable as my stop loss amount in the StopLoss section of the strategy wizard.


    In the "Stop Loss and Profit Targets" section I have
    SetStopLoss("LongEntry",CalculationMode. Ticks, Variable0, false)

    That means set a stop loss for the entry signal called "LongEntry". Set it Varible0 ticks away from the entry (Not simulated)

    It seems like it sets my stoploss to my entry amount, so I did something wrong with the ATR part.

    WHat do you think?

    #2
    Your percent offset is probably wrong. To be twice the ATR you would just multiply the ATR by 2 not 201.

    See if that helps.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Am I going about it the right way though? Should I be using offset?

      Is there a way to just multiply using the strategy wizard?

      Comment


        #4
        You are approaching it properly. Try this: Offset by 1 (for 100%) so your code looks like this

        Variable0 = (ATR(20)[0]) * (1 + 1)

        Now bear in mind ATR values are generally already in decimals so when you go try to pass it into the SetStopLoss() as ticks its not going to work out too well. For equities like AAPL, 1 tick would be 1 cent. You can't really say I want a stop loss at 0.6 tick.

        I think you are trying to get $0.60 as your stop loss. To do this you would unfortunately need to break away from the Wizard and do some manual edits on the code.

        Variable0 = ((ATR(20)[0]) * (1 + 1)) / TickSize;
        SetStopLoss("LongEntry",CalculationMode.Ticks, Variable0, false);
        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
        581 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        338 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        552 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X