Lean
Lean copied to clipboard
Premier Stochastic Oscillator Indicator
Expected Behavior
Support "Premier Stochastic Oscillator"
- https://www.investopedia.com/articles/trading/10/premier_stochastic_oscillator_explained.asp
- https://www.tradingview.com/script/xewuyTA1-Indicator-Premier-Stochastic-Oscillator/
Actual Behavior
No implementation of "Premier Stochastic Oscillator"
Potential Solution
Implement "Premier Stochastic Oscillator"
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
spy_pso.csv Columns: "SPY high" "SPY low" "SPY close" "PSO"
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
close = history.close
k, d = talib.STOCH(high, low, close,
fastk_period=8,
slowk_period=8,
slowd_period=8)
nsk = 0.1 * (k - 50)
ss = talib.EMA(talib.EMA(nsk.dropna(), 5), 5).dropna()
expss = np.exp(ss)
pso = ((expss - 1) / (expss + 1)).to_frame()
pso["high"] = high
pso["low"] = low
pso["close"] = close
pso = pso.iloc[:, [1, 2, 3, 0]]
pso.to_csv("spy_pso.csv", header=False)
I will take this one.