
이 전략은 다중 기술 지표에 기반한 트렌드 추적 및 동력 거래 시스템이다. 그것은 주로 평균 트렌드 지표 ((ADX), 상대적으로 강한 지표 ((RSI) 및 실제 파도 ((ATR) 를 결합하여 잠재적인 다중 기회를 식별하고 ATR를 사용하여 동적인 수익 및 중단 가격을 설정한다. 이 전략은 1 분 시간 주기 옵션 거래에 특히 적합하며, 엄격한 입장 조건과 위험 관리를 통해 거래의 성공률을 높인다.
전략의 핵심 논리에는 다음과 같은 핵심 구성 요소가 포함됩니다.
이 전략은 여러 가지 기술 지표를 통합하여 전체적인 거래 시스템을 구축한다. 이 전략의 장점은 트렌드 및 동적 분석을 결합하고 동적인 위험 관리 방법을 채택하는 것이다. 특정 위험이 존재하지만 합리적인 매개 변수 최적화 및 위험 제어 조치를 통해 실제 거래에서 안정적인 성과를 얻을 수 있다.
/*backtest
start: 2024-02-21 00:00:00
end: 2025-02-18 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"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/
// © SPcuttack
//@version=6
strategy("ADX & RSI Strategy with ATR Targets", overlay=true)
// Input parameters
adxLength = input.int(14, title="ADX Length")
adxSmoothing = input.int(14, title="ADX Smoothing")
rsiLength = input.int(14, title="RSI Length")
rsiSmaLength = input.int(20, title="RSI SMA Length")
atrLength = input.int(14, title="ATR Length")
atrMultiplierTarget = input.float(2.5, title="ATR Multiplier for Target")
atrMultiplierStop = input.float(1.5, title="ATR Multiplier for Stop Loss")
// ADX and DMI calculations
[adx, plusDI, minusDI] = ta.dmi(adxLength, adxSmoothing)
// RSI calculations
rsi = ta.rsi(close, rsiLength)
rsiSma = ta.sma(rsi, rsiSmaLength)
// ATR calculation
atr = ta.atr(atrLength)
// Slope calculations (difference from the previous value)
adxSlope = adx - adx[1]
rsiSlope = rsi - rsi[1]
// Entry conditions
adxCondition = adx > 18 and plusDI > minusDI and adxSlope > 0
rsiCondition = rsi > rsiSma and rsiSlope > 0
rsiCross60 = ta.crossover(rsi, 60)
// Global variable for long entry
var bool longEntry = false
if (adxCondition and rsiCondition and rsiCross60)
longEntry := true
else
longEntry := false
// Variables for target and stop loss levels
var float entryPrice = na
var float targetLevel = na
var float stopLossLevel = na
// Strategy actions
if (longEntry)
entryPrice := close
targetLevel := entryPrice + atr * atrMultiplierTarget
stopLossLevel := entryPrice - atr * atrMultiplierStop
strategy.entry("Long", strategy.long)
if (strategy.position_size > 0)
if (close >= targetLevel)
strategy.close("Long", comment="Tgt Hit")
if (close <= stopLossLevel)
strategy.close("Long", comment="SL Hit")
// Ensure lines plot on the chart body
targetLine = strategy.position_size > 0 ? targetLevel : na
stopLossLine = strategy.position_size > 0 ? stopLossLevel : na
plot(targetLine, title="Target Level", color=color.green, linewidth=2, offset=0)
plot(stopLossLine, title="Stop Loss Level", color=color.red, linewidth=2, offset=0)
// Add entry price for reference
plot(strategy.position_size > 0 ? entryPrice : na, title="Entry Price", color=color.blue, linewidth=1, style=plot.style_cross, offset=0)