trading.indicators.calculations.average_true_range
trading.indicators.calculations.average_true_range
AverageTrueRange
AverageTrueRange(period: days = 14)
Bases: Indicator[float | None]
The average true range (volatility measure).
Initializes AverageTrueRange.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
period
|
days
|
Lookback period used to smooth the True Range. |
14
|
Source code in src\contango\trading\indicators\calculations\average_true_range.py
32 33 34 35 36 37 38 39 40 | |
update
update(high: USD, low: USD, close: USD) -> float | None
Updates the ATR for each bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
high
|
USD
|
The highest price reached in USD for a bar. |
required |
low
|
USD
|
The lowest price reached in USD for a bar. |
required |
close
|
USD
|
The closing price in USD for a bar. |
required |
Returns:
| Type | Description |
|---|---|
float | None
|
The current ATR. Returns None until enough bars have been |
float | None
|
observed to initialize the Wilder average. |
Source code in src\contango\trading\indicators\calculations\average_true_range.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |