IBD Distribution Days Study for TOS

R

RDMercer

Member
Anyone have a study that counts / calcs IBD distribution days for an index? Looking for something like:
((If todays close < (yesterdays close * .98) and (todays volume > yesterdays volume) (then distribution day)))
And if index rises 5% intraday then distribution day count resets to zero.

In a perfect study place a down arrow on a chert price bar marking the distribution day. AND a label box containing the running total count of distribution days over prior 25 days inclusive.

Open to all / any other enhancements or ideas. Thanks to all.
 
R

RDMercer

Member
I'm not too familiar with this. Maybe @markos can help?
It's William O'Neil's methodology to spot market turns and over a long time I've found it works very well. Of course right now we're one Tweet from a Twit away from either a YUGE rally or a sell-off depending on the mood of the moment. 🎱
 
markos

markos

Well-known member
VIP
@RDMercer I follow several former IBD port mgrs. The report below is from Ross Haber, who was there around David Ryan's time.
According to people at the IBD Meet up event in town, they are still using Excel to keep the distribution count. We use TOS at the meeting but no one has tackled distribution count yet.
There may be someone at the IBD Meet up meeting in Seattle or Vancouver, I forget which, that may have it in a code that they might not mind sharing. You would have to hunt that down via Meet-up.com. The information regarding Seattle or Vancouver comes from a MarketSmith presenter. What you do have seems like a good start.
 
R

RDMercer

Member
@RDMercer I follow several former IBD port mgrs. The report below is from Ross Haber, who was there around David Ryan's time.
According to people at the IBD Meet up event in town, they are still using Excel to keep the distribution count. We use TOS at the meeting but no one has tackled distribution count yet.
There may be someone at the IBD Meet up meeting in Seattle or Vancouver, I forget which, that may have it in a code that they might not mind sharing. You would have to hunt that down via Meet-up.com. The information regarding Seattle or Vancouver comes from a MarketSmith presenter. What you do have seems like a good start.
Thanks for the Report blog! I'm just looking to a lazy man's solution to the manual DD thing. If you ever run up on anything please advise. Rgds.
 
markos

markos

Well-known member
VIP
@RDMercer Your welcome. I sure will let you know. It's another one of my long-term searches....
 
U

UT2Pro1689

New member
I happen to start working on this study about a couple of months ago. I found we can get very close to the distribution day counts but not exactly the same as IBD.

There are more details disclosed by IBD than your brief description.
# Distribution day count tracking by IBD:
# https://www.investors.com/how-to-invest/investors-corner/tracking-distribution-days-a-crucial-habit/
# Stalling day tracking by IBD:
# https://www.investors.com/how-to-invest/investors-corner/can-slim-market-tops-stalling-distribution/

There are two major issues that we have to overcome:
1) The NYSE & NASDAQ volume numbers provided by TS are somewhat different from those provided by IBD. Any insights on how IBD gets or calculates their final volumes are be helpful.
2). IBD does not disclose the stalling day criteria fully and intends to keep it proprietary. Using the criteria mentioned in reference #2 above, I could see a lot of extra stalling days.

I'd be glad to share my script later after some additional calibration and cleaning up. It would be helpful if someone can provide the specific dates of distribution and stalling from IBD in the last few weeks so that I can improve the accuracy of the script.

Cheers
UT2Pro
 
markos

markos

Well-known member
VIP
@tomsk do you know of an IBD Style Distribution Day script? It's one of those eternal quests that some of us have been on. JQ doesn't have one in the Onenote.
 
T

tomsk

Well-known member
VIP
@markos Indeed there were several discussions on IBD related studies I have come across. However those were not based on the tickers comprising the IBD. Rather they focused more on RS of any tickers you wanted to track, so if AAPL was a component, you'll load that study and analyze the metrics the study detailed.

Here's one measure that Mobius posted several years ago. Hope this helps

Code:
declare lower;
plot IBDRS = close / close(symbol = "/ES");
EDIT: You can even get fancy and run a InertiaAll() call as well with some predefined starting date
 
U

UT2Pro1689

New member
@tomsk TOS has an RelativeStrength study included. I believe it fits IBD style.

TOS provides the open source as well:

#
# TD Ameritrade IP Company, Inc. (c) 2008-2019
#

declare lower;

input CorrelationWithSecurity = "SPX";
def close2 = close(CorrelationWithSecurity);

plot RS = if close2 == 0 then 0 else close/close2;
RS.setDefaultColor(GetColor(6));

def sr = CompoundValue("historical data" = RS, "visible data" = if isNaN(sr[1]) then RS else sr[1]);
plot SRatio = sr;
SRatio.setDefaultColor(GetColor(5));
 
B

Bamilus

