#This column shows if the stock SMA and Macd are moving in the same direction plot scan = open; def Bullish = SimpleMovingAvg("length" = 20)."SMA" is greater than SimpleMovingAvg("length" = 20)."SMA" from 1 bars ago and MACDHistogram()."Diff" is greater than MACDHistogram()."Diff" from 1 bars ago; def Bearish = SimpleMovingAvg("length" = 20)."SMA" is less than SimpleMovingAvg("length" = 20)."SMA" from 1 bars ago and MACDHistogram()."Diff" is less than MACDHistogram()."Diff" from 1 bars ago; AssignBackgroundColor(if bullish then Color.GREEN else if bearish then color.red else color.black); AddLabel(yes, if Bullish then "Long" else if bearish then "Short" else " " , Color.Black);