OPEN-SOURCE SCRIPT

Multi-Sector Trend Analysis

Mis à jour
This script, titled "Multi-Sector Trend Analysis: Track Sector Momentum and Trends," is designed to assist traders and investors in monitoring multiple sectors of the stock market simultaneously. It leverages technical analysis by incorporating trend detection and momentum indicators like moving averages and the Relative Strength Index (RSI) to offer insights into the price action of various market sectors.

Core Features:

1. Sector-Based Analysis: The script covers 20 major sectors from the NSE (National Stock Exchange) such as Auto, Banking, Energy, FMCG, IT, Pharma, and others. Users can customize which sectors they wish to analyze using the available input fields.
Technical Indicators: The script uses two core technical indicators to detect trends and momentum:

2. Moving Averages: The script calculates both fast and slow exponential moving averages (EMAs). These are critical for identifying short- and long-term price trends and crossovers, helping detect shifts in momentum.

3. Relative Strength Index (RSI): A well-known momentum indicator that shows whether a stock is overbought or oversold. This script uses a 14-period RSI to gauge the strength of each sector.

4. Trend Detection: The script identifies whether the current market trend is "Up" or "Down" based on the relationship between the fast and slow EMAs (i.e., whether the fast EMA is above or below the slow EMA). It highlights this trend visually in a table format, allowing quick and easy trend recognition.

5. Gain/Loss Tracking: This feature calculates the percentage gain or loss since the last EMA crossover (a key point in trend change), giving users a sense of how much the price has moved since the trend shifted.

6. Customizable Table for Display: The script displays the analyzed data in a table format, where users can view each sector's:
  • Symbol
  • Trend (Up or Down)
  • RSI Value
  • Gain/Loss Since the Last EMA Crossover


This table is customizable in terms of size and color theme (dark or light), providing flexibility in presentation for different charting styles.

How It Works:
  • Sector Selection: Users can input up to 20 different sector symbols for analysis.
  • Moving Averages: Users can define the period lengths for both the fast and slow EMAs to suit their trading strategies.
  • Table Options: Choose between different table sizes and opt for a dark theme to enhance the visual appearance on charts.


How to Use:
  • Select the symbols (sectors) that you want to track. The script includes pre-configured symbols for major sectors on the NSE, but you can modify these to suit your needs.
  • Adjust the fast and slow EMA lengths to your preference. A common setting would be 3 for the fast EMA and 4 for the slow EMA, but more conservative traders might opt for higher values.
  • Customize the table size and theme based on your preference, whether you want a compact table or a larger one for easier readability.


Why Use This Script:
This script is ideal for traders looking to:
  • Monitor multiple market sectors simultaneously.
  • Identify key trends across sectors quickly.
  • Understand momentum and detect potential reversals through RSI and EMA crossovers.
  • Stay informed on sector performance using a clear visual table that tracks gains or losses.
  • By using this script, traders can gain better insights into sector-based trading strategies, improve their sector rotation tactics, and stay informed about the broader market environment. It provides a powerful yet easy-to-use tool for both beginner and advanced traders.
Notes de version
New Feature: Multiple Weeks RSI Trend Indicator

This script now includes a Multiple Weeks RSI Trend Indicator. It computes the following to determine the RSI trend:

RSI Values: Calculated for 8, 14, and 19 bars
EMA: Calculated for 9 days

Trend Definitions:
  • Bullish Trend: RSI8 > RSI14 > RSI19 and price > EMA9
  • Bearish Trend: RSI8 < RSI14 < RSI19 and price < EMA9


The indicator displays RSI trend information for a default of 14 weeks, but the number of weeks can be configured according to your preferences. A blue color indicates a bullish trend, while a red color signifies a bearish trend. When the trend is neutral, the color black is used.

This indicator is versatile and can be applied to any timeframe, from intraday to weekly charts. The primary goal of this enhancement is to help you identify market trends, enabling you to align your trading strategy with the overall market direction.
indextradesector_analysissectoranalysissectorrotationsectorscannerTrend Analysistrendlinetrading

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité