Read ATR in the units of the selected chart
TradingView ATR measures price movement, not direction or loss probability. True range is the largest of high minus low, the absolute high minus previous close, and the absolute low minus previous close. TradingView uses RMA smoothing by default. Record the symbol, timeframe, session, length and smoothing so the distance can be reproduced.
- A daily ATR of $1.20 for a stock is a price distance per share. It is neither 1.20% nor a cash loss for the whole position. A 14-bar ATR on a five-minute chart measures a different series from a 14-bar daily ATR.
- Use an ATR observation available when you make the sizing decision. Freeze that observation for an initial-risk calculation. Recomputing ATR after entry changes the rule and can change the intended risk.
- For comparison, a $50 stock with ATR $1.20 has ATR / price = 2.4%; a $200 stock with ATR $6 has 3%. These ratios describe relative movement, but quantity still requires the monetary distance calculation below.
The position-sizing formula with explicit units
The following calculation assumes a linear payoff, a fixed stop distance and costs expressed per trading unit. Let E be equity in account currency, r the risk fraction, A the ATR in price points, k the chosen ATR multiplier, t the minimum price tick, V the cash value of one point per unit in the instrument settlement currency, and F the account-currency value of one settlement-currency unit.
- Here c is an estimated round-trip cost and slippage allowance per unit in account currency; s is the permitted quantity increment. For whole contracts, s = 1. Reserve any fixed order fee from B before applying the formula, and check the final cost schedule for minimum or tiered fees.
- Round the distance outward first, then the quantity down. This assumes the reference entry lies on the price tick grid. If it does not, round the actual stop price in the protective direction and recalculate the resulting entry-to-stop distance.
- F = 1 when both currencies match. If one unit has €100 of stop risk and the assumed conversion is $1.10 per euro, its risk is $110 in a USD account before costs. A $250 budget then allows two whole units, with $220 planned risk.
| Step | Calculation | Output unit |
|---|
| Risk budget | B = E × r | Account currency |
| Raw distance | D = A × k | Price points |
| Rounded distance | N = ceil(D / t); Drounded = N × t | Whole ticks; price points |
| Tick value | T = t × V | Settlement currency per tick per unit |
| Unit risk | U = N × T × F + c | Account currency per unit |
| Allowed quantity | Q = s × floor(B / (U × s)) | Shares, contracts or units |
Three instruments, one $250 risk budget
These are hypothetical inputs, not current quotes or suggested trades. Each row assumes USD account and settlement currency, k = 2, whole units and no fees or slippage. The two stock tick sizes are assumptions for the example. CME specifies a $5 point value and 0.25-point minimum tick for Micro E-mini S&P 500 futures (MES), giving $1.25 per tick.
- Stock A uses floor(250 / 2.40) = 104 shares; 105 would risk $252 before costs. Its $5,200 purchase value differs from the $249.60 stop-distance risk. Stock B uses $4,000 of purchase value for $240 of planned risk.
- MES starts with 8.10 × 2 = 16.20 points, which is 64.8 ticks. Rounding up gives 65 ticks and $81.25 per contract. Three contracts have $75,000 notional exposure at the assumed 5,000 index level: 3 × 5,000 × $5. Notional, margin deposit and planned stop loss are different amounts.
- If Stock A ATR doubles to $2.40, its distance becomes $4.80 and quantity falls to 52 shares, still $249.60 before costs. Equal planned loss does not imply equal gap risk, liquidity or probability of hitting the stop.
| Instrument | ATR and tick size | Rounded 2 × ATR distance | Risk per unit | Quantity and planned risk |
|---|
| Stock A, price $50 | $1.20; $0.01 tick | $2.40 = 240 ticks | 240 × $0.01 = $2.40/share | 104 shares; $249.60 |
| Stock B, price $200 | $6.00; $0.01 tick | $12.00 = 1,200 ticks | 1,200 × $0.01 = $12/share | 20 shares; $240 |
| MES, index level 5,000 | 8.10 points; 0.25 tick | 16.25 points = 65 ticks | 65 × $1.25 = $81.25/contract | 3 contracts; $243.75 |
Costs and minimum size can change the answer
For the same MES example, assume an illustrative $5 round-trip cost and slippage allowance per contract. Unit risk becomes $86.25. Three contracts would require $258.75, so the quantity drops to two and the estimated risk is $172.50. The unused $77.50 does not justify rounding up.
- With an $80 budget and the cost-free MES unit risk of $81.25, the allowed whole-contract quantity is zero. Skip that order under this rule or separately evaluate another instrument with its own specifications.
- Reject missing, non-finite or nonpositive ATR, tick size, point value, currency conversion or quantity increment. A zero distance must not create an infinite position. A nonpositive available risk budget means no new allocation.
- A very low ATR can imply an unaffordable position. Apply buying-power, margin, concentration and liquidity limits after sizing, then round down again. Margin availability does not validate the risk estimate.
- Do not apply a constant point-value formula unchanged to inverse crypto contracts, options or instruments with nonlinear payoffs. Obtain the actual contract profit-and-loss formula and trading increment first. Broker lots and TradingView quantity units also need an explicit conversion.
Check quantity and exit units in a Pine strategy
TradingView documents fixed-risk sizing using stop ticks, minimum tick size and point value. An explicit non-na qty in an entry command overrides default order sizing. That quantity is an instrument amount, not the percentage of equity you intend to lose.
- Inspect syminfo.mintick and syminfo.pointvalue for the selected symbol, then reconcile the contract specification. In strategy.exit, loss is a distance in ticks; stop is an absolute price. In the MES example, 65 is the tick distance, while a long entry at 5,000 implies an initial stop price of 4,983.75.
- When account and symbol currencies differ, convert monetary risk consistently. TradingView strategies use a prior daily currency rate for their conversions, which can differ from an execution-time broker rate.
- Check actual simulated entry fills and the exit coverage for the filled quantity. A different entry price, later stop activation, added entries or a reversal can invalidate the original distance-and-quantity calculation. Include commission and slippage assumptions in the test.
ATR does not cap gaps or combined exposure
ATR includes historical gaps in its input, but averaging past ranges cannot bound the next jump. Investor.gov explains that a stock stop becomes a market order when triggered and a market order does not guarantee its execution price. Planned stop loss and realized loss can therefore differ substantially.
- Suppose the 104 Stock A shares enter at $50 with a $47.60 stop, but an overnight gap produces a $45 exit. The gross loss is 104 × ($50 - $45) = $520, or 2.08% of the assumed $25,000 account, before costs. The $249.60 plan did not insure the gap.
- Three correlated positions each assigned $250 have $750 of aggregate planned stop risk, or 3% of that account. If a common shock drives all three through their stops, their losses can arrive together and exceed that sum.
- Review sector, index, currency and directional overlap before assigning a new budget. Summing planned risks is a bookkeeping check, not a portfolio tail-loss model. Position-level ATR contains no cross-position correlation estimate.
Reconcile the calculation, then record the outcome
Give Pine Script AI Coding Agent the risk formula, symbol units, currency conversion, rounding rule and timing assumptions when requesting a strategy draft or review. Use the table above as an independent expected result. Syntax validation alone cannot establish that the strategy uses the intended units or that a broker will accept the order.
- For the MES test case, verify 65 stop ticks, $81.25 gross risk per contract and three contracts before costs. Repeat with the $5 allowance and expect two. A different result needs an explanation before evaluating strategy returns.
- Trading Journal has entry price, quantity, risk amount and stop-loss fields. Record the intended cash risk and use a plan or diary entry for the ATR observation, timeframe, multiplier and assumptions. Enter the actual fills and costs separately so you can compare planned risk with the outcome.
- Verify how contract multipliers are represented before relying on a journal P&L calculation for derivatives. Keep the independently calculated cash outcome if the instrument is not represented correctly. Neither a coding review nor a journal entry replaces broker margin checks or submits this order for you.