how to script sums of A/D data

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

 

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

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:

ADV = GETDATA(CODE=ADVSPX:BM);
DEC = GETDATA(CODE=DECSPX:BM);
ADV10 = ACC(ADV, RANGE=Look Back Period, BARS=10);
DEC10 = ACC(DEC, RANGE=Look Back Period, BARS=10);
ADV10/DEC10 CrossesAbove 2

Capture

Attached is a workbook with the SPX 10 day advance/decline ratio, along with custom bar colours, ie green when ratio > 1:

SPX-Breadth-Ratio.owb (25.7 KB)