Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

How Nifty Performed in the Last 4 Days of Year-End Closing – Year-End Seasonality

1 min read

Traders often use statistical methods to identify and confirm seasonal patterns, looking at historical data to determine if there is a statistically significant trend that repeats over time. Since the year end is nearing thought of exploring the year-end seasonality to get a fair idea about how Nifty Performed in the last 4 days during the year-end closing.

Markets often enter a “holiday mood” during the end-of-year season, with many fund managers taking holidays globally. This period is characterized by reduced trading activity and volume. Given this context, it’s interesting to analyze the returns during the last four trading sessions of the year to understand how the holiday season impacts market performance. This analysis can reveal trends or anomalies specific to this quieter trading period.

Most of the years show positive returns in the last four trading sessions, which supports the idea of a year-end rally. This could be due to factors like investment and tax strategies, optimism for the new year, or institutional portfolio adjustments.

Investors might be adjusting portfolios for tax reasons before the year ends, contributing to increased market activity and potential rallies. Out of 33 years, the past 30 years showed positive returns and only 3 years ended with negative returns. Here is the list of years with negative returns in the last 4 trading sessions.

  1. 1990: -9.95%
  2. 2011: -3.24%
  3. 2019: -0.38%

Markets Showed significant positive numbers, especially in years like 2016, 2018, and 2021, suggesting strong year-end rallies. Negative numbers, as seen in 2011 and 2019, indicate a drop, which could be due to year-end profit-taking or other macroeconomic factors.

Years like 1990 with a significant drop and 2016 with a substantial rise might be worth investigating further to understand what unique conditions (economic changes, policy decisions, global events) influenced these anomalies.

Amibroker AFL Code to Check Year-End Seasonality

The Amibroker AFL (AmiBroker Formula Language) code provided below is designed to calculate and display the returns for the last four trading days of the year for a given stock or index.

_SECTION_BEGIN("Returns Since the Last 5 days of the Year");

newyear = Ref(Year(),-1) != Year();

days1back = Ref(newyear,1);
days5back = Ref(newyear,5);

days1back_close = ValueWhen(days1back,Close);
days5back_close = ValueWhen(days5back,Close);

last5day_returns = (days1back_close - days5back_close)/days5back_close*100;

Filter = Ref(newyear,1);;

//AddColumn(Close,"LTP",1.2);
AddColumn(days1back_close,"Year End Close",1.2);
AddColumn(days5back_close,"Year End - 5 Day Close",1.2);
AddColumn(days1back_close - days5back_close,"Points Earned in Last 4 Session",1.2);
AddColumn(last5day_returns,"Last 5 Day Returns (%)",1.2);

_SECTION_END();


This AFL script is useful for traders and analysts who want to study the seasonality and performance of stocks or indices during the end-of-year period. It provides a clear view of how the asset performed in the crucial last few days of the year, which can be a period of significant market movements due to factors like year-end closing, tax considerations, and holiday trading volumes.

What are your projections regarding the performance of Nifty in the final four trading days of 2023? Do you anticipate a positive or negative trend in returns as the year concludes?

Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

6 Essential Skill Sets for Trading Success

Trading is not just about having capital and making trades; it's a complex battlefield where every participant is competing for the same goal: profit....
Rajandran R
1 min read

Interactive Brokers – Smart Order Chart Trading Module using…

The IB Controller is an interface designed to facilitate automatic trading with AmiBroker and Interactive Brokers (IB) TWS (Trader Workstation). It serves as a...
Rajandran R
8 min read

Introducing OpenAlgo V1.0: The Ultimate Open-Source Algorithmic Trading Framework…

OpenAlgo V1.0 is an open-source algorithmic trading platform to automate your trading strategies using Amibroker, Tradingview, Metatrader, Python etc. Designed with the modern trader...
Rajandran R
2 min read

One Reply to “How Nifty Performed in the Last 4 Days of…”

  1. Hello sir

    Can you provide strategy name for use stock position buy sell

    I’m currently use your vlintra v5 for nifty and b,nifty

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More