Optuma Forums › Optuma Scripting › Add Results of 2 Separate Scripts
- This topic has 3 replies, 2 voices, and was last updated 1 year ago by
Louis.
-
AuthorPosts
-
August 20, 2021 at 6:17 am #65631
Louis
- Topics: 40
- Replies: 69
- Posts: 109
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_LongTermRS1234567//Define the variablesV1 = ROC(BARS=30);V2 =ROC(BARS=40);V3 =ROC(BARS=65);//Sum the variables V1 + V2 + v3;1234567//Define the variablesV1 = 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.
1234567//Define the variablesV1 = SCRIPT(SCRIPTNAME=ASC_IntermediateTermRS);V2 = SCRIPT(SCRIPTNAME=ASC_LongTermRS);//Sum the variables V1 + V2;-
This topic was modified 1 year ago by
Louis Spector.
August 20, 2021 at 8:38 am #65638Matthew
- Topics: 5
- Replies: 653
- Posts: 658
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:
1234567//Set VariablesV1 = SCRIPT(SCRIPTNAME=ASC_IntermediateTermRS) ;V2 = SCRIPT(SCRIPTNAME=ASC_LongTermRS) ;//Sum TotalV1 + V2The 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.
August 20, 2021 at 9:05 am #65641Louis
- Topics: 40
- Replies: 69
- Posts: 109
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.
-
This reply was modified 1 year ago by
Louis Spector.
Attachments:
You must be logged in to access attached files.
August 20, 2021 at 9:28 am #65655Louis
- Topics: 40
- Replies: 69
- Posts: 109
Got it! Thank you!
-
This reply was modified 1 year ago by
Louis Spector.
Attachments:
You must be logged in to access attached files.
-
AuthorPosts
- You must be logged in to reply to this topic.