- Topics: 67
- Replies: 697
- Posts: 764
I think may work better when creating a time series based on YTD performance over multiple years.
The signal is when the YEARNUM() changes at the beginning of the year, and using the CHANGESINCESIGNAL() function from that point to calculate the YTD% for each day. However, we need to take the close of the day before the signal (ie the close of the previous year) so need to use the [-1] offset.
//Signal on change of year;
V1 = YEARNUM() <> YEARNUM();
//Change since day before signal to calc YTD%;
CHANGESINCESIGNAL(V1[-1]) < -10
Currently there are 6.5% of SPX stocks (33) down more than 10% this year (confirmed in the watchlist). Because the calculations are from the beginning of the year it resets each January: