Skip to content

Normalized Average True Range

NATR is ATR normalized to a percentage.

Method

tm.ta.natr(source_high, source_low, source_close, timeperiod)

Inputs

ParameterArgument typeDescriptionDefault Value
source_highpd.SeriesHigh prices series-
source_lowpd.SeriesLow prices series-
source_closepd.SeriesClose prices series-
timeperiodintNumber of periods for the indicator14

Outputs

OutputType
natrnp.ndarray

Example usage

strategy.py
import tradomate as tm
@tm.strategy()
def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Normalized Average True Range
natr = tm.ta.natr(data.high, data.low, data.close, timeperiod=14)
# Get the last value and print
last_value = natr.iloc[-1]
tm.log(f"Last value of Normalized Average True Range is {last_value}")
# Plot the values of natr
tm.plot(natr, title="Normalized Average True Range", overlay=False)