OPEN-SOURCE SCRIPT

Trend Surge with Pullback Filter

444
Trend Surge with Pullback Filter

Overview
Trend Surge with Pullback Filter is a price action-based strategy designed to enter strong trends not at the breakout, but at the first controlled pullback after a surge. It filters out noise by requiring momentum confirmation and low volatility conditions, aiming for better entry prices and reduced risk exposure.

How It Works

A strong upward trend is identified when the Rate of Change (ROC) exceeds a defined percentage (e.g., 2%).

Instead of jumping into the trend immediately, the strategy waits for a pullback: the price must drop at least 1% below its recent high (over the past 3 candles).

A low volatility environment is also required for entry — measured using ATR being below its 20-period average multiplied by a safety factor.

If all three conditions are met (trend + pullback + quiet volatility), the system enters a long position.

The trade is managed using a dynamic ATR-based stop-loss and a take-profit at 2x ATR.

An automatic exit occurs after 30 bars if neither SL nor TP is hit.

Key Features
- Momentum-triggered trend detection via ROC
- Smart pullback filter avoids overbought entries
- Volatility-based filter to eliminate noise and choppy conditions
- Dynamic risk-reward ratio with ATR-driven exit logic
- Time-limited exposure using bar-based exit

Parameter Explanation

ROC Length (10): Looks for short-term price surges

ROC Threshold (2.0%): Trend is considered valid if price increased more than 2%

Pullback Lookback (3): Checks last 3 candles for price retracement

Minimum Pullback % (1.0%): Entry only if price pulled back at least 1%

ATR Length (14): Measures current volatility

Low Volatility Multiplier (1.2): ATR must be below this multiple of its 20-period average

Risk-Reward (2.0): Target is set at 2x the stop-loss distance

Max Bars (30): Trade is closed automatically after 30 bars

Originality Statement
This strategy doesn’t enter at the trend start, unlike many momentum bots. Instead, it waits for the first market hesitation — a minor pullback under low volatility — before entering. This logic mimics how real traders often wait for a better entry after a breakout, avoiding emotional overbought buys. The combined use of ROC, dynamic pullback detection, and ATR-based environment filters makes it both practical and original for real-world trading.

Disclaimer
This strategy is intended for educational and research purposes. Backtest thoroughly and understand the logic before using with real capital.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.