⬡ INDICATOR · RISK MANAGEMENT · 11 MIN READ

ATR: dynamic stops and volatility-based risk.

The indicator that gives no entry signal — and is still one of the most important ones for your bot. It sizes your stop and your position according to the market's real volatility.

By the RoboTraderIA Team· updated May 2026· intermediate level

Most traders set their stop at a fixed number: "a 100-point stop". The problem? 100 points can be painfully tight on a volatile day (and you get stopped out by noise) or far too loose on a quiet day (and you risk more than you need to). The ATR solves this by letting the stop breathe with volatility. It is the indicator that turns amateur risk management into professional risk management.

01What the ATR is

ATR stands for Average True Range , created by Wilder (the same man behind the RSI). It measures how much price usually moves over a given period — in other words, volatility. Important: the ATR has no direction. It does not tell you whether price will go up or down, only the typical size of the move. An ATR of 150 on Brazil's WIN mini index future means that, on average, price swings ~150 points per candle over that period.

"True Range": the ATR does not use only the difference between the candle's high and low. It also accounts for gaps (jumps between the previous close and the open), taking the largest of three measures. Hence "true" — it captures real volatility, including gap openings.

Fixed stop vs ATR stop calm market ATR stop (tight) fixed stop (too far) volatile market ATR stop (wide, gives room) fixed stop = stopped by noise
An ATR stop adapts: tight in a calm market, wide in a volatile one. A fixed stop gets both scenarios wrong.

02The main use: a dynamic stop loss

The classic application is the ATR-multiple stop. Instead of "a 100-point stop", you use "a stop 2× the ATR away". So:

  • Volatile market → high ATR → wide stop → you do not get stopped out by normal noise.
  • Calm market → low ATR → tight stop → you risk less when you do not need that much room.

The common multiple is between 1.5× and 3× the ATR, depending on how much room the strategy needs. The bigger the multiple, the more room the trade has to breathe (and the bigger the potential loss per trade).

Example: ATR stop on the mini index future

Entry price (long)134,000 pts
Current ATR (14 periods)300 pts
Chosen multiple
Stop distance600 pts
Stop placed at133,400 pts

03ATR-based position sizing

The ATR also answers "how many contracts should I trade". Combining the ATR stop with your risk per trade, the sizing happens automatically:

How many contracts? (WIN example)

Account balanceR$ 5,000
Risk per trade (2%)R$ 100
ATR stop (600 pts × R$ 0.20)R$ 120 / contract
Contracts (R$100 ÷ R$120)0.83 → 0 contracts!
Conclusionwide stop = smaller position

Notice the lesson built in: when volatility is high (big ATR), the stop is wide, and to respect your 2% risk you have to trade fewer contracts. The ATR forces you to cut exposure exactly when the market is dangerous. It is automatic risk management.

Want the spreadsheet that runs this math?

Our free risk management spreadsheet sizes your position based on your stop and your account balance.

Download the spreadsheet →

04Coding the ATR and the stop

Pine Script (TradingView)
//@version=5
strategy("Stop por ATR", overlay=true)

periodo = input.int(14, "Período ATR")
mult    = input.float(2.0, "Múltiplo do ATR")

atr = ta.atr(periodo)

// example: enter at the moving average and use ATR for the stop
ma = ta.ema(close, 21)
if ta.crossover(close, ma)
    stopLoss = close - mult * atr
    takeProfit = close + mult * atr * 2   // target 2x the risk
    strategy.entry("Compra", strategy.long)
    strategy.exit("Saida", "Compra", stop=stopLoss, limit=takeProfit)

plot(atr, "ATR", color=color.purple, display=display.data_window)
Python (with pandas)
import pandas as pd

def calcular_atr(df, periodo=14):
    alta_baixa = df["high"] - df["low"]
    alta_fech  = (df["high"] - df["close"].shift()).abs()
    baixa_fech = (df["low"]  - df["close"].shift()).abs()
    # True Range = the largest of the three
    tr = pd.concat([alta_baixa, alta_fech, baixa_fech], axis=1).max(axis=1)
    return tr.ewm(alpha=1/periodo, adjust=False).mean()

df["atr"] = calcular_atr(df)

# dynamic stop and position sizing
entrada = df["close"].iloc[-1]
atr_atual = df["atr"].iloc[-1]
stop = entrada - 2 * atr_atual

risco_reais = 100          # 2% of a 5000 account balance
valor_ponto = 0.20          # WIN
perda_por_contrato = (entrada - stop) * valor_ponto
contratos = int(risco_reais / perda_por_contrato)
print(f"Stop: {stop:.0f} | Contratos: {contratos}")

05Other uses of the ATR

  • Trailing stop: moving the stop as price advances, always keeping it 2× ATR away — it locks in profit without choking the trade.
  • Volatility filter: only trading when the ATR is above a minimum (avoids a dead market) or below a maximum (avoids extreme volatility).
  • Proportional target: setting take profit as a multiple of the ATR, keeping the risk/reward ratio consistent in any regime.

Always remember: the ATR is not an entry signal. It does not tell you where price is going — only the size of the move. Using the ATR as a buy/sell trigger is a conceptual mistake. It belongs in the risk management equation (stop, target, size), combined with directional indicators such as moving averages, MACD or market structure.

06Frequently asked questions

What is the ATR?

Average True Range — a volatility indicator that measures the average range of price movement over a period. It does not indicate direction, only the typical size of the move. Essential for sizing stops in proportion to volatility.

How do I use the ATR for my stop?

Multiply the ATR by a factor (e.g. 2×) and place the stop that far from your entry. The stop is wide when the market is volatile and tight when it is calm, which avoids being stopped out by normal noise.

Does the ATR show direction?

No. It only measures volatility (the size of moves), never direction. That is why it is used for risk management alongside trend indicators, and never as a standalone entry signal.

Which ATR multiple should I use for the stop?

Commonly between 1.5× and 3×. A bigger multiple gives the trade more room to breathe (fewer stop-outs from noise) but increases the potential loss per trade. Calibrate it by backtest according to the strategy.

Which ATR period should I use?

The standard is 14 (Wilder's). Shorter periods react faster to changes in volatility; longer ones smooth it out. 14 works well in most cases.

Read also

🎁 Get the free trading bot (with the Quotex, Deriv and IQ Option APIs)

Open source bot + ready-made API code. You edit it by chatting with ChatGPT/Claude — no programming. Free, no spam.

👉 Want the ready-made bot instead? Go to botbinaryoptions.com →