PROTECTED SOURCE SCRIPT
Aktualisiert

Pullback 2 EMAs

18
Pullback 2 EMAs [Smart Trend System]

Description:
This indicator is a complete Trend Following System designed to catch high-probability entries during market corrections (pullbacks).

Unlike simple crossover indicators, this script uses a "State Machine" logic: it waits for the price to physically touch the moving averages ("Arming the setup") and only triggers a signal when the price proves momentum by closing back in the trend direction, validated by the Stoch RSI.

🔥 Key Features:

1. Hybrid Entry Logic (Adaptive) The system differentiates between two types of corrections:

🐋 Deep Pullback: When price touches the Slow EMA (100). The system becomes aggressive, accepting a close above either the Slow or Fast EMA to catch the reversal early.

⚡ Shallow Pullback: When price touches only the Fast EMA (20). The system is conservative and requires a close specifically back above the Fast EMA.

2. Smart Signal Filtering (Anti-Spam)

Structural Filter: If a signal is generated, the indicator "remembers" the low/high of that specific pullback. It will block repetitive signals in the same zone unless the price creates a new structure (i.e., breaks the previous pullback low/high), acting like a "virtual stop loss" reset.

Stoch RSI Validation: Signals are only generated if the Stoch RSI (25, 25, 3) confirms the move (Oversold for Longs, Overbought for Shorts).

3. "Touch & Reset" Safety Mechanism

The system requires a fresh touch on the EMA to arm a trade. If the price recovers and closes above the Fast EMA without triggering a signal (e.g., due to filtering), the system disarms immediately. It forces the price to dip and touch the EMA again to generate a new valid opportunity.

4. No Repainting Trend Detection

Trend direction is defined using a 1-candle offset on the EMAs to ensure stability and prevent the trend from flipping deceptively during the open candle.

⚙️ Default Settings:

Fast EMA: 20

Slow EMA: 100

Stoch RSI: 25, 25, 3 (Levels 80/20)

🔔 Alerts:

Includes dynamic alerts that automatically report the signal direction and the current Timeframe (e.g., "Long Signal [15]").

Trade with the trend, not against it.
Versionshinweise
This indicator is a robust trend-following tool designed to identify high-probability pullback setups. It combines exponential moving averages (EMAs) for trend direction with a specific "Trigger EMA" logic to pinpoint precise entry moments after a correction.

How it Works

Trend Identification:

The trend is determined by two EMAs with a visual offset: a Fast EMA (default 21) and a Slow EMA (default 100).

Uptrend: Fast EMA > Slow EMA.

Downtrend: Fast EMA < Slow EMA.

The Setup (State Machine):

Arming: In an uptrend, the indicator waits for the price (Low) to touch the Fast EMA (Blue line). This signals that a pullback is occurring.

Triggering: Once armed, the indicator waits for a candle to close above the Trigger EMA (Yellow line, EMA 3 offset 3). This confirms the resumption of the trend.

Signal: A green triangle marks the entry candle.

Smart Filters:

Sequence Filter: To prevent signal spamming during choppy consolidation, the indicator includes a sequence reset logic. After a signal is fired, a new signal can only occur if the price "breathes" (closes back across the Trigger EMA), ensuring you don't get multiple repetitive signals in the same immediate leg.

Stoch RSI Filter (Optional): You can enable a filter that only validates signals if the Stochastic RSI is in (or recently exited) an Oversold/Overbought zone.

Visual Features

Background Coloring: Highlights Oversold (Green background) and Overbought (Red background) zones based on Stochastic RSI, helping visually identify ideal reversal areas.

Clean Signals: Small triangles indicate valid entries (Green for Long, Red for Short).

Settings

Trend Configuration: Customize the periods of the Fast and Slow EMAs.

Stochastic Filter: Toggle background painting and enable/disable the signal filter based on Overbought/Oversold zones.

Alerts

Includes dynamic alert messages compatible with "Any alert() function call", sending the Ticker and Timeframe directly in the notification.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.