It is said when individual investors are flocking into the stock market, the crash is near. The legend is that in 1929 Joe Kennedy- a wealthy professional investor AND JFK’s father- unloaded his stock portfolio because a shoeshine boy gifted him with several stock market tips. The story might be real but it doesn’t give us any credible clue on how to avoid the next market crash. Kennedy Sr. must have worried about the market bubble for sometime, and the shoeshine boy’s advice is only “the straw that broke the camel’s back”, so how do legendary investors like Kennedy Sr. know individual investors are flocking into the stock market? Is there an indicator or a magic number which measures the the flocking behaviour of individual investors?
I think this might be the most kept secret of the professional stock market investors: the margin debt and trading accounts’ credit balance are really good indicators in predicting stock market reversals, take a look at the chart below:

US stock market margin debit vs Nasdaq composite index, Data Source: finra.org
There are 3 major incidences of market crash: 1999 tech bubble, 2008 financial crisis, and 2020 COVID19 crash, and each time the “Debit Balances” reduced significantly but the “Credit Balances” kept increasing. Actually in other periods when this pattern happened, the Nasdaq 100 Composite Index also suffered losses, for example Jul-Dec 2018, Jul 2015-Feb 2016, May-Nov 2011, and the losses are quite significant for the period Jul-Dec 2018.
Several famous indicators have been signalling “bubble” status for the current US stock market, for example the CAPE ratio, the Buffett ratio, the total IPOs … so is it time for us to leave the party now? Maybe not if you believe what the margin debt chart above tells you: although the growth of “Debit Balances” has been slowing since Apr 2021, it is still positive so the “Debit Balances” are still increasing, and more importantly the trend for “Credit Balances” is not clear at the moment.
Disclaimer: I did this research on my own interest. It is your own risk if you decide to follow the advice in this article.