Strategy vault / Trend following
Advanced Quantitative Trading Strategy Multi Dimensional Super Trend ATR Dynamic Tracking System
This strategy is a quantitative trading system based on multiple technical indicators, primarily driven by the SuperTrend indicator, combined with ATR dynamic stop-loss mechanism, and utilizing MACD, ADX, RSI, and…

Overview
This strategy is a quantitative trading system based on multiple technical indicators, primarily driven by the SuperTrend indicator, combined with ATR dynamic stop-loss mechanism, and utilizing MACD, ADX, RSI, and other indicators for multi-dimensional trend confirmation and risk control. The strategy employs a six-layer filtering mechanism to identify high-probability trading opportunities while incorporating triple divergence detection for early market risk warning.
Strategy Principles
The strategy uses SuperTrend indicator as its core, calculating trend direction through factor and ATR parameters. Entry signals must satisfy the following conditions:
- SuperTrend direction indication
- MACD histogram position verification
- ADX trend strength confirmation
- Candlestick pattern confirmation
- Volume expansion verification
- Triple divergence detection
The system implements ATR dynamic stop-loss for risk control and manages positions based on trend reversal signals.
Strategy Advantages
- Multi-dimensional indicator fusion improves signal reliability
- ATR dynamic stop-loss mechanism adapts to market volatility
- Triple divergence detection system provides risk warnings
- Volume verification ensures trading activity
- Gas fee filtering mechanism reduces transaction costs
- Complete visualization system facilitates strategy monitoring
Strategy Risks
- Multiple filters may cause missed trading opportunities
- Parameter optimization faces overfitting risks
- High market volatility periods may trigger frequent stop-losses
- Gas fee fluctuations may affect strategy returns
- Indicator combinations may generate chaotic signals in sideways markets
Strategy Optimization Directions
- Introduce market cycle recognition module for parameter adaptation
- Develop machine learning-based signal weighting system
- Optimize Gas fee prediction model for better timing
- Add transaction cost calculation module
- Develop volatility-based position management system
Summary
This strategy constructs a robust quantitative trading system through multi-dimensional indicator fusion and strict risk control. The modular design facilitates subsequent optimization and expansion, but parameter tuning and market adaptability need attention in practical applications. Innovative designs such as triple divergence warning and Gas fee filtering further enhance the strategy's practicality.
Source Pine Script
/*backtest
start: 2024-02-22 00:00:00
end: 2025-02-19 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=6
strategy("ETH Super trend enhancement strategy-Simplified version", overlay=true, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// ---------- Parameter configuration area ----------
// Super trend parameters
atrPeriod = input.int(8, "ATRtimeframe(8-10)", minval=8, maxval=10)
factor = input.float(3.5, "Multiplier(3.5-4)", minval=3.5, maxval=4, step=0.1)
// MACDParameters
fastLength = input.int(10, "MACDFast line cycle")
slowLength = input.int(21, "MACDSlow line cycle")
signalLength = input.int(7, "Signal line period")
// ADXParameters
adxLength = input.int(18, "ADXtimeframe")
adxThreshold = input.int(28, "ADXTrend Threshold")
// Volume verification
volFilterRatio = input.float(1.8, "Trading volume amplification multiple", step=0.1)
// ATRstop loss
atrStopMulti = input.float(2.2, "ATRStop Loss Multiplier", step=0.1)
// ---------- Core indicator calculations ----------
// 1. Supertrend (fixed index usage))
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
plot(supertrend, color=direction < 0 ? color.new(color.green, 0) : color.new(color.red, 0), linewidth=2)
// 2. MACDIndicator
[macdLine, signalLine, histLine] = ta.macd(close, fastLength, slowLength, signalLength)
macdCol = histLine > histLine[1] ? color.green : color.red
// 3. ADXTrend Strength
[DIMinus, DIPlus, ADX] = ta.dmi(adxLength, adxLength)
// 4. Volume verification
volMA = ta.sma(volume, 20)
volValid = volume > volMA * volFilterRatio
// 5. ATRDynamic Stop Loss
atrVal = ta.atr(14)
var float stopPrice = na
// ---------- Triple divergence detection ----------
// RSIDivergence Detection
rsiVal = ta.rsi(close, 14)
priceHigh = ta.highest(high, 5)
rsiHigh = ta.highest(rsiVal, 5)
divergenceRSI = high >= priceHigh[1] and rsiVal < rsiHigh[1]
// MACDHistogram Divergence
macdHigh = ta.highest(histLine, 5)
divergenceMACD = high >= priceHigh[1] and histLine < macdHigh[1]
// Volume Divergence
volHigh = ta.highest(volume, 5)
divergenceVol = high >= priceHigh[1] and volume < volHigh[1]
tripleDivergence = divergenceRSI and divergenceMACD and divergenceVol
// ---------- Signal generation logic ----------
// Bullish Condition(6Layer Filter)
longCondition =
direction < 0 and // Supertrend Bullish
histLine > 0 and // MACDBars Above Zero Line
ADX > adxThreshold and // Trend Strength Qualified
close > open and // Bull Candle Confirmation
volValid and // Volume verification
not tripleDivergence // No Triple Top Divergence
// Short conditions (simplified conditions))
shortCondition =
direction > 0 and // Supertrend Bearish
histLine < 0 and // MACDBars Below Zero Line
ADX > adxThreshold and // Trend Strength Qualified
close < open and // Bear Candle Confirmation
volValid and // Volume verification
tripleDivergence // Triple top divergence appears
// ---------- Trade Execution Module ----------
if (longCondition)
strategy.entry("Long", strategy.long)
stopPrice := close - atrVal * atrStopMulti
if (shortCondition)
strategy.entry("Short", strategy.short)
stopPrice := close + atrVal * atrStopMulti
// Trailing Stop Triggered
strategy.exit("Exit Long", "Long", stop=stopPrice)
strategy.exit("Exit Short", "Short", stop=stopPrice)
// Trend Reversal Exit
if (direction > 0 and strategy.position_size > 0)
strategy.close("Long")
if (direction < 0 and strategy.position_size < 0)
strategy.close("Short")
// ---------- Visual Prompt ----------
plotshape(longCondition, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Buy Signal")
plotshape(shortCondition, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Sell Signal")
plot(strategy.position_size != 0 ? stopPrice : na, color=color.orange, style=plot.style_linebr, linewidth=2, title="Dynamic Stop-loss Line")
// ---------- Alert System ----------
alertcondition(tripleDivergence, title="Triple top divergence warning", message="ETH has a triple top divergence!")
longCondition := longCondition 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/Advanced-Quantitative-Trading-Strategy-Multi-Dimensional-Super-Trend-ATR-Dynamic-Tracking-System.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
- Multi Dimensional Short Term Trend Predictor Technical Analysis and Volatility Adaptive Trading StrategyPine Script · Trend following · 1h
- Multi Indicator Dynamic Trend Following Strategy Based on EMA and SMAPine Script · Trend following · 1d
- Supertrend Advance StrategyPine Script · Trend following · 5m
- Supertrend and Moving Average Crossover StrategyPine Script · Trend following · 2h
- Trend Tracking and Short term Trading Strategy Based on ADX IndicatorPine Script · Trend following · 1d
- Dual EMA Crossover Trend Following Strategy with ATR and ADX FiltersPine Script · Trend following · 1d