
이 전략은 평평선 교차, RSI 운동 지표 및 ATR 변동률 지표가 결합된 다층 확인 거래 시스템이다. 이 전략은 9주기 및 21주기 지수 이동 평균 ((EMA) 을 주요 트렌드 판단 근거로 삼고, RSI 지표와 결합하여 운동 확인을 수행하고, ATR 지표를 사용하여 포지션 크기 및 스톱 손실 위치를 동적으로 조정한다. 이 전략은 여러 기술 지표의 조화를 통해 가짜 신호를 효과적으로 필터링하여 거래의 신뢰성을 높인다.
이 전략의 핵심 논리는 다음과 같은 몇 가지 측면에 기반하고 있습니다.
이 전략은 평평선 교차, RSI 동력 및 ATR 변동률의 3 차원을 조합하여 안정적인 거래 시스템을 구축한다. 이 전략의 장점은 완전한 다단계 확인 메커니즘과 동적인 위험 관리 시스템이지만, 흔들리는 시장에서 더 높은 위험에 직면 할 수 있다. 시장 환경 필터링과 최적화 파라미터 자조하는 방향으로의 개선이 추가됨에 따라 전략의 성능은 향상된다.
/*backtest
start: 2025-02-13 00:00:00
end: 2025-02-20 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=5
strategy("BTC Scalping Strategy", overlay=true, margin_long=100, margin_short=100, pyramiding=1)
// Inputs
emaFastLength = input.int(9, "Fast EMA Length")
emaSlowLength = input.int(21, "Slow EMA Length")
rsiLength = input.int(14, "RSI Length")
rsiOverbought = input.int(70, "RSI Overbought")
rsiOversold = input.int(30, "RSI Oversold")
atrLength = input.int(14, "ATR Length")
riskPercent = input.float(1, "Risk Percentage", step=0.5)
// Calculate Indicators
emaFast = ta.ema(close, emaFastLength)
emaSlow = ta.ema(close, emaSlowLength)
rsi = ta.rsi(close, rsiLength)
atr = ta.atr(atrLength)
// Entry Conditions
longCondition = ta.crossover(emaFast, emaSlow) and rsi < rsiOverbought
shortCondition = ta.crossunder(emaFast, emaSlow) and rsi > rsiOversold
// Exit Conditions
takeProfitLevelLong = close + (atr * 3)
stopLossLevelLong = close - (atr * 1.5)
takeProfitLevelShort = close - (atr * 3)
stopLossLevelShort = close + (atr * 1.5)
// Position Sizing
equity = strategy.equity
riskAmount = equity * (riskPercent / 100)
positionSizeLong = riskAmount / (close - stopLossLevelLong)
positionSizeShort = riskAmount / (stopLossLevelShort - close)
// Strategy Execution
if (longCondition)
strategy.entry("Long", strategy.long, qty=positionSizeLong)
strategy.exit("Exit Long", "Long", limit=takeProfitLevelLong, stop=stopLossLevelLong)
if (shortCondition)
strategy.entry("Short", strategy.short, qty=positionSizeShort)
strategy.exit("Exit Short", "Short", limit=takeProfitLevelShort, stop=stopLossLevelShort)
// Plotting
plot(emaFast, color=color.new(color.blue, 0), linewidth=2)
plot(emaSlow, color=color.new(color.red, 0), linewidth=2)
hline(rsiOverbought, "RSI OB", color=color.new(color.red, 50))
hline(rsiOversold, "RSI OS", color=color.new(color.green, 50))
// Alerts
alertcondition(longCondition, "Long Signal", "Potential Long Entry")
alertcondition(shortCondition, "Short Signal", "Potential Short Entry")