how to script sums of A/D data

Optuma Forums Optuma Scripting how to script sums of A/D data

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #55313
    • Topics: 1
    • Replies: 0
    • Posts: 1

    I’m struggling to find a way to create a 10 sum of advances divided by a 10 day sum of declines as a measure of breadth thrust…

    Can this be accomplished somehow?



    • Topics: 28
    • Replies: 1,386
    • Posts: 1,414

    Hi David,

    Do you have the data sets for the Advances and Declines?

    Assuming that the first two lines get the respective data files (I can not remember what they are) then this should work.

    adv1 = GetData(code={advance ticker});
    dec1 = GetData(code={decline ticker});

    // now we need to accumulate the values
    accadv = ACC(adv1, bars=10);
    accdec = ACC(dec1, bars=10);

    // now we can do the division
    accadv / accdec

    If you don’t have the tickers then we can do it in the breadth engine instead. Let us know and we can update a script for that.

    All the best


    1 user thanked author for this post.
    • Topics: 54
    • Replies: 433
    • Posts: 487

    Hi David,

    Following Mathew’s reply you can use the ADVSPX and DECSPX symbols for the number of advances and declines for the S&P500, and ADVTSX & DECTSX for the TSX. You can then use the following in a Show Bar to highlight when the ratio is greater than 2:


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

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.