Code: Select all
//@version=5
indicator("dg")
src = input(close, "Source")
ma = ta.sma(src, 20)
max=0
for i = 1 to 999
if ma[i] > ma
max=i
plot(max)
Code: Select all
//@version=5
indicator("dg")
src = input(close, "Source")
ma = ta.sma(src, 20)
max=0
for i = 1 to 999
if ma[i] > ma
max=i
plot(max)
Code: Select all
//@version=5
indicator("dg")
src = input(close, "Source")
ma = ta.sma(src, 20)
max=0
for i = 1 to 999
if close[i] > ma[i]
max+=1
plot(max)