AlfyParticipant
Average
Good morning guys, does anyone know a way to build the % of down (close-close1) minus the % of up trading days (close-close1) of a stock over the last 126 trading days please? So for example, if a stock was down 35% and up 65% of the last 126 trading days, then the answer would be 0.35-0.65=-0.3
Thanks and happy holidays!
Not tested:
N = 126
Up = summation[N]((close - close[1]) > 0)
Down = summation[N]((close - close[1]) < 0)
Total = Up + Down
UPpercent = Up * 100 / Total
DOWNpercent = Down * 100 / Total
Difference = UPpercent - DOWNpercent
Return Difference as “Difference”
when Difference > 0 UPs are greater than DOWNs, when < 0 it’s the other way round.