Lean icon indicating copy to clipboard operation
Lean copied to clipboard

Implement WaveTrend Oscillator Indicator

Open LouisSzeto opened this issue 3 years ago • 4 comments

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 master branch
  • [X] I have confirmed that this is not a duplicate issue by searching issues
  • [ ] I have provided detailed steps to reproduce the issue

LouisSzeto avatar Jun 20 '22 05:06 LouisSzeto

spy_wto.csv

LouisSzeto avatar Feb 23 '23 13:02 LouisSzeto

@LouisSzeto what are the columns? Date,WT1,WT2?

alexander-myltsev avatar Apr 02 '23 14:04 alexander-myltsev

@LouisSzeto with which code or library did you generate spy_wto.csv?

alexander-myltsev avatar Apr 05 '23 12:04 alexander-myltsev

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)

LouisSzeto avatar Oct 24 '23 11:10 LouisSzeto