// Strategy if bullish_cross strategy.entry("long", strategy.long)
if bearish_cross strategy.entry("short", strategy.short)
strategy.close("long", when = bearish_cross or bullish_cross) strategy.close("short", when = bullish_cross)
// Colors bartrendcolor = close > movingaverage_fast and close > movingaverage_slow and change(movingaverage_slow) > 0 ? color.green : close < movingaverage_fast and close < movingaverage_slow and change(movingaverage_slow) < 0 ? color.red : color.blue barcolor(switch1 ? bartrendcolor : na)