OPEN-SOURCE SCRIPT

byquan Indicator A - EMA20 Early Retest BUY (Trend Filter)

54
Indicator A – EMA20 Early Retest (Trend-Filtered Buy Setup)
Overview

Indicator A – EMA20 Early Retest is a trend-following tool designed to identify early pullback buy opportunities using only EMA structure, without relying on candlestick patterns.

The indicator focuses on:

EMA alignment

EMA momentum

Controlled pullbacks

Early retests before a full breakout

It is designed to generate one signal per trend leg, helping reduce noise and repeated entries.

⚠️ This indicator is intended for educational and analytical purposes only. It does not provide trading advice or guarantee any performance.

Core Concept

The logic behind Indicator A is based on a simple observation:

In a healthy uptrend, EMA20 often pulls back after a strong move, then retests near its previous peak before continuing.

Instead of waiting for a breakout or reacting late, this indicator attempts to highlight early retest zones, where momentum may resume while risk remains relatively controlled.

EMA Structure Used

The indicator uses three exponential moving averages:

EMA20 → short-term momentum

EMA50 → medium-term trend

EMA100 → higher timeframe structure

Only the EMA values themselves are used.
No candle shapes, wicks, or price patterns are involved.

Buy Conditions (High-Level)

A BUY signal is considered only when all of the following steps occur in sequence:

1. EMA20 Crosses Up

EMA20 must cross above EMA50 or EMA100, signaling the start of a potential bullish momentum phase.

This event initializes a new setup.

2. EMA20 Builds a Peak

After the cross:

EMA20 continues rising

The indicator tracks the highest EMA20 value

The peak is considered valid only after EMA20 starts declining for more than one step, helping avoid minor fluctuations

3. Deep Pullback Requirement

EMA20 must pull back by a minimum percentage of the total move from:

the cross point → to the EMA20 peak

This pullback depth is configurable (default: 25%).

Shallow pullbacks are ignored.

4. Early Retest Zone

After a valid pullback, the indicator waits for EMA20 to rise again and reach approximately 90% of the previous EMA20 peak.

This is called an early retest:

The peak does not need to be broken

Momentum resumption is detected before a full breakout

5. Trend Filter (Critical)

A BUY signal is allowed only if:

EMA50 is above EMA100

This filter ensures that signals are aligned with the broader trend structure and helps avoid counter-trend setups.

If the early retest occurs while this condition is not met, the setup is discarded permanently.

Signal Behavior

Only one BUY signal is generated per EMA20 trend cycle

After a signal (or a discarded setup), the indicator locks and waits for a new EMA20 cross

This design prevents repeated or clustered signals

Inputs Explained

Pullback Depth (%)
Defines how deep EMA20 must retrace from its peak before a retest is considered.

Early Retest Ratio
Defines how close EMA20 must return to its previous peak (default: 90%).

These parameters allow users to adapt the indicator to different timeframes or market conditions.

How to Use the Indicator

Indicator A is best used as:

A trend continuation confirmation tool

A confluence layer, combined with:

Higher timeframe analysis

Risk management rules

Personal trading plans

It is not designed to:

Predict market direction

Replace risk management

Act as a standalone trading system

Timeframes & Markets

The indicator can be applied to:

Forex

Crypto

Indices

Stocks

Performance and behavior may vary depending on:

Market volatility

Timeframe

EMA sensitivity

Users are encouraged to observe and test the indicator in their own environment.

Final Notes

This script is intentionally designed to be:

Rule-based

Conservative

Noise-resistant

All logic is deterministic and transparent.
There are no repainting elements.

Always evaluate indicators as part of a broader analytical framework.
Past behavior does not imply future results.

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.