Lean
Lean copied to clipboard
Implement WaveTrend Oscillator Indicator
Reference: https://www.quantconnect.com/forum/discussion/13844/adding-wavetrend-oscillator-to-indicator-library/p1
Expected Behavior
Support of WaveTrend Oscillator
Actual Behavior
Nil support
Potential Solution
Addition of the new indicator, formulated at https://tr.tradingview.com/script/2KE8wTuF-Indicator-WaveTrend-Oscillator-WT/
Checklist
- [X] I have completely filled out this template
- [X] I have confirmed that this issue exists on the current
masterbranch - [X] I have confirmed that this is not a duplicate issue by searching issues
- [ ] I have provided detailed steps to reproduce the issue
@LouisSzeto what are the columns? Date,WT1,WT2?
@LouisSzeto with which code or library did you generate spy_wto.csv?
Hi! Please refer to this reference data: spy_wto.csv The columns are "SPY high" "SPY low" "SPY close" "TCI" "WT2"
Script to generate:
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
high = history.high
low = history.low
hlc3 = (close + high + low) / 3
esa = talib.EMA(hlc3, 10)
d = talib.EMA(abs(esa - hlc3), 10)
ci = (hlc3 - esa) / (0.015 * d)
tci = talib.EMA(ci, 21)
wt2 = talib.SMA(tci, 4)
wto = pd.concat([tci, wt2], axis=1).dropna()
wto["high"] = high
wto["low"] = low
wto["close"] = close
wto = wto.iloc[:, [2, 3, 4, 0, 1]]
wto.to_csv("spy_wto.csv", header=False)