[cmd] Bill Williams Smoothed Moving Average SMA (SMMA)

0 62 Views No Comments 3 weeks ago
  • Bill Williams Smoothed Moving Average SMA (SMMA)
    Often used for its smoothing properties

    (I’m truly flattered that after I published this for what it really shines as a Moving Average:
    SmMA is now gaining momentum as a trendy Moving Average after Kraken was first to add it (together with z-score, good busy kraken…;])
    Now most exchange TradingView widgets offer it as SMA (it seems they finally got SMMA right lets see if they remembered to update their Alligator approximation from SMA to SMAA 😉
    Beginning to LOVE SMA and am making Guppy style bands with it already like SMA over MA and EMA most of the times)

    Used in my coming Soon… ™ True Williams Alligator (with Timeframe Multiplier)

    SmoothMoneyFlow: https://www.haasscripts.com/t/kobalt-smooth-money-flow/

    credits: I probably wouldn’t have done it without pshai who was kind enough to made the SMMA function..:)

    • This topic was modified 3 weeks ago by kobalt.
    • This topic was modified 1 week, 1 day ago by kobalt.
    HaasScript Code
    -- SMMA function for Alligator Trend lines.
    -- https://www.metatrader5.com/en/terminal/help/indicators/bw_indicators/alligator
    -- Created by pshai
    DefineCommand("SMMA", "Bill Williams Smoothed Moving Average (SMMA)")
    --local chartIndex = DefineParameter(NumberType, 'chartIndex', 'The index on which to chart', false, 0, 'Number')
    local src = DefineParameter(ListNumberType, "source", "Source data series.", true, HLPrices(), "HLPrices")
    local period = DefineParameter(NumberType, "period", "Period length of calculation", true, 10)
    local s = Load('s', HNC())
    if (Count(s) == 0) then
        s = SMA(src, period)
        local t1 = Grab(src, 0, period)
        local t2 = Grab(s, 0, period)
        s = (Sum(t1) - t2 + t1) / period
    --Plot(0, 'SMMA', s, SkyBlue)
    Save('s', s)
    DefineOutput(ListNumberType, s, "SMMA result", "Plot")
Login or Register to Comment

Unlock your crypto trading potential

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

Join for Free