
This strategy is a trend following trading system that combines the Average Directional Index (ADX) with the Parabolic Stop and Reverse (SAR) indicator. The system measures trend strength using ADX and confirms trend direction using SAR to capture trading opportunities in strong trending markets. It employs a dual confirmation mechanism to ensure both the existence and reliability of trends.
The core logic is based on the following key components: 1. ADX indicator measures trend strength, with values above 25 indicating a significant trend. 2. DI+ and DI- crossovers determine trend direction, with DI+ > DI- indicating uptrend and vice versa. 3. Parabolic SAR tracks price movement by dynamically adjusting stop points, providing additional trend confirmation.
Trade signal triggers are as follows: - Long entry: ADX>25, DI+>DI-, and price above SAR - Short entry: ADX>25, DI->DI+, and price below SAR - Exit: When opposite trading signals appear
Risk control suggestions: - Set maximum drawdown limits - Adjust parameters based on market volatility - Incorporate additional technical indicators for trade confirmation - Implement position management strategies
Introduce volatility indicators for parameter adjustment
Optimize exit mechanism
Add market environment filters
Improve position management
This strategy constructs a robust trend following system by combining ADX and SAR indicators. Its main advantages lie in the dual confirmation mechanism and dynamic stop-loss settings, although performance may be suboptimal in oscillating markets. Through appropriate parameter optimization and risk control, the strategy can achieve good performance in clearly trending market environments. Traders are advised to conduct thorough backtesting before live implementation and adjust parameters according to specific market characteristics.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-10 08:00:00
period: 1d
basePeriod: 1d
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("Trend Following ADX + Parabolic SAR", overlay=true)
// Strategy parameters
adxLength = input(14, title="ADX Period")
adxThreshold = input(25, title="ADX Threshold")
adxSmoothing = input(14, title="ADX Smoothing")
sarStart = input(0.02, title="Parabolic SAR Start") // Starting acceleration factor
sarIncrement = input(0.02, title="Parabolic SAR Increment") // Increment step
sarMax = input(0.2, title="Parabolic SAR Max") // Maximum acceleration factor
// Calculate ADX, DI+, and DI-
[diPlus, diMinus, adx] = ta.dmi(adxLength, adxSmoothing)
// Parabolic SAR calculation
sar = ta.sar(sarStart, sarIncrement, sarMax)
// Conditions for a long position
longCondition = adx > adxThreshold and diPlus > diMinus and close > sar
// Conditions for a short position
shortCondition = adx > adxThreshold and diMinus > diPlus and close < sar
// Enter a long position
if (longCondition)
strategy.entry("Long", strategy.long)
// Enter a short position
if (shortCondition)
strategy.entry("Short", strategy.short)
// Close position on reverse signal
if (strategy.position_size > 0 and shortCondition)
strategy.close("Long")
if (strategy.position_size < 0 and longCondition)
strategy.close("Short")
// Plot indicators on the chart
plot(sar, color=color.blue, style=plot.style_circles, linewidth=2, title="Parabolic SAR")
plot(adx, color=color.red, title="ADX")
hline(adxThreshold, "ADX Threshold", color=color.green)