// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © QuantCT //@version=4 study("ACD PMA", overlay=true, resolution="1D") ema1_period = input(title="EMA1 Period", defval=10) ema2_period = input(title="EMA2 Period", defval=20) ema3_period = input(title="EMA3 Period", defval=30) show_bg = input(title="Show Background?", defval=true) ema1 = ema(hlc3, ema1_period) ema2 = ema(hlc3, ema2_period) ema3 = ema(hlc3, ema3_period) colors = (rising(ema1, 1) and rising(ema2, 1) and rising(ema3, 1)) ? #27D600 : (not rising(ema1, 1) and not rising(ema2, 1) and not rising(ema3, 1)) ? #E30202 : color.orange ema1_plot = plot(ema1, color=colors) ema2_plot = plot(ema2, color=colors) ema3_plot = plot(ema3, color=colors) fill(ema1_plot, ema3_plot, color=show_bg ? colors : na, transp=50)