Advanced Stochastic Helper

Advanced Stochastic Helper is an MultiTimeFrame Stochastic Oscillator combined with an multiple SMA source option : Money Flow (ADMF), ASI and ADMF, Absolute Strength Index (ASI). I’ve pushed the options to the max in this one. By default, the oscillator reads as follows : blue candles representing an uptrend, red candles a downtrend and gray ones representing a range area, or a probable pullback.

Advanced Stochastic Helper in action on Brent OIL CFD.

Screenshot taken from the Settings menu of Advanced Stochastic helper Helper.

Here is the complete list of features present in this indicator :

  • Configurable RSI, Stochastic and Oscillator Length
  • SMA Length Smoothed (3 types of smoothing available : ASI and AMF, Absolute Strength Index and Money Flow)
  • ADMF Price Factor (Optional)

All indicators have their original default settings. You need to be able to readjust them depending on the market instrument you want to analyze. You have the possibility to put alerts which will notify you when an indicator gives a new signal. When placing an alert, be sure to choose the “once per bar” option each time you place an alert.

Rate this Indicator?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this Indicator.


Or copy / paste the source code into your pine editor :

// This source code is subject to the terms of the Mozilla Public License 2.0 at
// © RickSimpson

study(title="Advanced Stochastic Helper", overlay=false)

ashrsiashrlen   = input(defval=20,                  title="RSI Length",        minval=1)
ashstochashrlen = input(defval=3,                   title="Stoch Length",      minval=1)
ashsmoothk      = input(defval=5,                   title="SmoothK",           minval=1)
ashsmoothd      = input(defval=2,                   title="SmoothD",           minval=1)
ashoscashrlen   = input(defval=14,                  title="Oscillator Length", minval=1)
ashsrc          = input(defval=close,               title="SMA Source")
ashsmaashrlen   = input(defval=2,                   title="SMA Length",        minval=1)
ashtype         = input(defval="Money Flow (ADMF)", title="Type",              options=["ASI and ADMF","Absolute Strength Index (ASI)","Money Flow (ADMF)"])
ashprice        = input(false,                      title="Use ADMF Price Factor?")


ashsource       = close
ashrsi          = rsi(ashsource, ashrsiashrlen)
show_ashtype    = false
ashist          = false
ashashrlenstoch = 14
smoothK         = 2
periodD         = 2
ashutb          = 55
ashlts          = 45
ashrlen         = 14
k               = sma(stoch(ashrsi, ashrsi, ashrsi, ashstochashrlen), ashsmoothk)
d               = sma(k, ashsmoothd)
ashuc           = crossover(k, d)
ashdc           = crossunder(k, d)
ashstosc        = sma(stoch(close, high, low, ashoscashrlen), ashsmaashrlen)
ashul           = ashutb
ashll           = ashlts
ashstcol = ashstosc >= ashul ? : ashstosc <= ashll ? : color.gray
ASI           = if ashtype == "Absolute Strength Index (ASI)" or ashtype == "ASI and ADMF"
    gain_loss = 10000 * change(ashsrc) / nz(avg(ashsrc[1], ashsrc), 0.0000000001)
    rma(gain_loss, ashrlen)
ADMF          = if ashtype == "Money Flow (ADMF)" or ashtype == "ASI and ADMF"
    trl       = min(low,  close[1])
    trh       = max(high, close[1])
    AD_ratio  = change(close) / nz(tr(true), 0.00000001)
    vol       = if ashprice
        volume * avg(close[1], close, trl, trh)
    rma(vol * AD_ratio, ashrlen)
_lowest(_ashsrc) =>
    l = _ashsrc
    l := if _ashsrc < nz(l[1], _ashsrc)
        nz(l[1], _ashsrc)
_highest(_ashsrc) =>
    h = _ashsrc
    h := if _ashsrc > nz(h[1], _ashsrc)
        nz(h[1], _ashsrc)

stochastic(_ashsrc, _lowest, _highest) =>
    _stoch = if ashist
        100 * (_ashsrc - _lowest) / (_highest - _lowest)
        stoch(_ashsrc, _ashsrc, _ashsrc, ashashrlenstoch)
lowest_ASI   = _lowest(ASI)
highest_ASI  = _highest(ASI)
lowest_ADMF  = _lowest(ADMF)
highest_ADMF = _highest(ADMF)
stoch_ASI    = rma(stochastic(ASI, lowest_ASI, highest_ASI), smoothK)
rma_1        = rma(stoch_ASI, periodD)
stoch_ADI_D  = periodD == 1 ? na : rma_1
stoch_ADMF   = rma(stochastic(ADMF, lowest_ADMF, highest_ADMF), smoothK)
rma_2        = rma(stoch_ADMF, periodD)
stoch_ADMF_D = periodD == 1 ? na : rma_2


plot(ashstosc, title="Stochastic",  style=plot.style_histogram, color=ashstcol,      linewidth=4)
h0 = plot(ashist or show_ashtype ? na : 80, title="Upper",      color=color.silver,  linewidth=3)
h1 = plot(ashist or show_ashtype ? na : 20, title="Lower",      color=color.silver,  linewidth=3)
plot(show_ashtype ? ASI  : stoch_ASI,       title="ASI (%K)",   color=color.fuchsia, linewidth=2)
plot(show_ashtype ? na   : stoch_ADI_D,     title="ASI %D",,  linewidth=2)
plot(show_ashtype ? ADMF : stoch_ADMF,      title="ADMF (%K)",  color=color.aqua,    linewidth=2)
plot(show_ashtype ? na   : stoch_ADMF_D,    title="ADMF %D",    color=color.yellow,  linewidth=2)
plot(lowest_ASI  <  lowest_ASI[1]  or highest_ASI  >  highest_ASI[1] ? show_ashtype ? ASI  : stoch_ASI  : na, title="Record low/high ASI",  color=#cc00ffff, style=plot.style_circles, linewidth=3)
plot(lowest_ADMF <  lowest_ADMF[1] or highest_ADMF > highest_ADMF[1] ? show_ashtype ? ADMF : stoch_ADMF : na, title="Record low/high ADMF", color=#0000ffff, style=plot.style_circles, linewidth=3)
fill(h0, h1, title="Band",


alertcondition(condition=ashdc, title="Stochastic Sell", message='Stochastic Sell')
alertcondition(condition=ashuc, title="Stochastic Buy",  message='Stochastic Buy')

The content covered on this website is NOT investment advice and I am not a financial advisor.