OS AO (P-unity MACD)
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ownsov

//@version=4
study("OS AO (P-unity MACD)")
SlowLenght = input(34, minval=1, title="Slow Lenght")
FastLenght = input(5, minval=1, title="Fast Lenght")
FastSMA = sma(hl2, FastLenght)
SlowSMA = sma(hl2, SlowLenght)
AO = FastSMA - SlowSMA
AOSMA = sma(AO, FastLenght)
AOcolor = AO > AO [1] ? color.lime : color.red
plot(AO, color=AOcolor, linewidth=4, style=plot.style_histogram)
plot(AOSMA)