
Plot DownSignal = if Diff crosses below ZeroLine then ZeroLine else Double.NaN Plot UpSignal = if Diff crosses above ZeroLine then ZeroLine else Double.NaN Plot Avg = MovingAverage(averageType, Value, MACDLength) Plot Value = MovingAverage(averageType, close + (close - close), fastLength) - MovingAverage(averageType, close + (close - close), slowLength) Input averageType = AverageType.EXPONENTIAL

Here is the simplified version that paints your candles to the trend of the indicator. #tpaintingstrategy(paintingStrategy.SQUARES) Signal2.assignValueColor(if buySignal2 then color.WHITE else color.YELLOW)

Plot signal2 = if buySignal2 or sellSignal2 then MD else double.nan Plot Data2 = ExpAverage(MDI2, Slength*3) ĭata2.DefineColor("Data2_SlopePos", Color.GREEN) ĭata2.DefineColor("Data2_SlopeNeg", Color.MAGENTA) ĭata2.AssignValueColor(if Data > Data2 then Data2.Color("Data2_SlopePos") else Data2.Color("Data2_SlopeNeg")) ĭata.DefineColor("Data_SlopePos", Color.CYAN) ĭata.DefineColor("Data_SlopeNeg", Color.RED) ĭata.AssignValueColor(if Data > Data2 then Data.Color("Data_SlopePos") else Data.Color("Data_SlopeNeg")) ĭef buySignal = if Data > Data2 and Data average(close,13) then 1 else 0 ĭef sellSignal = if Data = Data2 and expaverage(close,85) WS and MD average(close,13) then 1 else 0 ĭef sellSignal2 = if MD = WS and expaverage(close,85) < average(close,13) then 1 else 0

# where D1= yesterday's Dynamic, I = today's price, N = smoothing factor.ĭef MDI = A1 + ((value - A1) / Sqr(value / A1)) ĭata.SetPaintingStrategy(PaintingStrategy.LINE) ĭef MDI2 = A2 + ((value - A2) / Sqr(value / A2))
