PROTECTED SOURCE SCRIPT
Mis à jour

Sharp Pullback/Profit Taking Detector (ATH)

38
SP_ATH Alert: Early Warning for Gold Pullbacks
Tired of being caught by sharp profit-taking when Gold hits a new All-Time High?

The Sharp Pullback / Profit Taking Detector (SP_ATH Alert) is a powerful Pine Script V5 indicator designed to give you an early warning signal before a rapid market reversal (pullback or significant profit-taking) occurs. It specifically focuses on identifying the critical confluence of weak buying momentum and aggressive selling pressure near recent price peaks.

How the Code Works: A Triple-Filter System
This indicator combines three primary technical analysis categories to filter out noise and generate high-confidence signals:

1. Candlestick Confirmation (The First Clues)
This section detects immediate bearish intent on the chart:

Bearish Pin Bar (Shooting Star): Checks for a long Upper Wick (seller rejection) and a small body, signaling that buyers attempted to push the price up but were immediately overwhelmed by sellers.

Bearish Engulfing: Identifies a large red candle whose body completely engulfs the preceding green candle's body. This represents a clear, aggressive shift in momentum from buying to selling dominance.

2. Price Action & Context Filter (The Warning Signs)
The indicator ensures the pattern occurs in a high-risk, high-reward environment:

Near All-Time High (isNearATH): The signal is only valid if the price is trading near a recent price peak (defined by the athLookback period), where profit-taking is most likely to be severe.

Large Red Bar: Confirms the signal by looking for an aggressive bearish bar whose total range is significantly larger than the average market movement (using ATR).

Weak Higher High (isWeakHH): Detects Exhaustion by identifying a new high with a disproportionately small candle body relative to its upper wick, indicating buyers are losing conviction.

3. Momentum & Indicator Signals (The Undercurrent)
The script uses the RSI (Relative Strength Index) to confirm weakening momentum:

RSI Bearish Divergence: Compares recent price pivots (Higher Highs) with RSI pivots (Lower Highs). This classic signal confirms that the buying momentum is fading, even though the price is still ticking higher.

RSI Breakdown: Triggers when the RSI was previously in the Overbought Zone (above 70) and now breaks down below the 70 level and crosses below its own Exponential Moving Average (EMA), confirming the start of bearish momentum.

Invitation to Use
By requiring a combination of these factors, the SP_ATH Alert provides a robust, multi-layered alert system. Add this indicator to your Gold (XAUUSD) chart on a lower timeframe (e.g., 10-minute or 15-minute) to proactively manage risk and identify potential short entry points during periods of extreme bullish euphoria.
Notes de version
Change iCon Size
Notes de version
The core modification addresses the condition for identifying the price context, changing it from a strict All-Time High (ATH) match to a flexible Percentage Range from ATH. This allows the indicator to trigger signals not just at the absolute peak, but also during the crucial phase when the price is near the peak and profit-taking is imminent.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.