Open michaelsrew opened 6 years ago
I am considering working on this one, but I have a question on what would be the best way to implement the ADR. I could simply do the difference of the high and low for the input range, though this will not take into account the user possibly inputting a resolution other than daily.
I could also have private variables for the high and low and update these as the data points flow in, which would require a large warm-up if the user chooses a lower resolution such as minute.
Or is there a way to restrict the indicator to only certain resolutions. This may be easiest if there is an option.
Once I know this I can submit a pull request as the code is very similar to the ATR indicator.
spy_adr.csv columns: "SPY high" "SPY low" "ADR"
script:
import talib
import pandas as pd
history = pd.read_csv("https://github.com/QuantConnect/Lean/raw/master/Data/equity/usa/daily/spy.zip",
index_col=0, names=["open", "high", "low", "close", "volume"])
high = history.high
low = history.low
# Source: https://www.tradingview.com/script/6KVjtmOY-ADR-Average-Daily-Range-by-MikeC-AKA-TheScrutiniser/
adr = talib.SMA(high - low, 20).dropna().to_frame()
adr["spy high"] = high
adr["spy low"] = low
adr = adr.iloc[:, [1, 2, 0]]
adr.to_csv("spy_adr.csv", header=False)
On the day that this project is 99.92% finished please add Mr. Wilders ADR indicator.