Lean icon indicating copy to clipboard operation
Lean copied to clipboard

Add Indicator Derivative Oscillator

Open LiXiang618 opened this issue 8 years ago • 2 comments

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

LiXiang618 avatar Aug 17 '17 21:08 LiXiang618

spy_do.csv

LouisSzeto avatar Feb 24 '23 13:02 LouisSzeto

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)

LouisSzeto avatar Oct 24 '23 12:10 LouisSzeto

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.

KMichaylov avatar Mar 21 '24 16:03 KMichaylov