Overview
This strategy is a comprehensive technical analysis trading system that identifies high-probability swing trading opportunities by integrating multiple indicators. The system primarily utilizes the SuperTrend indicator as a trend direction filter, combines ADX (Average Directional Index) to confirm trend strength, and employs Liquidity Delta to analyze buying and selling pressure imbalances, thereby generating precise entry and exit signals across various market environments. The strategy adopts a conservative risk management approach, setting fixed percentage-based stop losses (default 2%) and take profits (default 4%) to ensure a favorable risk-reward ratio. The system is designed for daily timeframe swing trading in cryptocurrencies, forex, or stock indices, particularly suitable for assets with clear trending behavior and sufficient volatility.
Strategy Principles
The strategy works through the collaborative operation of four core indicators to form trading signals:
SuperTrend Indicator: Acts as the primary trend direction filter with optimized settings (Factor: 3.0, ATR Period: 10) to balance responsiveness and reliability. When the price is above the SuperTrend line, it identifies an uptrend; when the price is below the SuperTrend line, it identifies a downtrend.
ADX Indicator: Used to confirm the strength of the current trend, filtering out sideways or choppy market conditions. The strategy employs a custom implementation, calculating true range, positive and negative directional movements, ultimately generating the ADX value. When the ADX value exceeds the set threshold (default 25), it indicates a strong trend, and the system is more inclined to generate trading signals.
Liquidity Delta Indicator: Analyzes volume buying and selling pressure imbalances, calculating bid volume and ask volume, and obtaining the final delta value through a series of normalization and smoothing processes. When the delta value exceeds the positive threshold, it generates a long signal; when it falls below the negative threshold, it generates a short signal, thereby validating trend direction and potential reversals.
PSAR Indicator (Optional): Can serve as additional confirmation for trend changes, disabled by default to reduce signal filtering. When the price is above the PSAR point, it is viewed as an uptrend; when the price is below the PSAR point, it is viewed as a downtrend.
The trading logic generates comprehensive signals by combining all activated indicators. Only when all indicators point in the same direction will the final buy or sell signal be produced. For example, the system only generates a buy signal when the PSAR condition, SuperTrend condition, ADX condition, and Liquidity Delta condition all satisfy the long requirements. Additionally, the strategy allows users to select trading direction (long-only, short-only, or bidirectional trading) to adapt to different market environments or account restrictions.
Strategy Advantages
This strategy offers several significant advantages:
Multi-dimensional Confirmation System: By integrating different types of technical indicators, it confirms trades across multiple dimensions including trend, strength, and volume, significantly reducing the risk of false signals and improving trading accuracy.
High Adaptability: The strategy allows users to flexibly choose trading direction and enable/disable specific indicators, enabling the system to adapt to various market conditions and different trading instruments.
Strict Risk Control: Built-in fixed percentage-based stop loss and take profit mechanisms ensure that each trade has predefined risk limits and profit targets, effectively protecting capital safety.
Consideration of Realistic Trading Costs: The strategy model includes commission (0.035%) and slippage (2 points) calculations, making backtesting results more aligned with real trading environments.
Visualized Trading Signals: Provides clear buy/sell signal arrows with customizable sizes, facilitating quick identification on charts.
Information Panel: Dynamically displays currently active indicators and risk settings, providing immediate feedback on strategy operation status.
Conservative Position Management: Default uses 5% of equity as position size for each trade, avoiding capital losses due to excessive trading.
Strategy Risks
Despite the comprehensive design of this strategy, there are still the following potential risks:
Parameter Sensitivity: Strategy performance is highly dependent on indicator parameter settings, especially the SuperTrend factor and ADX threshold. Different market environments may require different parameter optimizations; otherwise, it may lead to overtrading or missing important opportunities.
Lag Risk: Due to the use of multiple moving average-type indicators, signals may experience some lag, resulting in untimely entry or exit in rapidly reversing markets.
Correlation Risk: There may be inherent correlations between multiple technical indicators, meaning seemingly independent confirmations may come from indicators based on similar mathematical models, reducing the actual value of multiple confirmations.
Overfitting Risk: Performing well during the 2021-2033 backtesting period does not necessarily mean it will be equally effective in future markets, especially if these parameters are the result of overfitting to historical data.
Solutions:
- Regularly reassess and adjust indicator parameters to ensure they remain applicable to the current market environment
- Consider adding indicators based on different principles, such as sentiment indicators or fundamental indicators, to reduce correlation between technical indicators
- Implement dynamic stop-loss strategies, such as trailing stops, to better adapt to market fluctuations
- Conduct live testing with small capital, gradually validating strategy performance under different market conditions
Strategy Optimization Directions
The strategy can be optimized in the following aspects:
Dynamic Parameter Adjustment: Implement a mechanism to automatically adjust SuperTrend factors and ADX thresholds based on market volatility, allowing the strategy to better adapt to different market environments. For example, use smaller SuperTrend factors in low-volatility markets and larger factors in high-volatility markets.
Time Filters: Add time-based filtering mechanisms to avoid trading during known low-liquidity or high-volatility periods, such as weekends in cryptocurrency markets or important economic data release periods in forex markets.
Multi-timeframe Analysis: Integrate higher timeframe trend confirmation, for example, only entering trades when the daily trend direction aligns with the current trading timeframe. This can significantly improve the strategy's win rate.
Intelligent Stop-Loss Strategy: Replace fixed percentage stop-losses with dynamic stops based on ATR or support/resistance levels, better reflecting actual market volatility conditions and reducing stop-losses triggered by market noise.
Additional Entry Filtering Conditions: Consider adding filtering conditions such as RSI overbought/oversold judgments or Bollinger Band boundary tests, entering only at more favorable price levels to improve entry quality.
Capital Management Optimization: Implement dynamic position management based on current strategy performance and market conditions, gradually increasing positions when the strategy performs well and reducing positions when uncertainty increases.
Machine Learning Enhancement: Utilize machine learning techniques to optimize indicator weight allocation, automatically adjusting the importance of each indicator in final signal formation according to different market environments.
Summary
The Multi-Indicator Dynamic Trend Trading Strategy constructs a comprehensive and flexible trading system by integrating multiple technical indicators such as SuperTrend, ADX, and Liquidity Delta, suitable for swing trading in various market environments. The core advantages of this strategy lie in its multi-dimensional signal confirmation mechanism and strict risk management framework, effectively filtering market noise and protecting trading capital. However, users need to be aware of potential risks such as parameter sensitivity and indicator lag, and regularly reassess strategy performance.
By implementing the suggested optimization directions, such as dynamic parameter adjustments, multi-timeframe analysis, and intelligent stop-loss strategies, the system has the potential to further improve its profitability and stability. Ultimately, this strategy provides quantitative traders with a solid framework that can be customized and expanded according to individual risk preferences and market views.
Strategy source code
/*backtest
start: 2025-01-27 00:00:00
end: 2025-05-14 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_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/
// © TiamatCrypto
//@version=6
// ====================================================================================
// Multi-Indicator Swing Trading Strategy [TIAMATCRYPTO]v6
// ====================================================================================
// DESCRIPTION:
// This strategy uses a combination of technical indicators to identify swing trading
// opportunities in various markets. The default settings are optimized for daily
// timeframes on cryptocurrency and forex markets.
//
// RECOMMENDED DEFAULT SETTINGS:
// - Trading direction: Both (performs well in trending and ranging markets)
// - Position size: 5% (conservative position sizing to manage risk)
// - Stop Loss: 2% (conservative risk management for capital preservation)
// - Take Profit: 4% (realistic profit target with 1:2 risk-reward ratio)
// - Initial capital: $10,000 (realistic starting account size)
// - Timeframe: 2m (best performance on 2m charts)
// - Testing period: 2021-2033 (provides sufficient sample size of trades)
// ====================================================================================
strategy("Multi-Indicator Swing [TIAMATCRYPTO]v6", overlay=true,
default_qty_type=strategy.percent_of_equity, default_qty_value=5,
initial_capital=10000, commission_type=strategy.commission.percent,
commission_value=0.035, slippage=2)
// === BASIC SETTINGS ===
// Backtesting time period set directly in the code for realistic testing
var startDateInput = timestamp("2021-01-01T00:00:00")
var endDateInput = timestamp("2033-12-31T23:59:59")
var inDateRange = time >= startDateInput and time <= endDateInput
// Trading direction settings
tradeDirection = input.string("Both", "Trading Direction", options=["Long Only", "Short Only", "Both"], group="Basic Settings")
// === INDICATOR SWITCHES ===
// PSAR is now disabled by default
usePSAR = input.bool(false, "Use PSAR", group="Indicator Switches")
useSupertrend = input.bool(true, "Use Supertrend", group="Indicator Switches")
useADX = input.bool(true, "Use ADX", group="Indicator Switches")
useLiquidityDelta = input.bool(true, "Use Liquidity Delta", group="Indicator Switches")
// === INDICATOR SETTINGS SECTION ===
// PSAR Settings
// Default PSAR settings are conservative and work well across multiple markets
psarStart = input.float(0.02, "PSAR Initial Value", minval=0.01, maxval=0.1, step=0.01, group="PSAR Settings")
psarIncrement = input.float(0.02, "PSAR Increment", minval=0.01, maxval=0.1, step=0.01, group="PSAR Settings")
psarMaximum = input.float(0.2, "PSAR Maximum", minval=0.1, maxval=0.5, step=0.05, group="PSAR Settings")
// Supertrend Settings
// Factor 3.0 provides a good balance between sensitivity and false signals
atrPeriod = input.int(10, "SuperTrend ATR Period", minval=1, maxval=50, group="SuperTrend Settings")
factor = input.float(3.0, "SuperTrend Multiplier", minval=1, maxval=10, step=0.1, group="SuperTrend Settings")
// ADX Settings
// ADX threshold of 25 is standard for identifying strong trends
adxLength = input.int(14, "ADX Length", minval=1, maxval=50, group="ADX Settings")
adxThreshold = input.int(25, "ADX Trend Strength Threshold", minval=10, maxval=50, group="ADX Settings")
// Liquidity Delta Settings
// These settings help identify significant volume imbalances for trend confirmation
deltaLength = input.int(14, "Liquidity Delta Length", minval=1, maxval=50, group="Liquidity Delta")
deltaSmooth = input.int(3, "Delta Smoothing", minval=1, maxval=20, group="Liquidity Delta")
deltaThreshold = input.float(0.5, "Delta Signal Threshold", minval=0.1, maxval=5, step=0.1, group="Liquidity Delta")
// Risk Management Settings
// Conservative settings to ensure capital preservation
useStopLoss = input.bool(true, "Use Stop Loss", group="Risk Management")
useTakeProfit = input.bool(true, "Use Take Profit", group="Risk Management")
stopLossPercent = input.float(2.0, "Stop Loss (%)", minval=0.5, maxval=5, step=0.1, group="Risk Management")
takeProfitPercent = input.float(4.0, "Take Profit (%)", minval=1.0, maxval=10, step=0.1, group="Risk Management")
// Visualization Settings
signalSize = input.string("Normal", "Signal Size", options=["Small", "Normal", "Large"], group="Visualization")
buyColor = input.color(color.green, "Buy Signal Color", group="Visualization")
sellColor = input.color(color.red, "Sell Signal Color", group="Visualization")
// === INDICATOR CALCULATIONS ===
// All remaining indicators set to initialize as true when their respective switch is off
// PSAR Calculations
psar = ta.sar(psarStart, psarIncrement, psarMaximum)
psarCondition = not usePSAR or (close > psar)
psarSellCondition = not usePSAR or (close < psar)
// Supertrend Calculations
[supertrendValue, supertrendDirection] = ta.supertrend(factor, atrPeriod)
supertrendCondition = not useSupertrend or (supertrendDirection > 0)
supertrendSellCondition = not useSupertrend or (supertrendDirection < 0)
// ADX Calculations - custom implementation
trueRange = math.max(high - low, math.abs(high - close[1]), math.abs(low - close[1]))
smoothedTrueRange = ta.sma(trueRange, adxLength)
dmPlus = high > high[1] ? math.max(high - high[1], 0) : 0
dmMinus = low[1] > low ? math.max(low[1] - low, 0) : 0
smoothedDmPlus = ta.sma(dmPlus, adxLength)
smoothedDmMinus = ta.sma(dmMinus, adxLength)
diPlus = smoothedTrueRange > 0 ? 100 * smoothedDmPlus / smoothedTrueRange : 0
diMinus = smoothedTrueRange > 0 ? 100 * smoothedDmMinus / smoothedTrueRange : 0
dx = (diPlus + diMinus) > 0 ? math.abs(diPlus - diMinus) / (diPlus + diMinus) * 100 : 0
adxValue = ta.sma(dx, adxLength)
adxCondition = not useADX or (adxValue > adxThreshold)
// Liquidity Delta Calculations
bidVolume = close < open ? volume : volume * (high - close) / (high - low + 0.000001)
askVolume = close > open ? volume : volume * (close - low) / (high - low + 0.000001)
deltaRaw = bidVolume - askVolume
deltaAvg = ta.sma(deltaRaw, deltaLength)
deltaNormalized = deltaAvg / ta.sma(volume, deltaLength)
deltaSmoothed = ta.ema(deltaNormalized, deltaSmooth)
// Delta Signals
bullishDelta = deltaSmoothed > deltaThreshold
bearishDelta = deltaSmoothed < -deltaThreshold
deltaCondition = not useLiquidityDelta or bullishDelta
deltaSellCondition = not useLiquidityDelta or bearishDelta
// === TRADING LOGIC ===
// Buy signal - combination of all active indicators
buySignal = psarCondition and supertrendCondition and adxCondition and deltaCondition
// Sell signal - combination of all active indicators
sellSignal = psarSellCondition and supertrendSellCondition and adxCondition and deltaSellCondition
// Apply trading direction
isLongAllowed = tradeDirection == "Long Only" or tradeDirection == "Both"
isShortAllowed = tradeDirection == "Short Only" or tradeDirection == "Both"
finalBuySignal = buySignal and isLongAllowed
finalSellSignal = sellSignal and isShortAllowed
// === POSITION ENTRY WITH RISK MANAGEMENT ===
// Conservative position management with defined risk parameters
if finalBuySignal and inDateRange
strategy.entry("Long", strategy.long)
// Conditional setting of stop-loss and take-profit
if useStopLoss or useTakeProfit
stopLevel = useStopLoss ? close * (1 - stopLossPercent / 100) : na
takeProfitLevel = useTakeProfit ? close * (1 + takeProfitPercent / 100) : na
strategy.exit("Long Exit", "Long", stop=stopLevel, limit=takeProfitLevel)
if finalSellSignal and inDateRange
strategy.entry("Short", strategy.short)
// Conditional setting of stop-loss and take-profit
if useStopLoss or useTakeProfit
stopLevel = useStopLoss ? close * (1 + stopLossPercent / 100) : na
takeProfitLevel = useTakeProfit ? close * (1 - takeProfitPercent / 100) : na
strategy.exit("Short Exit", "Short", stop=stopLevel, limit=takeProfitLevel)
// === SIGNAL VISUALIZATION ===
// Creating separate signals for different sizes
buySmallSignal = finalBuySignal and signalSize == "Small"
buyNormalSignal = finalBuySignal and signalSize == "Normal"
buyLargeSignal = finalBuySignal and signalSize == "Large"
sellSmallSignal = finalSellSignal and signalSize == "Small"
sellNormalSignal = finalSellSignal and signalSize == "Normal"
sellLargeSignal = finalSellSignal and signalSize == "Large"
// Draw signals for each size
plotshape(buySmallSignal and inDateRange, title="Buy Small", location=location.belowbar, color=buyColor, style=shape.triangleup, size=size.small)
plotshape(buyNormalSignal and inDateRange, title="Buy Normal", location=location.belowbar, color=buyColor, style=shape.triangleup, size=size.normal)
plotshape(buyLargeSignal and inDateRange, title="Buy Large", location=location.belowbar, color=buyColor, style=shape.triangleup, size=size.large)
plotshape(sellSmallSignal and inDateRange, title="Sell Small", location=location.abovebar, color=sellColor, style=shape.triangledown, size=size.small)
plotshape(sellNormalSignal and inDateRange, title="Sell Normal", location=location.abovebar, color=sellColor, style=shape.triangledown, size=size.normal)
plotshape(sellLargeSignal and inDateRange, title="Sell Large", location=location.abovebar, color=sellColor, style=shape.triangledown, size=size.large)
// === INFORMATION PANEL ===
// Building list of active indicators
indList = ""
indList := usePSAR ? indList + "PSAR, " : indList
indList := useSupertrend ? indList + "SuperT, " : indList
indList := useADX ? indList + "ADX, " : indList
indList := useLiquidityDelta ? indList + "Delta" : indList
// Remove last comma if it exists
if str.endswith(indList, ", ")
indList := str.substring(indList, 0, str.length(indList) - 2)
// Building risk management text
riskText = ""
if useStopLoss and useTakeProfit
riskText := str.tostring(stopLossPercent, "#.#") + "% SL, " + str.tostring(takeProfitPercent, "#.#") + "% TP"
else if useStopLoss
riskText := str.tostring(stopLossPercent, "#.#") + "% SL"
else if useTakeProfit
riskText := str.tostring(takeProfitPercent, "#.#") + "% TP"
else
riskText := "Disabled"
// Display strategy information
var table infoTable = table.new(position.top_right, 2, 5, border_width=1)
table.cell(infoTable, 0, 0, "Strategy:", bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 1, 0, "Multi-Indicator Swing", bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 0, 1, "Period:", bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 1, 1, "2021-2023", bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 0, 2, "Direction:", bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 1, 2, tradeDirection, bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 0, 3, "Indicators:", bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 1, 3, indList, bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 0, 4, "Risk Management:", bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 1, 4, riskText, bgcolor=color.new(color.blue, 90), text_color=color.white)
Strategy parameters
The original address: Multi-Indicator Dynamic Trend Trading Strategy: SuperTrend, ADX and Liquidity Delta Comprehensive Analysis System
Supertrend, ADX and liquidity delta? That’s the trading equivalent of a triple-shot espresso—either genius or overkill. Love the ambition, but will it survive when the market chugs a Red Bull and goes full manic mode? Show us the backtest before we crown it the holy grail (spoiler: there isn’t one). ☕📊 #QuantOrQuantastrophe?