Count Results In A Watchlist

Optuma Forums Optuma Scripting Count Results In A Watchlist

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #65235
    Louis
    • Topics: 2
    • Replies: 3
    • Posts: 5

    Hi,

    I have a watchlist where a column returns either true or false. I would like to count the number of rows in the column that displays the value of True. I tried using the ACC function and also the SCRIPT function, but I have been unsuccessful. Please see the picture. I want to know how many of the stocks in the watchlist are returning true in the column where I scripted is the closing price above its 20 day exponential moving average. Thank you very much.

    #65238
    Matthew
    • Topics: 5
    • Replies: 377
    • Posts: 382

    Hi,

    To do this i would suggest right clicking on the header of the column and selecting Group By Column

    Ex8

    Once that is done, right click on the summary headers which display, and adjust the  Summary Type to Count:

    Ex9

    In the above example you can see 22 were True and 8 were False.

    #65239
    Louis
    • Topics: 2
    • Replies: 3
    • Posts: 5

    Hi Matthew. Thank you for this explanation. You are very helpful as always, and this worked like a charm.

    Please help me take the next step.  I have attached a picture. It is watchlist of the current S&P 500 stocks in the XLC sector. I would like to know how to create a script  for the Show View tool to display the number of true results each day, not cumulative, which can sit under a daily chart of the XLC. For example, The returned true value here is 13. I would like to have a plot that returns the number 13 under the candlestick belonging to today. How would I script this? Thank you, Louis.

    #65243
    Darren
    • Topics: 66
    • Replies: 633
    • Posts: 699

    Hi Louis,

    You would need to use the custom breadth module under Data > Market Breadth to create a time series that can then be displayed below the chart.

    Create a symbol and name for the data, eg XLC20EMA and under Codes to Include select S&P500 Communication Services from the Lists tab. When a condition is true it has a value of 1, so use the Sum option for the Breadth Action and it will calculate the number of true events for each day (alternatively you can use Percent).

    Capture

    Once the breadth data has been built, it can then be added to a chart of XLC using the Breadth Data tool to display under the chart (select it from the Custom source list).

    Capture

    #65249
    Louis
    • Topics: 2
    • Replies: 3
    • Posts: 5

    Hi Darren and Matthew,

    Spot on! Your instructions were clear and worked perfectly.

    Just to make sure I understand and not to bother you further on this point: there is no way for a script to reference a watchlist, however Market Breadth can look at a lists I import from excel which would be how I make measurements of this type on lists when there is no Optuma pre-built list.

    thank you, thank you!

    #65251
    Darren
    • Topics: 66
    • Replies: 633
    • Posts: 699

    Exactly – watchlists are a snapshot, but the breadth engine will build the time series off of any Symbol List.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Pin It on Pinterest