OPEN-SOURCE SCRIPT

Efficiency Ratio Trend [Achira Meegasthanne]

5 206
Efficiency Ratio Trend

Efficiency Ratio Trend is an adaptive trend-following indicator designed to identify the current market direction by combining price efficiency, adaptive deviation, volatility, and trend persistence.

The indicator uses an Efficiency Ratio to dynamically adjust its deviation and create a step-style trend line that responds to meaningful price movement while filtering smaller fluctuations.

🔹 KEY FEATURES

📊 EFFICIENCY RATIO

The indicator calculates an Efficiency Ratio based on the relationship between net price movement and the total absolute price movement over the selected Length.

This allows the trend calculation to adapt to the efficiency of the current market movement.

📈 ADAPTIVE TREND CALCULATION

The indicator uses the Efficiency Ratio together with short-term and long-term standard deviation measurements to calculate a dynamic deviation.

This creates an adaptive trend level that responds differently depending on current market conditions.

⚙️ CUSTOMIZABLE SETTINGS

The indicator provides several user-controlled settings:

• Length
• Fast Length
• Slow Length
• Source
• Sensitivity

The default settings are:

• Length = 200
• Fast Length = 100
• Slow Length = 400
• Source = Close

📐 DYNAMIC DEVIATION

The deviation is dynamically calculated by combining fast and slow volatility measurements according to the current Efficiency Ratio.

When market efficiency changes, the weighting between the fast and slow volatility components changes accordingly.

🟢 BULLISH TREND

A bullish trend condition is established when the adaptive trend value moves upward beyond the defined volatility threshold.

When bullish conditions are active:

• The trend line uses the bullish color
• The trend state becomes bullish
• Price movement is visually represented as an upward trend

🔴 BEARISH TREND

A bearish trend condition is established when the adaptive trend value moves downward beyond the defined volatility threshold.

When bearish conditions are active:

• The trend line uses the bearish color
• The trend state becomes bearish
• Price movement is visually represented as a downward trend

📊 VOLATILITY-ADJUSTED THRESHOLD

The indicator uses a 14-period ATR to calculate the current volatility percentage.

The adaptive trend movement is compared against this volatility-based threshold to determine whether a meaningful trend change has occurred.

🧠 TREND PERSISTENCE

Small movements below the calculated threshold do not immediately change the trend state.

Instead, the previous trend direction is maintained until the adaptive movement exceeds the required threshold.

This helps reduce unnecessary changes caused by smaller price fluctuations.

🎨 TREND VISUALIZATION

The indicator displays a step-style trend line directly on the chart.

The line changes between:

• Bullish
• Bearish

This provides a simple visual representation of the current adaptive market direction.

📌 CORE CONCEPT

Price Efficiency → Adaptive Volatility → Dynamic Deviation → ATR Threshold → Trend Confirmation → Direction

🧠 HOW IT WORKS

1. Calculate Price Efficiency

The indicator measures net price movement relative to the total absolute movement over the selected Length.

2. Calculate Volatility

Fast and slow standard deviation values are calculated using the configured Fast Length and Slow Length.

3. Build Adaptive Deviation

The Efficiency Ratio determines how the fast and slow volatility components are weighted.

4. Create the Adaptive Trend

The indicator updates the trend value only when price moves beyond the calculated adaptive deviation.

5. Calculate ATR Threshold

A 14-period ATR is used to normalize the trend movement according to current market volatility.

6. Confirm Trend Direction

Only movements exceeding the volatility-adjusted threshold are considered meaningful trend changes.

7. Display the Trend

The resulting adaptive trend is plotted as a step-style line with bullish or bearish coloring.

⚠️ IMPORTANT DISCLAIMER

This indicator is designed for market analysis and educational purposes.

The Efficiency Ratio Trend should not be considered a guaranteed buy or sell signal.

Trend calculations are based on historical price and volatility data, and market conditions can change quickly.

Always perform your own analysis, use proper risk management, and thoroughly test the indicator before using it with real capital.

Measure the efficiency. Adapt to volatility. Follow the trend.

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.