Strategy vault / Trend following
Adaptive Triple Supertrend Strategy
The Adaptive Triple Supertrend Strategy is a trend-following trading approach that harnesses the power of three Supertrend indicators to identify potential market trends and capitalize on them. With a focus on…

Overview
The Adaptive Triple Supertrend Strategy is a trend-following trading approach that harnesses the power of three Supertrend indicators to identify potential market trends and capitalize on them. With a focus on adaptability and precision, this strategy aims to provide traders with clear entry and exit signals while managing risk effectively. By combining multiple Supertrend indicators with defined parameters, the strategy seeks to capture trends across various market conditions, making it a versatile tool for traders seeking profitable opportunities in both traditional and cryptocurrency markets.
Strategy Logic
The core idea behind the Adaptive Triple Supertrend Strategy is to combine multiple Supertrend indicators to identify market trends, go long when the trends agree, and exit positions when trends reverse.
Specifically, the strategy utilizes three Supertrend indicators:
- Supertrend 1: ATR Period = 12, Factor = 3
- Supertrend 2: ATR Period = 10, Factor = 1
- Supertrend 3: ATR Period = 11, Factor = 2
When all three Supertrend indicators simultaneously show a bullish (green) signal, the strategy will open a long position within a defined date range (Jan 1, 2023 to Oct 1, 2023). When any one of the Supertrend indicators shows a bearish (red) signal, the strategy will exit the long position. In addition, the strategy sets a 10% take profit and 1% stop loss to lock in profits and manage risk.
So the specific trade logic is:
- Open long when all three Supertrends show bullish signals within the date range
- Monitor Supertrends for reversal signals while in a long position
- Exit long if any Supertrend turns bearish
- Take profit at 10% or stop loss at 1%
This logic aims to capture profits from bull trends within the date range while controlling downside risk with the stop loss.
Advantage Analysis
The Adaptive Triple Supertrend Strategy has several key advantages:
- Combining multiple Supertrends gives more accurate trend judgement and reduces false signals
- Supertrend itself filters noise, reducing oscillation impacts
- Parameters can be tuned to adapt to different market environments
- Take profit and stop loss settings lock in profits and cut losses when trends reverse
- Can capture outsized gains in bull markets and avoid huge drawdowns in bear markets
In summary, this strategy works excellently as a core trend following strategy to assist manual trading. By providing high quality trade signals to profit from major trends while controlling risk, it is an important tool for quantitative trading.
Risk Analysis
Despite its many strengths, the Adaptive Triple Supertrend Strategy has some key risks to note:
- Huge market swings can cause wrong signals
- Poor parameter tuning impacts performance
- Small stop loss may fail to control risk
- Bad long entry timing can lead to losses
These risks can be mitigated by:
- Adding other indicators to judge oscillations
- Optimizing parameters for different markets
- Increasing stop loss percentage to ensure effectiveness
- Using more stable indicators for entry signals
Enhancement Opportunities
As a versatile trend following strategy, the Adaptive Triple Supertrend has much room for enhancement:
- Dynamic optimization of Supertrend parameters
- Adding other indicators to improve entry timing
- Further optimizing take profit and stop loss based on backtests
- Trying breakout for entry with Supertrend for trend direction
- Packaging strategy as function for easy plug-and-play
With these optimizations, the strategy can maintain steady performance across more market environments and achieve higher profit factors. This presents exciting research directions going forwards.
Conclusion
The Adaptive Triple Supertrend Strategy is a valuable quantitative strategy. By combining multiple Supertrend indicators to determine trends and setting take profit/stop loss to control risk, it aims to steadily track major trends for outsized gains. Despite some risks, these can be alleviated via parameter optimization and auxiliary indicators. The strategy can be used standalone or combined with others. It also has significant enhancement potential for even better performance. As such, this is a quality strategy worth continual research and application.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_float_1 | 3 | Factor 1 |
| v_input_1 | 12 | ATR Length 1 |
| v_input_float_2 | true | Factor 2 |
| v_input_2 | 10 | ATR Length 2 |
| v_input_float_3 | 2 | Factor 3 |
| v_input_3 | 11 | ATR Length 3 |
Source Pine Script
/*backtest
start: 2023-01-25 00:00:00
end: 2024-01-25 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Custom Supertrend Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=15, shorttitle="Supertrend Strategy")
// Define the parameters for Supertrend 1
factor1 = input.float(3.0, "Factor 1", step = 0.01)
atrPeriod1 = input(12, "ATR Length 1")
// Define the parameters for Supertrend 2
factor2 = input.float(1.0, "Factor 2", step = 0.01)
atrPeriod2 = input(10, "ATR Length 2")
// Define the parameters for Supertrend 3
factor3 = input.float(2.0, "Factor 3", step = 0.01)
atrPeriod3 = input(11, "ATR Length 3")
[_, direction1] = ta.supertrend(factor1, atrPeriod1)
[_, direction2] = ta.supertrend(factor2, atrPeriod2)
[_, direction3] = ta.supertrend(factor3, atrPeriod3)
// Define the start and end dates as Unix timestamps (in seconds)
start_date = timestamp("2023-01-01T00:00:00")
end_date = timestamp("2023-10-01T00:00:00")
// Determine Buy and Sell conditions within the specified date range
in_date_range = true
buy_condition = direction1 > 0 and direction2 > 0 and direction3 > 0 and in_date_range
sell_condition = direction1 < 0 or direction2 < 0 or direction3 < 0
// Track the position with a variable
var isLong = false
if buy_condition and not isLong
strategy.entry("Long Entry", strategy.long)
isLong := true
if sell_condition and isLong
// Define take profit and stop loss percentages
take_profit_percentage = 10 // Increased to 10%
stop_loss_percentage = 1
// Calculate take profit and stop loss levels
take_profit_level = close * (1 + take_profit_percentage / 100)
stop_loss_level = close * (1 - stop_loss_percentage / 100)
// Exit the long position with take profit and stop loss
strategy.exit("Take Profit/Stop Loss", from_entry="Long Entry", limit=take_profit_level, stop=stop_loss_level)
isLong := falsePublished by ChaoZhang on the FMZ strategy square · last modified 2024-01-26. 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/Adaptive-Triple-Supertrend-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
- Advanced Supertrend Indicator Trading Mechanism Optimization StrategyPine Script · Trend following · 1d
- Dynamic Trend Following SuperTrend Triple Enhancement StrategyPine Script · Trend following · 1d
- Heiken Ashi and Super Trend Combination StrategyPine Script · Trend following · 1d
- Multi Indicator Dynamic Trend Following Strategy Based on EMA and SMAPine Script · Trend following · 1d
- Multi Period SuperTrend Dynamic Trading StrategyPine Script · Trend following · 1d
- Precision Trading Strategy and Risk Management System Based on SuperTrend IndicatorPine Script · Trend following · 1d