Preview:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © finallynitin

//@version=5
indicator(title="Awesome Oscillator 13/34", shorttitle="AO", timeframe="", timeframe_gaps=true)

ao = ta.ema(hl2,13) - ta.ema(hl2,34)
diff = ao - ao[1]

plot(ao, color = diff <= 0 ? #F44336 : #009688, style=plot.style_columns)
     
changeToGreen = ta.crossover(diff, 0)
changeToRed = ta.crossunder(diff, 0)

alertcondition(changeToGreen, title = "AO color changed to green", message = "Awesome Oscillator's color has changed to green")
alertcondition(changeToRed, title = "AO color changed to red", message = "Awesome Oscillator's color has changed to red")
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter