Strategy vault / Trend following
Dynamic Multi Indicator Optimized Trend Following Strategy
This strategy is a multi-indicator trend following trading system that combines analysis across three dimensions: market trend, momentum, and volatility. The core logic uses the Ichimoku Cloud to determine market…

Overview
This strategy is a multi-indicator trend following trading system that combines analysis across three dimensions: market trend, momentum, and volatility. The core logic uses the Ichimoku Cloud to determine market trends, MACD histogram for momentum confirmation, Bollinger Band Width for market volatility filtering, while incorporating weekly timeframe trend confirmation, and managing risk through ATR-based dynamic stop-loss.
Strategy Principles
The strategy employs a multi-layer signal filtering mechanism: First, it determines the market trend by checking if price is above or below the Ichimoku Cloud's Leading Spans A and B; Second, it uses the MACD histogram to judge momentum strength, requiring the histogram to be greater than -0.05 for longs and less than 0 for shorts; Third, it incorporates a 50-period moving average on the weekly timeframe to confirm higher timeframe trend direction; Fourth, it uses Bollinger Band Width to filter low volatility conditions, only entering trades when the width exceeds 0.02. Stop-loss settings adapt to market volatility: using recent highs/lows in low volatility and ATR multipliers in high volatility conditions.
Strategy Advantages
- Multi-dimensional signal filtering: Effectively reduces false signals through combination of trend, momentum, and volatility indicators.
- Multi-timeframe analysis: Incorporates weekly trend confirmation to improve directional accuracy.
- Dynamic risk management: Adaptive stop-loss mechanism based on ATR and Bollinger Band Width that both protects profits and gives trends room to develop.
- Excellent backtesting results: Net profit 10.80%, profit factor 2.593, win rate 50.70%, maximum drawdown only 1.47%.
Strategy Risks
- Trend dependency: Strategy may generate frequent false signals in ranging markets.
- Parameter sensitivity: Multiple indicator parameters need optimization for different market conditions.
- Lag risk: Multiple signal filters may lead to delayed entries, missing part of the move.
- Backtesting limitations: Historical performance doesn't guarantee future results, live trading needs to consider slippage and fees.
Strategy Optimization Directions
- Signal system optimization: Can introduce other momentum indicators like RSI to enhance signal reliability.
- Position management optimization: Can dynamically adjust position size based on volatility.
- Take-profit optimization: Can add trailing stops or technical indicator-based profit targets.
- Market adaptability optimization: Dynamically adjust parameters for different market conditions.
Summary
The strategy builds a complete trend following system through multi-dimensional indicator fusion and multi-timeframe analysis, equipped with dynamic risk management mechanisms. While backtesting performance is excellent, attention must be paid to risks from changing market environments, and it's recommended to carefully validate and continuously optimize in live trading.
Source Pine Script
/*backtest
start: 2024-11-01 00:00:00
end: 2025-02-19 08:00:00
period: 2d
basePeriod: 2d
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © FIWB
//@version=6
strategy("Momentum Edge Strategy - 1D BTC Optimized", overlay=true)
// --- Input Parameters ---
atrLength = input.int(14, title="ATR Length")
atrMultiplier = input.float(1.5, title="ATR Multiplier")
bbWidthThreshold = input.float(0.02, title="Bollinger Band Width Threshold")
// --- Ichimoku Cloud ---
conversionLine = (ta.highest(high, 9) + ta.lowest(low, 9)) / 2
baseLine = (ta.highest(high, 26) + ta.lowest(low, 26)) / 2
leadingSpanA = (conversionLine + baseLine) / 2
leadingSpanB = (ta.highest(high, 52) + ta.lowest(low, 52)) / 2
priceAboveCloud = close > leadingSpanA and close > leadingSpanB
priceBelowCloud = close < leadingSpanA and close < leadingSpanB
// --- MACD Histogram ---
[_, _, macdHistogram] = ta.macd(close, 12, 26, 9)
// --- Multi-Timeframe Trend Confirmation ---
higherTFTrend = request.security(syminfo.tickerid, "W", close > ta.sma(close, 50))
// --- Bollinger Band Width ---
bbBasis = ta.sma(close, 20)
bbUpper = bbBasis + 2 * ta.stdev(close, 20)
bbLower = bbBasis - 2 * ta.stdev(close, 20)
bbWidth = (bbUpper - bbLower) / bbBasis
// --- ATR-based Stop Loss ---
atrValue = ta.atr(atrLength)
highestHigh = ta.highest(high, atrLength)
lowestLow = ta.lowest(low, atrLength)
longStopLoss = bbWidth < bbWidthThreshold ? lowestLow : close - atrValue * atrMultiplier
shortStopLoss= bbWidth < bbWidthThreshold ? highestHigh : close + atrValue * atrMultiplier
// --- Entry Conditions ---
longCondition = priceAboveCloud and macdHistogram > -0.05 and higherTFTrend and bbWidth > bbWidthThreshold
shortCondition = priceBelowCloud and macdHistogram < 0 and not higherTFTrend and bbWidth > bbWidthThreshold
// --- Strategy Execution ---
if longCondition
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", from_entry="Long", stop=longStopLoss)
if shortCondition
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", from_entry="Short", stop=shortStopLoss)
// --- Plotting ---
plot(leadingSpanA, color=color.new(color.green, 80), title="Leading Span A")
plot(leadingSpanB, color=color.new(color.red, 80), title="Leading Span B")
plotshape(series=longCondition ? close : na, title="Long Signal", location=location.belowbar, color=color.green)
plotshape(series=shortCondition ? close : na, title="Short Signal", location=location.abovebar, color=color.red)
Published by ianzeng123 on the FMZ strategy square · last modified 2025-02-21. 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/Dynamic-Multi-Indicator-Optimized-Trend-Following-Strategy.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
- Bollinger Bands and RSI Trend Following StrategyPine Script · Trend following · 1h
- Dual ATR Channel Trend Following StrategyPine Script · Trend following · 15m
- EMA and RSI Trend Trading StrategyPine Script · Trend following · 1d
- Going with the Trend Moving Average Crossover StrategyPine Script · Trend following · 1d
- Adaptive Dual Strategy System for Trend Following and Range TradingPine Script · Trend following · 1h
- Enhanced Moving Average Crossover Sakkoulas Trading StrategyPine Script · Trend following · 1h