This strategy is based on the Directional Movement Index (DMI), specifically the DI+ and DI- indicators, combined with a trend-filtering moving average and the Average True Range (ATR) to identify market trends and set dynamic stop-loss and take-profit levels. The DMI is designed to measure the direction and strength of price movements.
DI+ (Positive Directional Indicator): Measures the strength of upward trends. DI- (Negative Directional Indicator): Measures the strength of downward trends. When DI+ is above DI- and the closing price is above the trend-filtering moving average, it is considered a strong uptrend, generating a buy signal. Conversely, when DI- is above DI+ and the closing price is below the trend-filtering moving average, it is considered a strong downtrend, generating a sell signal.
This strategy uses the ATR indicator to calculate dynamic stop-loss and take-profit levels, allowing the stop-loss and take-profit distances to adjust to market volatility, improving the strategy's adaptability.
策略參數 (中英文對照):
DI 長度 (DI Length): 計算 DI+ 和 DI- 的週期長度。 (預設值: 14) / The period length for calculating DI+ and DI-. (Default: 14) ADX 平滑 (ADX Smoothing): 用於平滑 ADX 的週期長度 (即使不直接使用 ADX,此參數也是必需的)。 (預設值: 14) / The period length used for smoothing the ADX (this parameter is required even if ADX is not used directly). (Default: 14) 趨勢過濾均線長度 (Trend Filter Moving Average Length): 計算趨勢過濾均線的週期長度。 (預設值: 20) / The period length for calculating the trend-filtering moving average. (Default: 20) 趨勢強度門檻值 (Trend Strength Threshold): DI+ 和 DI- 之間差距的門檻值,用於判斷趨勢是否足夠強勁。 (預設值: 20) / The threshold for the difference between DI+ and DI-, used to determine if the trend is strong enough. (Default: 20) ATR 長度 (ATR Length): 計算 ATR 的週期長度。 (預設值: 14) / The period length for calculating the ATR. (Default: 14) ATR 停損倍數 (ATR Stop Loss Multiplier): 止損價格與進場價格之間以 ATR 的倍數表示的距離。 (預設值: 1.5) / The distance between the stop-loss price and the entry price, expressed as a multiple of the ATR. (Default: 1.5) ATR 止盈倍數 (ATR Take Profit Multiplier): 止盈價格與進場價格之間以 ATR 的倍數表示的距離。 (預設值: 2.5) / The distance between the take-profit price and the entry price, expressed as a multiple of the ATR. (Default: 2.5) 策略用法 (中文):
Open a chart on TradingView. Open the Pine Script editor. Copy and paste the provided code. Click "Add to Chart". In the strategy settings, adjust the parameters according to your needs. Use the backtesting feature to test the performance of different parameter combinations. 訊號判斷 (中英文對照):
買入訊號 (Long Entry Signal): DI+ > DI- + 趨勢強度門檻值 且 收盤價 > 趨勢過濾均線 / DI+ > DI- + Trend Strength Threshold AND Close > Trend Filter Moving Average 賣出訊號 (Short Entry Signal): DI- > DI+ + 趨勢強度門檻值 且 收盤價 < 趨勢過濾均線 / DI- > DI+ + Trend Strength Threshold AND Close < Trend Filter Moving Average 止損止盈計算 (中英文對照):
回測結果僅供參考,不代表未來績效。 / Backtesting results are for reference only and do not guarantee future performance. 策略參數需要根據不同的市場和時間週期進行調整。 / Strategy parameters need to be adjusted according to different markets and timeframes. 此策略不適用於所有市場環境。 / This strategy is not suitable for all market conditions. 請謹慎使用,並自行承擔交易風險。 / Please use with caution and at your own risk.
진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.