Hi,
I have a watchlist column that displays the value of an item of the last trading day of the month.
For June 2024 the script is the following:
Line1 = BARDATE()==STRDATE(DATE=2024-06-28) ;
Line2 = VALUEWHEN(CLOSE(), Line1) ;
Line2
The script works fine as it should.
But for the code “BAMLH0A0HYM2EY” there was no value for 06/28/2024!
How can I change the script that when for 06/28/2024 or any last trading day of a month there is no value available, the value of the day before should be used?
I tried the following script:
Line1 = BARDATE()==STRDATE(DATE=2024-06-28) ;
Line2 = VALUEWHEN(CLOSE(), Line1) ;
Line3 = BARDATE()==STRDATE(DATE=2024-06-27) ;
Line4 = VALUEWHEN(CLOSE(), Line3) ;
Line5 = IF(Line2 >= 0, Line2, Line4) ;
Line5
The script does not work, because for the code “BAMLH0A0HYM2EY” there was no value for 06/28/2024.
Any suggestion is appreciated.
Thanks,
Thomas