[pshaiCmd] Stoch-RSI

stable
By pshai in Oscillators Published December 2019 👁 1,776 views 💬 0 comments

Description

Custom implementation of Stoch-RSI with some more parameters to play with.
HaasScript

DefineCommand("StochRSI", "Custom implementation of Stoch-RSI by pshai")

local rsiPeriod = DefineParameter(NumberType, "rsiPeriod", "RSI Period Length", true, 14, "Number, Input")
local stochPeriod = DefineParameter(NumberType, "stochPeriod", "STOCH Period Length", true, 9, "Number, Input")
local smoothingK = DefineParameter(NumberType, "smoothingK", "Smoothing %K Period Length", true, 3, "Number, Input")
local smoothingD = DefineParameter(NumberType, "smoothingD", "Smoothing %D Period Length", true, 3, "Number, Input")
local rsiSource = DefineParameter(ListNumberType, "rsiSource", "Source data for RSI", false, ClosePrices(), "ClosePrices, HLPrices, HLCPrices, OHLCPrices")

local rsi = RSI(rsiSource, rsiPeriod)
local stoch = STOCH(rsi, rsi, rsi, stochPeriod, smoothingK, smoothingD)

DefineOutput(ListDynamicType, {slowK = stoch.slowK, slowD = stoch.slowD}, "StochRSI values array", "Plot")
DefineOutputIndex(1, ListNumberType, "slowK", "%K values")
DefineOutputIndex(2, ListNumberType, "slowD", "%D values")

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!