I see the idea you are summing the dd over the defined range, but since for already has a range 😄, the idea is to count all the small variations, I have reinvented the sma
DogeMinerX
--
The for loop accumulates values without resetting, which can distort calculations. Correction: Rewrite with a sliding window. diff = math.abs(clos - clos[1]) m = clos > clos[1] dm = ta.sum(m ? diff : 0, range) dd = ta.sum(m ? 0 : diff, range) . What do you think?
Disclaimer: Includes third-party opinions. No financial advice. May include sponsored content.See T&Cs.