Algo Trading in India |
  • December 7, 2020
  • admin
  • 1

In this article we shall analyze last 12 years of historical data to check if there are any patterns we can observe to invest in stocks for long term.

This is how Nifty moved in last 15 years with three major corrections, in the year 2008, then around 2016 and then year 2020 due to Coronavirus. Many stocks were available at attractive valuation during such correction period, but Investors were at extreme panic during those times, trying to exit their holdings. Only when we look back with hindsight bias we could say those were the best time to invest. But is there really any quantitative approach to find best time to invest?

200 day moving average is something that is widely used by many investors to check for long term trend. Where investors consider if stocks trades above 200 DMA, its in bullish phase and if it trades below 200 DMA its in bearish phase.

We shall run an analysis to find out of Nifty 50 stocks, how many number of stocks trades above 200 day moving average, higher the number, stronger the market. To run this analysis, we need correct data, we cannot test it with current Nifty 50 stocks, we need list of Nifty 50 stocks that are part of index historically, so when we run for Jan 2008, stocks like RPL, RNRL, UNITECH were part of Nifty 50, so it is essential to test it with correct datasets.

Nifty 50 stocks Jan 2008

Once we get all the list from 2008 to 2020, we need to find the count for each month, i.e. list of stocks trading above 200 day moving average for each month and plot the graph.

As you can see in the above chart, 


  • during the 2008 Oct-Dec period, number of stocks trading above 200 day moving average was very less, which denotes the extreme fear period, 
  • again in the year end of 2011, no of stocks that trades above 200 DMA in Nifty 50 stocks were less than 15, 
  • during the year end of 2016, no of stocks that trades above 200 DMA in Nifty 50 stocks were less than 20,
  • finally in the year 2020, no of stocks that trades above 200 DMA in Nifty 50 stocks were less than 10,


if you compare the above data with below Nifty chart, you can easily conclude that those extreme panic period were the times market bottomed out. 

Earlier in April when Corona pandemic was extremely high, I wrote an article stating market has bottomed out ( )and exactly within 6 months we are now trading at all time high.


Instead of applying 200 dma on index , no of stocks trading above 200 day moving average can be used as a good quantitative measure to make long term investing decision. Because 80% of Index movement comes from less than 20 stocks of Nifty index based on weightage. By monitoring all 50 individual stocks, we get clear picture of market trend. If you liked this article, please do share share it (WhatsappTwitter) with other Traders/Investors.

1 comment on “When is the best time to invest in stocks?

  1. What you said makes complete sense. My only submission here would be, this may work for NIFTY Benchmark index per day. Making a stock pick based Nifty trend, especially long term pick (assuming long term is > 1 yr at least) may not give as good result. It may still give some ride, riding along with nifty, but that’s more of trading perspective than long term investing. For individual stock to perform, I think that specific stock’s own price barriers and current levels will be important. It may be over it’s 200 DMA, but yet to get through a major price barrier, in which case it can make a retreat and if things not being so good fundamentally , might as well get below last low. In Summary we can neither base our deslcisions on just Nifty trend, nor most certainly base it on just stock trend. It’s the juxtapose of the two and the art to interpret the play out, that will get a winner – at best 5/10 times

Leave a Reply

Your email address will not be published.