Change bar color for two candles based on criteria

Hi I am trying to code a change in the color of the bar, if the pervious bar closes above a moving average, and the current candles also closes above a moving average. I can get the colors to change, but it colors all the following candles that are closing above the moving average. I just want the first two bars. Can someone please advise the line of code to limit the color of the candles to the first two that close above the moving average. thanks.
1 person has
this question
+1
Reply