I’m trying to sum the results of 2 variables to use in a ranking system. The script of each variable is valid when run individually but when the ‘v’ for variable is added the script is no longer valid. What am I missing?
V1=HI200=MA(BARS=200, STYLE=Exponential, CALC=Close); (CLOSE() - HI200)/HI200*30;
V2=ROC(BARS=120)*30;
// sum the results of v1 + v2
sum V1+V2
I then want want to sum the results of v1 +v2, not sure if this is possible.
You have already called the first variable HL200. In fact there is also 2 semi-colons in that first line too - something looks like you have cut and pasted into the wrong location. Once you have sorted that out, the sum will just be V1+v2
HI50=MA(BARS=50, STYLE=Exponential, CALC=Close);
(CLOSE() - HI50)/HI5030/100;
HI200=MA(BARS=200, STYLE=Exponential, CALC=Close);
(CLOSE()-HI200)/HI20030/100;
HI50+HI200
Summing multiply ROC values is not causing any problems. My aim is to sum the values of the moving averages by weighting in % terms.
Once again each individual script is giving the correct outcome when placed in a watch list.
Your final line is summing lines 1 and 3, so the other lines aren’t required. If you do plan on using them in a more expanded script you need to give them a variable assignment…
Ok the script is now working but still not giving the result I’m looking for. I’m wanting to sum the values of the two moving averages. Using CSL as the test,
the values are A 30% of 200 ema = 5.51 and B 30% of 50 ema = 0.29% total =5.8. The script is giving this value as 57007.33%. I’m lost how to make the script give the correct answer. I have a script totalling numerous ROC values correctly. Where to next?