From 0c4c95ebd1c57d36f86b92d2e4bf311c95eeb39a Mon Sep 17 00:00:00 2001 From: Mick Chanthaseth Date: Wed, 7 Apr 2021 07:32:43 -0700 Subject: [PATCH] modified /volatility/true_range.py with 'true_range = concat(ranges, axis=1)' instead of 'true_range = DataFrame(ranges).T' for it to work with intra day data. --- pandas_ta/volatility/true_range.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas_ta/volatility/true_range.py b/pandas_ta/volatility/true_range.py index 9e301cd..ab5844c 100644 --- a/pandas_ta/volatility/true_range.py +++ b/pandas_ta/volatility/true_range.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- from numpy import NaN as npNaN -from pandas import DataFrame +from pandas import DataFrame, concat from pandas_ta.utils import get_drift, get_offset, non_zero_range, verify_series @@ -17,7 +17,7 @@ def true_range(high, low, close, drift=None, offset=None, **kwargs): high_low_range = non_zero_range(high, low) prev_close = close.shift(drift) ranges = [high_low_range, high - prev_close, prev_close - low] - true_range = DataFrame(ranges).T + true_range = concat(ranges, axis=1) true_range = true_range.abs().max(axis=1) true_range.iloc[:drift] = npNaN