Hi,
I want to calculate a breadth indicator using the S&P 500 Advancing and Declining issues with a fixed starting point.
The calculation is the following:
Suppose the oscillator stands at 100 at yesterdays close.
Suppose today there are 220 advancing issues and 385 declining issues of the S&P 500.
The calculation for yesterday was: N(yesterday) = 100;
N(today) = (0.9 * N(yesterday)) + (0.1 * (Advances(today) - Declines(today))
using the data from the above example:
N(today) = (0.9 * 100) + (0.1 * (220 – 385) = 73.5
Var1 = GETDATA(CODE=ADVSPX:BM); Var2 = GETDATA(CODE=DECSPX:BM); Var3 = (0.9 * 100) + (0.1 * (Var1 - Var2)); Var4 = (0.9 * Var3[1]) + (0.1 * (Var1 - Var2)); Var4
My script above is wrong because of the starting point. Var3 has to be a “different one” but I don’t know what is the right code.
Any help is very appreciated.
Thanks
Thomas