[pshaiCmd] Stoch-RSI

0 345 Views No Comments 12 months ago
  • Custom implementation of Stoch-RSI with some more parameters to play with.

    HaasScript Code
    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")
Login or Register to Comment

Unlock your crypto trading potential

Create a free account and enjoy everything we have to offer.

Join for Free