how to script sums of A/D data

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

This topic contains 2 replies, has 3 voices, and was last updated by Darren Darren 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #55313
    Avatar
    David
    • 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?

    David

     

    #55319
    Mathew
    Mathew
    • Topics: 16
    • Replies: 1,098
    • Posts: 1,114

    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

    Mathew

    1 user thanked author for this post.
    #55333
    Darren
    Darren
    • Topics: 43
    • Replies: 299
    • Posts: 342

    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:

    Capture

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.

Close