Accelerating Dual Momentum Score
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © noooob

//@version=4
study(title="Accelerating Dual Momentum Score", shorttitle="ADMS")

month1 = input(21,title="1M")
month3 = input(63,title="3M")
month6 = input(126,title="6M")

getRateOfReturn(price, length) =>
    return = (price/price[length]-1)*100
    
m1 = getRateOfReturn(close, month1)
m3 = getRateOfReturn(close, month3)
m6 = getRateOfReturn(close, month6)
w = (m1+m3+m6)/3

wColor = w>0?color.new(#00ddff,0):color.new(#ff3333,0)

plot(w, title="W",style=plot.style_columns,color=wColor)