// -------------------------------------------- // Swing indicator // -------------------------------------------- col_bullish = color.rgb(2, 102, 94, 23) col_bearish = color.rgb(122, 20, 2, 9) ma_fast = request.security( syminfo.tickerid, "240", ta.ema(close, 18), gaps = barmerge.gaps_off) ma_slow = request.security( syminfo.tickerid, "240", ta.ema(close, 22), gaps = barmerge.gaps_off) ema_h4_indicator = request.security( syminfo.tickerid, "240", ta.ema(close, 200), gaps = barmerge.gaps_off) col_swing_indicator = ma_fast > ma_slow ? color.rgb(3, 113, 144, 30) : color.rgb(109, 4, 42, 30) z1 = plot( _swing_indicator ? ma_fast : na, color=color.rgb(3,113,144), style = plot.style_line) z2 = plot( _swing_indicator ? ma_slow : na, color=color.rgb(109,4,42), style = plot.style_line) fill(z1, z2, col_swing_indicator) plot( _swing_indicator ? ema_h4_indicator : na, color=col_swing_indicator, style = plot.style_line)