Type/to search
Built-in Functions
Global
Version
IsVirtual
GetOS
GetPid
GetMeta
Sleep
Unix
UnixNano
_D
GetCommand
GetLastError
SetErrorFilter
_N
_C
_Cross
JSON.parse
JSON.stringify
Encode
MD5
UUID
Log
Market
Trade
Account
Futures
Exchange
IO
Network
Storage
Threads
Web3
Uniswap
TA
Talib
OverlapStudies
MomentumIndicators
VolumeIndicators
VolatilityIndicators
CycleIndicators
PriceTransform
StatisticFunctions
MathTransform
MathOperators
PatternRecognition
OS
Structures
Built-in Variables

The TA.ATR() function is used to calculate the Average True Range indicator (ATR).

TA.ATR(inPriceHLC)
TA.ATR(inPriceHLC, optInTimePeriod)

Examples

javascript
function main(){ var records = exchange.GetRecords(PERIOD_M30) var atr = TA.ATR(records, 14) Log(atr) }
python
def main(): r = exchange.GetRecords(PERIOD_M30) atr = TA.ATR(r, 14) Log(atr)
rust
fn main() { let records = exchange.GetRecords(None, PERIOD_M30, None).unwrap(); let atr = TA.ATR(&records, 14); Log!(atr); }

Returns

TypeDescription

array

The return value of the TA.ATR() function is a one-dimensional array.

Arguments

NameTypeRequiredDescription

inPriceHLC

Record structure array

Yes

The inPriceHLC parameter is used to specify the K-line data.

optInTimePeriod

number

No

The optInTimePeriod parameter is used to set the calculation period.

See Also

Remarks

The default value of the optInTimePeriod parameter of the TA.ATR() function is: 14.