Revolution SMA-EMA Divergence
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © steffenrg

//@version=5
indicator("Revolution SMA-EMA Divergence")
len = input(50)

sma_short_cycle = ta.sma(close, len)
ema_short_cycle = ta.ema(close, len)
difference = ema_short_cycle - sma_short_cycle 



sma_long_cycle = ta.sma(close, len*2)
ema_long_cycle = ta.ema(close, len*2)
difference2 = ema_long_cycle - sma_long_cycle 

sma_timing = ta.sma(close, len/2)
ema_timing = ta.ema(close, len/2)
difference3 = ema_timing - sma_timing 

hline(0)

plot(difference2, color = color.black, style = plot.style_histogram)
plot(difference, color = color.orange, style = plot.style_histogram)
plot(difference3, color = color.red)