Get the Average True Range (ATR) history of a futures trading pair on an exchange, with a customizable candlestick interval and window length (default 14). Useful for measuring volatility, setting stop-loss distances and backtesting volatility strategies.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Available on these API plans: Startup Standard Professional Enterprise
Response Data
data is an array sorted by time from earliest to latest; each element is the ATR for one candle, and time is the start time of the candle's interval (milliseconds). ATR is in the same unit as the trading pair's price (e.g., USDT for BTCUSDT), not a percentage. If the time range does not contain enough candles to start the calculation, an empty array [] is returned.
The indicator needs some candles to start the calculationATR first needs earlier candles to start the calculation, so the first
window − 1candles in the time range produce no output. Withinterval=1h,windowomitted (default14) and a start/end range covering 60 candles, 47 records are returned, and the first one starts at the 14th candle; when the range covers only 3 candles, an empty array is returned. If you need complete results from a given point in time, movestart_timeback by anotherwindowcandles and trim the data yourself after you receive it.
200 · application/json · See the response example in the right panel.
| Field | Type | Always Returned | Description |
|---|---|---|---|
code | string | Yes | Business status code; "0" means success |
msg | string | No | Result message; may be omitted on success |
data | array of object | Yes | Array of ATR values, sorted by time from earliest to latest; an empty array when there are not enough candles to start the calculation |
data[].time | integer (int64) | Yes | Start time of the candle's interval, timestamp in milliseconds (UTC) |
data[].avg_true_range_value | number | Yes | ATR value: the Wilder-smoothed true range, in the same unit as the trading pair's price (e.g., USDT), not a percentage |
API Plans
Endpoint access and available intervals are listed below. See API Plans for pricing.
| API Plan | Access | Available intervals (interval) |
|---|---|---|
| Hobbyist | ❌ No | — |
| Startup | ✅ Yes | 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 1w |
| Standard | ✅ Yes | All intervals supported by this endpoint, starting at 1m |
| Professional | ✅ Yes | All intervals supported by this endpoint, starting at 1m |
| Enterprise | As agreed in your authorization | As agreed in your authorization |
Choose only values listed in this page’s interval parameter; an arbitrary value above the minimum is not necessarily supported. These restrictions concern sampling or calculation intervals, not update frequency or available history length.
Different API plans can query different lengths of history; if start_time is earlier than the range you can query, it is automatically changed to the earliest time available. For how far back each interval's history can be queried, see Intervals.
Use This Endpoint with AI
Pick a task and click Open in ChatGPT or Open in Claude: the AI reads this page first and then gives you the result. You can also click Copy and paste the full prompt into the AI tool you use.
This endpoint provides data through the REST API. Use the prompts above to have AI write the request code. For the tools available through MCP, see CoinGlass MCP.
Use Cases
| Scenario | Description |
|---|---|
| Measure Volatility | The larger the ATR, the more volatile the price; use it to compare the volatility of the same trading pair across different periods. |
| Set Stop-Loss Distances | Set stop losses at a multiple of ATR so that the stop-loss distance adjusts automatically with market volatility. |
| Position Sizing | Reduce position size when volatility is high and increase it moderately when volatility is low, so that the risk taken on each trade stays more stable. |
| Strategy Backtesting | Align with Pair Price OHLC History by time to backtest ATR-based breakout or stop-loss rules. |
Related Endpoints
| Endpoint | How It Differs |
|---|---|
| Coin Average True Range List (ATR) | Current ATR for multiple coins across 8 intervals |
| Bollinger Bands (BOLL) | Another type of volatility indicator |
| Exponential Moving Average (EMA) | EMA history for the same trading pair |
| Pair Price OHLC History | The price candles used to calculate the indicator |
| Supported Exchanges and Pairs | Look up valid values for exchange and symbol |
FAQ
Why are fewer records than limit returned, with the first one later than start_time?
ATR first needs earlier candles to start the calculation, so the first window − 1 candles produce no output. With window=14 (the default) and a start/end range covering 60 1-hour candles, 47 records are returned, and the first one is 13 hours later than start_time. Move start_time back by an extra window candles.
Why did I get an empty array?
When the time range does not contain enough candles to start the calculation, {"code":"0","data":[]} is returned. This happens when the start/end range covers only 3 candles; widen the time range or increase limit.
What is window if omitted?
The default is 14, so the calculation uses 14 candles. Pass a positive integer (at least 1); 0 and negative numbers are not valid window lengths.
What should I pass as symbol?
A trading pair, not a coin; for example, the BTC perpetual contract on Binance is BTCUSDT. Exchanges write pairs differently; go by what the Supported Exchanges and Pairs endpoint returns.
Learn More: Average True Range (ATR) Indicator
How Is ATR Calculated?
First calculate the True Range of each candle: take the largest absolute value among the candle's high minus its low, the difference between the high and the previous candle's close, and the difference between the low and the previous candle's close. Then average it over window candles with Wilder's smoothing method; the result is ATR.
What Window Length Should I Use for ATR?
14 is the most common setting and also this endpoint's default. The shorter the window, the more sensitive ATR is to recent volatility; the longer the window, the smoother the values and the better they represent the average level over a period.
How Can I View the ATR of Multiple Coins at Once?
Use Coin Average True Range List (ATR), which returns the current ATR of all coins across 8 intervals in one call.
