Add Indicator Derivative Oscillator
Derivative Oscillator (In the sample, R1 = 14, A1 = 5, A2 = 3, A3 = 9)
The Derivative Oscillator was developed by Constance Brown. Basically, the Derivative Oscillator is an advanced version of the RSI (Relative Strength Index). It applies MACD Histogram principle to the double smoothed RSI - the Derivative Oscillator is the difference between double smoothed RSI and Simple MA applied to it.
Formula: RS = (Average Gains) / (Average Losses) RSI = 100 - 100/(1 + RS) Smoothed RSI = EMA(RSI, A1) Double Smoothed RSI = EMA(Smoothed RSI, A2) Signal Line = SMA(Double Smoothed RSI, A3) Derivative Oscillator = Double Smoothed RSI - Signal Line
Note: R1 is the RSI period. A1, A2, and A3 are moving average periods respectively. Usually, Derivative Oscillator is constructed with 5min bar. Both 5min and daily sample data are provided.
Sample Data: spy_derivative_oscillator_daily_14_5_3_9.txt spy_derivative_oscillator_5min_14_5_3_9.txt
Reference: https://www.marketvolume.com/technicalanalysis/derivativeoscillator.asp http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:relative_strength_index_rsi http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages
spy_do.csv columns: "SPY close" "DO"
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"])
close = history.close
# Source: https://www.tradingview.com/script/6wfwJ6To-Indicator-Derivative-Oscillator/
s1 = talib.EMA(talib.EMA(talib.RSI(close, 14), 5), 3)
do = (s1 - talib.SMA(s1, 9)).to_frame()
do["spy close"] = close
do = do.iloc[:, [1, 0]]
do.to_csv("spy_do.csv", header=False)
Can I be assigned to this issue? I would attempt to solve it alongside another student, as part of a university course that we are currently taking.