Script Help

Optuma Forums Optuma Scripting Script Help

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #66389
    • Topics: 17
    • Replies: 7
    • Posts: 24

    Is there a way to calculate the percent of S&P 500 stocks that are down 10% or more YTD?
    Any help would be much appreciated.

    • Topics: 5
    • Replies: 625
    • Posts: 630


    Yes, if you have the Breadth module you can build a custom breading using a modified version of the following script Darren posted earlier this week:

    Set this up to run on the SP500:


    Based on the current value 7% of SP500 stocks have a YTD performance of -%10 or more.

    1 user thanked author for this post.
    • Topics: 17
    • Replies: 7
    • Posts: 24

    Thank you.

    • Topics: 70
    • Replies: 827
    • Posts: 897

    Hi Matthew,

    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.

    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:


    2 users thanked author for this post.
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Pin It on Pinterest