
This strategy is a trend-following system based on the ADX indicator and trading volume. It combines ADX indicator to determine trend strength and uses volume as confirmation signals to capture reliable trading opportunities in strong trend markets. The core logic is to trade only when the market shows a clear trend supported by sufficient trading volume.
The strategy employs a dual filtering mechanism using ADX and volume. When the ADX value exceeds the set threshold (default 26), it indicates a significant market trend. Meanwhile, it confirms trend validity by comparing current volume with the 20-period volume moving average (default multiplier 1.8). Based on these two conditions, trading direction is determined by the relative strength of DI+ and DI-. The strategy automatically closes positions when reverse signals appear to control risk.
This is a trend-following strategy with complete structure and clear logic. Through the combination of ADX indicator and trading volume, it effectively addresses the signal reliability issue in trend trading. The strategy features flexible parameter settings that can be optimized for different market characteristics. Although there are certain lagging risks, the strategy has good practical value through appropriate parameter adjustments and optimization improvements.
/*backtest
start: 2024-01-01 00:00:00
end: 2024-11-11 00:00:00
period: 1h
basePeriod: 1h
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/
// © traderhub
//@version=5
strategy("ADX + Volume Strategy", overlay=true)
// Strategy parameters
adxLength = input(21, title="ADX Period") // ADX period
adxThreshold = input(26, title="ADX Threshold") // ADX threshold to determine strong trend
volumeMultiplier = input.float(1.8, title="Volume Multiplier", minval=0.1, maxval=10 , step = 0.1) // Volume multiplier, adjustable float
// Calculate ADX, DI+, DI-
[diPlus, diMinus, adx] = ta.dmi(adxLength, adxLength)
// Average volume for signal confirmation
avgVolume = ta.sma(volume, 20) // Simple Moving Average of volume over 20 bars
// Conditions for entering a long position
longCondition = adx > adxThreshold and diPlus > diMinus and volume > avgVolume * volumeMultiplier
// Conditions for entering a short position
shortCondition = adx > adxThreshold and diMinus > diPlus and volume > avgVolume * volumeMultiplier
// Enter a long position
if (longCondition)
strategy.entry("Long", strategy.long)
// Enter a short position
if (shortCondition)
strategy.entry("Short", strategy.short)
// Close positions on opposite signals
if (strategy.position_size > 0 and shortCondition)
strategy.close("Long")
if (strategy.position_size < 0 and longCondition)
strategy.close("Short")
// Display ADX on the chart
plot(adx, color=color.red, title="ADX")
hline(adxThreshold, "ADX Threshold", color=color.green)