Perfomance between two static dates

I would like a script that calculates the ROC or Change between two static dates to use in a Watchlist column. E.g., 12-26-2018 and 2-19-2020.

I have tried various combinations using ROC, CHANGE, CHANGESINCESIGNAL, BARDATE, but have not been able to produce the desired result. Is this possible in Optuma? If so, I would appreciate any guidance on this.

Thanks

Hi Paul,

You can use a combination of VALUEWHEN and BARDATE/STRDATE functions to calculate the % change between 2 specific dates:

//Specify Dates;
D1 = BARDATE()==STRDATE(DATE=2018-12-26);
D2 = BARDATE()==STRDATE(DATE=2020-02-19);
//Get values and calc % change;
(VALUEWHEN(D2)/VALUEWHEN(D1))-1

This will get the values of the closing prices on those days by default, so to get the low to high change the last line to:

(VALUEWHEN(HIGH(),D2)/VALUEWHEN(LOW(),D1))-1

So AAPL and MSFT doubled between those dates (low to high), and WBA lost 19%:

Capture

(Note custom colours have been used to colour the bars red between those dates.)