The only difference between the purple line and the red line is that IF the value of src-(Multiplier*atr) for the period before (i.e. the day before the current candle if the chart was daily) -- if that value is NaN (not a number -- usually means division by zero occurred) -- then it will switch out...