Hi Yan,
You would need to make sure the Watchlist Date Range was set to Everything first. Then you can add additional lines to Darrens script example to find the value for specific dates.
In this example I’ve set it up to show me the value on the last trading day of 2023:
//Get new highs;
H1 = HIGH() >= HIGHESTHIGH(BACKTYPE=Weeks, BARS=52, INCBAR=True);
//Change in year;
Y1=YEARNUM() IsUp;
//Count new highs in each year;
V1 = ACCSINCESIGNAL(H1, Y1);
//Specific Year 2023
V2 = BARDATE() ;
V3 = STRDATE(DATE=2023-12-29) ;
V4 = V2 == V3;
VALUEWHEN(V1,V4)
You can adjust V3 to any date you are wanting to view the scripts results for.