Strategy vault / Trend following
Multi Dimensional Trend Following Strategy with Volatility Adaptive Stop Loss
This strategy is a multi-dimensional trading system that combines trend following, momentum indicators, and adaptive stop-loss mechanisms. It identifies market trends using the SuperTrend indicator, confirms trades…

Overview
This strategy is a multi-dimensional trading system that combines trend following, momentum indicators, and adaptive stop-loss mechanisms. It identifies market trends using the SuperTrend indicator, confirms trades with RSI momentum indicator and moving average system, and implements dynamic stop-loss management using ATR volatility indicator. This multi-dimensional analysis approach effectively captures market trends while maintaining reasonable risk control.
Strategy Principles
The core logic is based on three dimensions:
- Trend Identification: Uses SuperTrend indicator (Parameters: ATR length 14, multiplier 3.0) as the primary trend determination tool. When SuperTrend turns green, it indicates a potential uptrend.
- Momentum Confirmation: Uses RSI indicator (Parameter: length 14) to avoid entering at overbought levels. RSI below 65 suggests the market is not overbought.
- Trend Validation: Uses 50-period Simple Moving Average (SMA) as additional trend confirmation. Price must be above the moving average to consider entry.
Buy conditions require: SuperTrend bullish (green) + RSI < 65 + Price above 50-period SMA. Sell condition: Exit when SuperTrend turns bearish. Stop-loss management: Uses ATR-based trailing stop, with stop distance set at 1.5 times ATR value.
Strategy Advantages
- Multi-dimensional Analysis: Combines multiple technical indicators to enhance signal reliability.
- Strong Adaptability: ATR-based stop-loss automatically adjusts according to market volatility.
- Comprehensive Risk Control: Trailing stop mechanism protects profits while allowing trends to develop.
- Reasonable Parameter Settings: Indicator parameters align with market dynamics, such as using 65 as RSI threshold instead of traditional 70.
- Clear Code Structure: Strategy code is highly modularized, facilitating maintenance and optimization.
Strategy Risks
- Choppy Market Risk: May generate frequent false signals in range-bound markets.
- Slippage Risk: Trailing stops may experience price deviation due to slippage in fast-moving markets.
- Parameter Sensitivity: Strategy performance is sensitive to SuperTrend and RSI parameter settings.
- Delay Risk: Lagging indicators like moving averages may cause delayed entries and exits.
Strategy Optimization Directions
- Market Environment Adaptation: Add volatility filters to adjust stop multipliers in high volatility environments.
- Entry Optimization: Consider adding volume confirmation indicators to improve entry signal reliability.
- Position Management: Introduce ATR-based dynamic position sizing system for adaptive risk exposure adjustment.
- Timeframe Optimization: Test performance across different timeframes to select optimal time periods.
- Dynamic Parameter Adjustment: Research methods for dynamic parameter optimization to improve strategy adaptability across different market conditions.
Summary
This strategy constructs a logically complete trading system through the comprehensive use of trend following, momentum, and moving average systems. Its strengths lie in its multi-dimensional signal confirmation mechanism and comprehensive risk control system. Through the provided optimization directions, there is room for further improvement. The key is to enhance its adaptability across different market conditions while maintaining the strategy's core logic.
Source Pine Script
/*backtest
start: 2025-01-08 00:00:00
end: 2025-02-07 00:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Gladston_J_G
//@version=5
strategy("Trend Strategy with Stop Loss", overlay=true, margin_long=100, margin_short=100)
// ---- Inputs ---- //
atrLength = input(14, "ATR Length")
supertrendMultiplier = input(3.0, "Supertrend Multiplier")
rsiLength = input(14, "RSI Length")
maLength = input(50, "MA Length")
trailOffset = input(1.5, "Trailing Stop ATR Multiplier")
// ---- Indicators ---- //
// Supertrend for trend direction
[supertrend, direction] = ta.supertrend(supertrendMultiplier, atrLength)
// RSI for momentum filter
rsi = ta.rsi(close, rsiLength)
// Moving Average for trend confirmation
ma = ta.sma(close, maLength)
// ATR for volatility-based stop loss
atr = ta.atr(atrLength)
// ---- Strategy Logic ---- //
// Buy Signal: Supertrend bullish + RSI not overbought + Price above MA
buyCondition = direction < 0 and rsi < 65 and close > ma
// Sell Signal: Supertrend turns bearish
sellCondition = direction > 0
// ---- Stop Loss & Trailing ---- //
stopPrice = close - (atr * trailOffset)
var float trail = na
if buyCondition and strategy.position_size == 0
trail := stopPrice
else
trail := math.max(stopPrice, nz(trail[1]))
// ---- Execute Orders ---- //
strategy.entry("Long", strategy.long, when=buyCondition)
strategy.close("Long", when=sellCondition)
strategy.exit("Trail Exit", "Long", stop=trail)
// ---- Visuals ---- //
plot(supertrend, "Supertrend", color=direction < 0 ? color.green : color.red)
plot(ma, "MA", color=color.blue)
plot(strategy.position_size > 0 ? trail : na, "Trailing Stop", color=color.orange, style=plot.style_linebr)
// ---- Alerts ---- //
plotshape(buyCondition, "Buy", shape.triangleup, location.belowbar, color.green, size=size.small)
plotshape(sellCondition, "Sell", shape.triangledown, location.abovebar, color.red, size=size.small)
plot(close)
Published by ChaoZhang on the FMZ strategy square · last modified 2025-02-08. 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/Multi-Dimensional-Trend-Following-Strategy-with-Volatility-Adaptive-Stop-Loss.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 Indicator Fusion Automated Trading System SuperTrend ATR RSI Dynamic Risk Control StrategyPine Script · Trend following · 1d
- Intelligent Multi Dimensional Adaptive Trend Trading SystemPine Script · Trend following · 1h
- EMA RSI Supertrend Multi Factor Convergence Strategy with Volume Confirmation EMA RSI Supertrend Multi Factor Convergence Strategy with Volume ConfirmationPine Script · Trend following · 1d
- Optimized ATR Based Trend Strategy v6 Fixed Trend CapturePine Script · Trend following · 1d
- Fixed Range Volume Profile And Anchored VWAP Trend Identification Strategy With Dynamic Stop LossPine Script · Trend following · 1h
- Supertrend Advance StrategyPine Script · Trend following · 5m