Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Set SL/TP based on ATR in Strategy Builder (no-coding)

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

    Set SL/TP based on ATR in Strategy Builder (no-coding)

    Hi,
    I have created a strategy that enters the market based on MACD cross signal if the price is above/below a few moving averages.
    Now, for the SL/TP I would like to use ATR value (1.5 ATR for the stoploss and 3 ATR for the profit target).

    For example, my '1 Set' is the conditions to enter SHORT,
    Then in 'Do the following' I have 'Enter Short' and for the SL/TP
    I have created variables: 'StopLossPrice' and 'TakeProfitPrice', where I am setting the SL/TP prices with the relevant offset from the last 'Close price' based on the ATR.

    Then in '2 Set' conditions if 'current market position is short',
    Do the following 'Exit short stop market' = 'StopLossPrice' from above and
    'Exit short limit' = 'TakeProfitPrice' also from above.

    Then when I am testing it, it looks not accurate. What am I doing wrong?

    Thanks, Ilya.

    #2
    Hi Ilya, thanks for writing in. The ATR has very small values relative to most futures instruments. E.g. it would not work to set a stop and target for say 5.75 ATR on the ES which is around 4000 dollars at the moment. You would need to add/subtract the ATR value from the price of the ES but its not possible to do arithmetic in the builder, your script would need to be unlocked to do this e.g. ExitLongStopMarket(Close[0]-ATR(14)[0]);

    Kind regards,
    -ChrisL

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X