OPEN-SOURCE SCRIPT

Index investing

The Index Investing indicator simplifies decision-making for adding to Index ETF's Long-term investments. By utilizing a percentage discount methodology, it highlights potential opportunities to enhance portfolios. This straightforward tool aids in identifying favorable moments to invest based on calculated price discounts from selected reference points, making the process more systematic and less subjective.

🔶 SETTINGS
  • Reference Price: Choose between 'All-Time-High' or 'Start of the Year' as the basis for calculating discount levels. This allows for flexibility in strategy depending on market conditions or investment philosophy.
  • Discount 1 %, Discount 2 %, Discount 3 %: These inputs define the percentage below the reference price at which buy signals are generated. They represent strategic entry points at discounted prices.


🔶 Default Parameters
The default parameters of 4.13%, 8.26%, and 12.39% for the discount levels are chosen based on the average 5-year return of the NIFTY Index, which stands at approximately 12.39%. By dividing this return into three parts, we obtain a structured approach to capturing potential upside at varying levels of market retracement, providing a logical basis for the selected default values.
Users have the flexibility to modify these parameters, tailoring the indicator to fit their unique approach and market outlook.

🔶 How Levels Are Calculated
Discount levels are calculated using the formula: Discount Price = Reference Price * (1 - Discount %). This succinct approach establishes specific entry points below the chosen reference, such as an all-time high or the year's start price.

🔶 How Are the Buy Labels Generated
Buy signals are generated when the market price(Low of the candle) crosses under any of the defined discount levels. Each level has a corresponding buy label ('Buy 1', 'Buy 2', 'Buy 3'), which is activated upon the price crossing below the specified discount level and is only reset at the beginning of a new year or upon reaching a new reference high, ensuring signals are not repetitive for the same price level.

🔶 Other Features
  • Alerts: The indicator provides alerts for each buy signal, notifying potential entry points at their defined discount levels. The alert triggers only once per candle.
  • Year Marker: A vertical line with an accompanying label marks the start of each trading year on the chart. This feature aids in visualizing the temporal context of buy signals and reference price adjustments.
indexindexesinvestinglongterminvestingnifty50NIFTYBEESPortfolio managementstatisticsTrend Analysis

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer