contango.stream.indicators.calculations.average_true_range
contango.stream.indicators.calculations.average_true_range
AverageTrueRange
AverageTrueRange(pd: days = 14)
Bases: Indicator[float | None]
The average true range (volatility measure).
Initializes AverageTrueRange.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pd
|
days
|
Lookback period used to smooth the True Range. |
14
|
Source code in src\contango\stream\indicators\calculations\average_true_range.py
18 19 20 21 22 23 24 25 26 27 28 | |
value
property
value: float | None
Returns the latest value for the ATR.
update
update(event: MarketDataEvent) -> float | None
Updates the ATR for each bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
MarketDataEvent
|
The underlying event to update the ATR with. |
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\stream\indicators\calculations\average_true_range.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |