Add Results of 2 Separate Scripts

Hi,

I have a watchlist. I have 2 scripts. Both return numerical values properly in my watchlist columns.
The first is ASC_IntermediateTermRS
The second is ASC_LongTermRS

//Define the variables 
V1 = ROC(BARS=30); 
V2 =ROC(BARS=40); 
V3 =ROC(BARS=65); 
//Sum the variables V1 + V2 + v3;
//Define the variables 
V1 = ROC(BARS=130); 
V2 =ROC(BARS=195); 
V3 =ROC(BARS=260); 
//Sum the variables V1 + V2 + v3;

I now want to add the values returned by both scripts. In the watchlist my results are all 0%. I know the names of the scripts are correct since I did not type them by hand but chose them from the script function properties. Please help me to see my scripting mistake. Thank you.

//Define the variables 
V1 = SCRIPT(SCRIPTNAME=ASC_IntermediateTermRS); 
V2 = SCRIPT(SCRIPTNAME=ASC_LongTermRS); 

//Sum the variables V1 + V2;

Hi Louis,

I am not sure if it’s just a formatting issue with the post, but all 3 of the scripts you posted look to be missing the last line, where the actual addition takes place.

The last script, which combines the two should look like this:

//Set Variables
V1 = SCRIPT(SCRIPTNAME=ASC_IntermediateTermRS) ; 
V2 = SCRIPT(SCRIPTNAME=ASC_LongTermRS) ;
//Sum Total
V1 + V2

The only difference I can see is that you’ve added a ; at the end of the last line, which is not required.

Testing the setup here I can see the results are being returned as expected on a Chart and on a Watchlist.

Ex3

Hi Matthew,

Sorry about the script formatting error above. I just needed to hit enter to show V1 + V2 + V3 on the next line which you figured out.

My script matches yours, but I still can’t get it to work. I tried a new watchlist, a new workbook, and also retyping the scripts. Perhaps the two screenshots attached will help you help me. It works as you have pictured in a Show View tool, but not on the watchlist? Thank you.

Got it! Thank you!