Three Line Strike Momentum Trend Following Strategy with ADX Filter
This strategy is a trend-following trading system based on the Three-Line Strike pattern combined with ADX trend filtering. It identifies breakthrough patterns after three consecutive candlesticks in the same…

Overview
This strategy is a trend-following trading system based on the Three-Line Strike pattern combined with ADX trend filtering. It identifies breakthrough patterns after three consecutive candlesticks in the same direction, confirms trend strength using the ADX indicator, and sets dynamic take-profit and stop-loss levels using ATR. This approach ensures both signal reliability and effective risk control.
Strategy Principles
The core logic includes several key elements:
- Three-Line Strike Pattern Recognition: Bullish pattern requires three consecutive red candles followed by a larger green breakout candle; bearish pattern requires three consecutive green candles followed by a larger red breakout candle.
- ADX Trend Strength Confirmation: Uses the ADX indicator to judge current trend strength, generating trading signals only when ADX value exceeds the set threshold (default 25).
- ATR Dynamic Take-Profit and Stop-Loss: Uses ATR values to dynamically calculate take-profit and stop-loss positions, with TP set at 2x ATR and SL at 1x ATR.
- Trade Execution Logic: When pattern recognition and trend strength conditions are met, the system automatically executes position opening and sets corresponding TP/SL orders.
Strategy Advantages
- High Signal Reliability: Combines price patterns and trend indicators for dual confirmation, significantly improving trading signal reliability.
- Reasonable Risk Control: Uses ATR for dynamic TP/SL setting, adapting risk control parameters to market volatility.
- High Systematization: Clear strategy logic with adjustable parameters, suitable for systematic trading.
- Strong Adaptability: Applicable to different markets and timeframes with good universality.
Strategy Risks
- False Breakout Risk: May generate false breakout signals in ranging markets, leading to trading losses.
- Slippage Risk: Due to market order entries, significant slippage may occur in less liquid markets.
- Parameter Sensitivity: Strategy performance is sensitive to parameters like ADX threshold and ATR period, requiring optimization for different markets.
- Trend Dependency: Strategy may underperform in ranging markets, more suitable for trending market conditions.
Strategy Optimization Directions
- Pattern Recognition Enhancement: Add more price pattern validation conditions, such as considering candlestick body-to-wick ratios.
- Trend Confirmation Improvement: Introduce additional trend indicators like MACD or moving average crossovers for auxiliary confirmation.
- Take-Profit/Stop-Loss Optimization: Dynamically adjust ATR multipliers based on market characteristics or implement trailing stops.
- Trading Time Optimization: Add trading time filters to avoid trading during highly volatile market periods.
Summary
The Three-Line Strike Momentum Trend Following Strategy is a complete trading system combining classical price patterns and technical indicators. Through ADX trend filtering and ATR dynamic risk control, this strategy maintains trading opportunities while effectively controlling risk. Despite some limitations, through proper parameter optimization and strategy improvements, this strategy has good practical application value.
Source Pine Script
/*backtest
start: 2024-08-11 00:00:00
end: 2025-02-19 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
// Copyright ...
// Based on the TMA Overlay by Arty, converted to a simple strategy example.
// Pine Script v5
//@version=5
strategy(title='3 Line Strike [TTF] - Strategy with ATR and ADX Filter',
shorttitle='3LS Strategy [TTF]',
overlay=true,
initial_capital=100000,
default_qty_type=strategy.percent_of_equity,
default_qty_value=100,
pyramiding=0)
// -----------------------------------------------------------------------------
// INPUTS
// -----------------------------------------------------------------------------
// ATR and ADX Inputs
atrLength = input.int(title='ATR Length', defval=14, group='ATR & ADX')
adxLength = input.int(title='ADX Length', defval=14, group='ATR & ADX')
adxThreshold = input.float(title='ADX Threshold', defval=25, group='ATR & ADX')
// ### 3 Line Strike
showBear3LS = input.bool(title='Show Bearish 3 Line Strike', defval=true, group='3 Line Strike',
tooltip="Bearish 3 Line Strike (3LS-Bear) = 3 zelené sviečky, potom veľká červená sviečka (engulfing).")
showBull3LS = input.bool(title='Show Bullish 3 Line Strike', defval=true, group='3 Line Strike',
tooltip="Bullish 3 Line Strike (3LS-Bull) = 3 červené sviečky, potom veľká zelená sviečka (engulfing).")
// -----------------------------------------------------------------------------
// CALCULATIONS
// -----------------------------------------------------------------------------
// Calculate ATR
atr = ta.atr(atrLength)
// Calculate ADX components manually
tr = ta.tr(true)
plusDM = ta.change(high) > ta.change(low) and ta.change(high) > 0 ? ta.change(high) : 0
minusDM = ta.change(low) > ta.change(high) and ta.change(low) > 0 ? ta.change(low) : 0
smoothedPlusDM = ta.rma(plusDM, adxLength)
smoothedMinusDM = ta.rma(minusDM, adxLength)
smoothedTR = ta.rma(tr, adxLength)
plusDI = (smoothedPlusDM / smoothedTR) * 100
minusDI = (smoothedMinusDM / smoothedTR) * 100
dx = math.abs(plusDI - minusDI) / (plusDI + minusDI) * 100
adx = ta.rma(dx, adxLength)
// Helper Functions
getCandleColorIndex(barIndex) =>
int ret = na
if (close[barIndex] > open[barIndex])
ret := 1
else if (close[barIndex] < open[barIndex])
ret := -1
else
ret := 0
ret
isEngulfing(checkBearish) =>
sizePrevCandle = close[1] - open[1]
sizeCurrentCandle = close - open
isCurrentLargerThanPrevious = math.abs(sizeCurrentCandle) > math.abs(sizePrevCandle)
if checkBearish
isGreenToRed = (getCandleColorIndex(0) < 0) and (getCandleColorIndex(1) > 0)
isCurrentLargerThanPrevious and isGreenToRed
else
isRedToGreen = (getCandleColorIndex(0) > 0) and (getCandleColorIndex(1) < 0)
isCurrentLargerThanPrevious and isRedToGreen
isBearishEngulfing() => isEngulfing(true)
isBullishEngulfing() => isEngulfing(false)
is3LSBear() =>
is3LineSetup = (getCandleColorIndex(1) > 0) and (getCandleColorIndex(2) > 0) and (getCandleColorIndex(3) > 0)
is3LineSetup and isBearishEngulfing()
is3LSBull() =>
is3LineSetup = (getCandleColorIndex(1) < 0) and (getCandleColorIndex(2) < 0) and (getCandleColorIndex(3) < 0)
is3LineSetup and isBullishEngulfing()
// Signals
is3LSBearSig = is3LSBear() and adx > adxThreshold
is3LSBullSig = is3LSBull() and adx > adxThreshold
// Take Profit and Stop Loss
longTP = close + 2 * atr
longSL = close - 1 * atr
shortTP = close - 2 * atr
shortSL = close + 1 * atr
// -----------------------------------------------------------------------------
// STRATEGY ENTRY PRÍKAZY
// -----------------------------------------------------------------------------
if (showBull3LS and is3LSBullSig)
strategy.entry("3LS_Bull", strategy.long, comment="3LS Bullish")
strategy.exit("Exit Bull", from_entry="3LS_Bull", limit=longTP, stop=longSL)
if (showBear3LS and is3LSBearSig)
strategy.entry("3LS_Bear", strategy.short, comment="3LS Bearish")
strategy.exit("Exit Bear", from_entry="3LS_Bear", limit=shortTP, stop=shortSL)
Published by ianzeng123 on the FMZ strategy square · last modified 2025-02-20. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Three-Line-Strike-Momentum-Trend-Following-Strategy-with-ADX-Filter.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- Advanced Multi Indicator Trend Following and Momentum Quantitative Trading StrategyPine Script · Momentum · 1h
- Multi MA Trend Strength Capture with Momentum Profit Taking StrategyPine Script · Momentum · 2h
- Momentum and Moving Average Combination Long StrategyPine Script · Momentum · 2h
- Dynamic Momentum Weighted Moving Average Crossover StrategyPine Script · Momentum · 1h
- Multi Indicator Comprehensive Analysis Quantitative Trading Strategy Trend Momentum and Volatility Collaborative Prediction ModelPine Script · Momentum · 3m
- Dynamic Trend Momentum Crossover Strategy Quantitative Trading System Based on Dual EMA and MACD IndicatorsPine Script · Momentum · 1h