OPEN-SOURCE SCRIPT

Stage Market V4

This script provides a comprehensive tool for identifying market stages based on exponential moving averages (EMAs), market performance metrics, and additional price statistics. Below is a summary of its functionality and instructions on how to use it:

1. Inputs and Configuration
Fast and Slow EMA:

Fast EMA Length: Determines the period for the fast EMA.
Slow EMA Length: Determines the period for the slow EMA.
Additional EMAs:

Enable or disable three additional EMAs (EMA 1, EMA 2, and EMA 3) with customizable lengths.
52-Week High Display:

Optionally display the percentage distance from the 52-week high.
2. Market Stages
The indicator identifies six market stages based on the relationship between the price, fast EMA, and slow EMA:

Recovery: Price is above the fast EMA, and the slow EMA is above both the price and the fast EMA.
Accumulation: Price is above both the fast EMA and slow EMA, but the slow EMA is still above the fast EMA.
Bull Market: Price, fast EMA, and slow EMA are all aligned in a rising trend.
Warning: Price is below the fast EMA, but still above the slow EMA, signaling potential weakness.
Distribution: Price is below both EMAs, but the slow EMA remains below the fast EMA.
Bear Market: Price, fast EMA, and slow EMA are all aligned in a falling trend.
The current stage is displayed in a table along with the number of bars spent in that stage.

3. Performance Metrics
The script calculates additional metrics to gauge the stock's performance:

30-Day Change: The percentage price change over the last 30 days.
90-Day Change: The percentage price change over the last 90 days.
Year-to-Date (YTD) Change: The percentage change from the year's first closing price.
Distance from 52-Week High (if enabled): The percentage difference between the current price and the highest price over the past 52 weeks.
These values are color-coded:

Green for positive changes.
Red for negative changes.
4. Table Display
The indicator uses a table in the bottom-right corner of the chart to show:

Current market stage and bars spent in the stage.
30-day, 90-day, and YTD changes.
Distance from the 52-week high (if enabled).
5. EMA Plotting
The script plots the following EMAs on the chart:

Fast EMA (default: 50-period) in yellow.
Slow EMA (default: 200-period) in orange.
Optional EMAs (EMA 1, EMA 2, and EMA 3) in blue, green, and purple, respectively.

6. Using the Indicator
Add the indicator to your chart via the Pine Editor in TradingView.
Customize the input parameters to fit your trading style or the asset's characteristics.
Use the table to quickly assess the current market stage and key performance metrics.
Observe the plotted EMAs to understand trend alignments and potential crossovers.

This script is particularly useful for identifying market trends, understanding price momentum, and aligning trading decisions with broader market conditions.
Exponential Moving Average (EMA)Moving AveragesTrend 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