MA-cédé
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Arthur_Detaille

//@version=4
study("MERCURY", overlay=false)

length = input(8, minval=1, title="QUICK")
length2 = input(64, minval=1, title="SLOW")
lengthSignal = input(32, minval = 1, title="SIGNAL")

quick = avg(highest(close, length), lowest(close, length))
slow = avg(highest(close, length2), lowest(close, length2))

CD = (quick - slow)/close * 100
SIGNAL = sma(CD, lengthSignal)

color_blue = #0000ff

p2 = plot(series=CD, color=color.blue, trackprice=true, linewidth=2)
p3 = plot(0, color=color.white)
// fill(p2, p3, color=color_blue, transp=50)
p = plot(SIGNAL, color=color.orange, linewidth=2, trackprice=true)