0bps

Strategy vault / Trend following

Dynamic Dual Supertrend Volume Price Strategy

This is an advanced quantitative trading strategy that combines the Supertrend indicator with volume analysis. The strategy identifies potential trend reversal points by dynamically monitoring price crossovers with…

Author
ChaoZhang
Complexity
Starter · 51 lines
Parameters
0
Backtest bar
1d · swing
Tested on
BTC/USDT · futures

IMG

Overview

This is an advanced quantitative trading strategy that combines the Supertrend indicator with volume analysis. The strategy identifies potential trend reversal points by dynamically monitoring price crossovers with the Supertrend line and abnormal volume behavior. It employs dynamic stop-loss and take-profit settings based on the Average True Range (ATR), ensuring both trading flexibility and reliable risk control.

Strategy Principle

The core logic of the strategy is based on the following key elements:

  1. Uses the Supertrend indicator as the primary trend determination tool, calculated based on ATR for dynamic market volatility adaptation.
  2. Sets a 20-period moving average volume as benchmark, with a 1.5x threshold for volume anomaly detection.
  3. Triggers trading signals when price breaks through the Supertrend line and volume conditions are met.
  4. Implements dynamic stop-loss (1.5x ATR) and take-profit (3x ATR) settings for optimal risk-reward ratio.

Strategy Advantages

  1. High Signal Reliability: Combines trend and volume dimensions for confirmation, significantly reducing false signals.
  2. Comprehensive Risk Management: Uses dynamic stop-loss and take-profit settings that automatically adjust to market volatility.
  3. Strong Adaptability: Strategy parameters can be flexibly adjusted for different market environments and instruments.
  4. Clear Execution: Trading rules are precise with no subjective judgment factors, suitable for automated trading.

Strategy Risks

  1. Sideways Market Risk: May generate frequent false signals in range-bound markets.
  2. Slippage Risk: May face significant slippage losses during periods of abnormal volume.
  3. Parameter Sensitivity: Strategy performance is sensitive to parameter settings, requiring continuous optimization.
  4. Systemic Risk: Stop-loss settings may fail during periods of extreme market volatility.

Strategy Optimization Directions

  1. Introduce Trend Strength Filtering: Add ADX indicator to assess trend strength, only opening positions during strong trends.
  2. Optimize Volume Indicators: Consider using relative volume Rate of Change (ROC) instead of simple multiple judgments.
  3. Enhance Stop-Loss Mechanism: Implement trailing stop functionality for better profit protection.
  4. Add Time Filtering: Incorporate trading time window settings to avoid high volatility periods.

Summary

The strategy builds a reliable and adaptable trading system by combining the Supertrend indicator with volume analysis. Its strengths lie in multi-dimensional signal confirmation and dynamic risk management, though market conditions still influence strategy performance. Through continuous optimization and refinement, the strategy has the potential to maintain stable performance across different market environments.

Source Pine Script

/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-11 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Supertrend with Volume Strategy", overlay=true)

// Input parameters for Supertrend
atrLength = input(10, title="ATR Length")
multiplier = input(3.0, title="Multiplier")

// Calculate Supertrend
[supertrend, direction] = ta.supertrend(multiplier, atrLength)

// Plot Supertrend
plot(supertrend, color=direction == 1 ? color.green : color.red, title="Supertrend")

// Volume condition
volumeThreshold = input(1.5, title="Volume Threshold (x Average)")
avgVolume = ta.sma(volume, 20) // 20-period average volume
highVolume = volume > (avgVolume * volumeThreshold)

// Define entry conditions
longCondition = ta.crossover(close, supertrend) and highVolume
shortCondition = ta.crossunder(close, supertrend) and highVolume

// Execute trades
if (longCondition)
    strategy.entry("Long", strategy.long)

if (shortCondition)
    strategy.entry("Short", strategy.short)

// Optional: Add stop loss and take profit
stopLoss = input(1.5, title="Stop Loss (in ATRs)")
takeProfit = input(3.0, title="Take Profit (in ATRs)")

if (longCondition)
    strategy.exit("Take Profit/Stop Loss", from_entry="Long", 
                  limit=close + (takeProfit * ta.atr(atrLength)), 
                  stop=close - (stopLoss * ta.atr(atrLength)))

if (shortCondition)
    strategy.exit("Take Profit/Stop Loss", from_entry="Short", 
                  limit=close - (takeProfit * ta.atr(atrLength)), 
                  stop=close + (stopLoss * ta.atr(atrLength)))

Published by ChaoZhang on the FMZ strategy square · last modified 2024-12-13. 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.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Dynamic-Dual-Supertrend-Volume-Price-Strategy.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. 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

esc

Try , , or .

↑↓ move↵ open