average_true_range¶
-
qf_lib.common.utils.miscellaneous.average_true_range.
average_true_range
(prices_df: qf_lib.containers.dataframe.prices_dataframe.PricesDataFrame, normalized: bool = False) → float[source]¶ Calculates the average true range.
- Parameters
prices_df (PricesDataFrame) – PricesDataFrame containing High, Low, Close PriceFields and a number of rows equal to window_length + 1
normalized (bool) – if True, each true_range is normalized to the closing price for the same day; NATR is returned
- Returns
Average True Range calculated as mean of True Range values; a time period is equal to the amount of rows in prices_df reduced by 1
- Return type
float