New member
For the relative strength, I use Mansfield RS (see my post and code here https://usethinkscript.com/threads/mark-minervini-trend-template-tos-scanner.563/post-21314).

I found a collection of distribution days code that is based on IBD, but slightly edited based on the findings of Gil Morales and Chris Kacher (authors of "Trade Like an O'neil Disciple"). A man named Scott Johnson made the following, and I take no credit (links are to his Github which includes other indicators, as well, some of which I've found on here)

Possible Accumulation Day Indicator : This study shows a green bar arrow on chart for possible accumulation days (BASED ON PRICE ACTION ONLY). Read the note - the only Index that has volume in ToS, unfortunately, is $DJI. Using futures or ETF's is not a good proxy for SP500 or NASDAQ because their price moves aren't the exact same and the volume can be dramatically different. Right now I'm using $DJI since it has volume, but this study can be used for any index, you'll just have to get the volume from another source and confirm against that. There are tickers in TOS for total volume (such as $TVOLC/Q for NASDAQ COMPOSITE), but being able to translate that into a volume chart against the COMP symbol is beyond my ToS skills at the moment. If it's easy for anyone else, it would be cool to try to get volume matched with SP500 and NASDAQ index symbols in TOS.

Accumulation Distribution Bar Count - Does incorporate volume, so only works on $DJI. Displays a red bar for distribution days, green bar for accumulation. Yellow line is cumulative net accumulation days (sum accumulation days minus sum distribution days).

Accumulation Distribution Bar Count Breakout - Breakout in this context means: breakout of the factors in the study, not breakout in the sense of a price or stock breakout. This is same indicator as above, except it adds indicators to show not just the net accumulation days, but also total accumulation days, total distribution days, and the absolute number.

Accumulation Day Percent Gain Threshold - In the book "Trade Like an O'neil Disciple", they speak about how different market conditions require different cutoffs for accumulation days. This study shows the average minimum required % movement to be an accumulation day, based on some logic that you can evaluate yourself and based on last 200 days of index. I quite like this indicator, but there is an error in the last few lines of the code, so I deleted it but it still works. If anyone wants to see if they can fix it, it would be appreciate.

The line in question is:

Code:
AvgGainPlot.setHiding(if ShowAverageGainPlot == 1 then 0 else 1);
which errors out saying "ShowAverageGainPlot" isn't defined. I'm super new to ToS so I wasn't able to figure it out.

Anyways, hopes this helps.
 
N

Nick

Active member
2019 Donor
VIP
For the relative strength, I use Mansfield RS (see my post and code here https://usethinkscript.com/threads/mark-minervini-trend-template-tos-scanner.563/post-21314).

I found a collection of distribution days code that is based on IBD, but slightly edited based on the findings of Gil Morales and Chris Kacher (authors of "Trade Like an O'neil Disciple"). A man named Scott Johnson made the following, and I take no credit (links are to his Github which includes other indicators, as well, some of which I've found on here)

Possible Accumulation Day Indicator : This study shows a green bar arrow on chart for possible accumulation days (BASED ON PRICE ACTION ONLY). Read the note - the only Index that has volume in ToS, unfortunately, is $DJI. Using futures or ETF's is not a good proxy for SP500 or NASDAQ because their price moves aren't the exact same and the volume can be dramatically different. Right now I'm using $DJI since it has volume, but this study can be used for any index, you'll just have to get the volume from another source and confirm against that. There are tickers in TOS for total volume (such as $TVOLC/Q for NASDAQ COMPOSITE), but being able to translate that into a volume chart against the COMP symbol is beyond my ToS skills at the moment. If it's easy for anyone else, it would be cool to try to get volume matched with SP500 and NASDAQ index symbols in TOS.

Accumulation Distribution Bar Count - Does incorporate volume, so only works on $DJI. Displays a red bar for distribution days, green bar for accumulation. Yellow line is cumulative net accumulation days (sum accumulation days minus sum distribution days).

Accumulation Distribution Bar Count Breakout - Breakout in this context means: breakout of the factors in the study, not breakout in the sense of a price or stock breakout. This is same indicator as above, except it adds indicators to show not just the net accumulation days, but also total accumulation days, total distribution days, and the absolute number.

Accumulation Day Percent Gain Threshold - In the book "Trade Like an O'neil Disciple", they speak about how different market conditions require different cutoffs for accumulation days. This study shows the average minimum required % movement to be an accumulation day, based on some logic that you can evaluate yourself and based on last 200 days of index. I quite like this indicator, but there is an error in the last few lines of the code, so I deleted it but it still works. If anyone wants to see if they can fix it, it would be appreciate.

The line in question is:

Code:
AvgGainPlot.setHiding(if ShowAverageGainPlot == 1 then 0 else 1);
which errors out saying "ShowAverageGainPlot" isn't defined. I'm super new to ToS so I wasn't able to figure it out.

Anyways, hopes this helps.
Thanks for your sharing..will this check out and provide any feedbacks.
 
wtf_dude

wtf_dude

Active member
"The line in question is:

Code:
AvgGainPlot.setHiding(if ShowAverageGainPlot == 1 then 0 else 1);
which errors out saying "ShowAverageGainPlot" isn't defined. I'm super new to ToS so I wasn't able to figure it out. "



This is referencing a "show" choice for the average gain plot vs just showing the min pct

add this to the code up near the top under
declare lower;
input Period = 200;

####new line####
input ShowAverageGainPlot = yes;
 
Last edited:
Top