
이 전략은 다중 기술 지표 에 기반 한 트렌드 트레이딩 시스템이다. 이 전략은 지수 이동 평균 ((EMA), 매출량 중도 평균 가격 ((VWAP), 상대적으로 강한 지수 ((RSI), 평균 트렌드 지수 ((ADX) 등 여러 기술 지표를 종합적으로 사용하여, 여러 신호 확인을 통해 가짜 을 필터링하여 거래의 정확성을 향상시킵니다. 이 전략은 또한 더 높은 시간 주기 트렌드 판단을 결합하고, ATR 기반의 동적 스톱 손실 스톱 프로그램을 채택하여, 위험을 효과적으로 제어합니다.
전략의 핵심 논리는 다음과 같은 핵심 요소에 기초합니다.
이 전략은 여러 기술 지표의 협동적인 협동으로 비교적 완전한 거래 시스템을 구축한다. 그것의 핵심 장점은 다차원 신호 확인을 통해 거래의 정확성을 향상시키는 데 있으며, 과학적인 위험 관리 방법을 사용하여 자금의 안전을 보호하는 데 있다. 약간의 한계가 있지만, 지속적인 최적화 및 개선으로 이 전략은 실제 거래에서 안정적인 수익을 얻을 수 있다.
/*backtest
start: 2024-11-19 00:00:00
end: 2024-12-18 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Trend-Filtered Scalping Strategy", overlay=true, shorttitle="TFSS")
// Inputs
emaShort = input.int(9, title="EMA Short", minval=1)
emaLong = input.int(21, title="EMA Long", minval=1)
rsiLength = input.int(14, title="RSI Length", minval=1)
atrLength = input.int(14, title="ATR Length", minval=1)
adxLength = input.int(20, title="ADX Length", minval=1)
adxSmoothing = input.int(14, title="ADX Smoothing", minval=1)
volMultiplier = input.float(1.5, title="Volume Spike Multiplier", minval=1.0)
riskPercent = input.float(1, title="Risk % of Equity", minval=0.1, step=0.1)
// Higher Time Frame for Trend Filter
htfTimeframe = input.timeframe("15", title="Higher Time Frame")
ema50HTF = request.security(syminfo.tickerid, htfTimeframe, ta.ema(close, 50))
// Indicators
ema9 = ta.ema(close, emaShort)
ema21 = ta.ema(close, emaLong)
vwap = ta.vwap(close)
rsi = ta.rsi(close, rsiLength)
atr = ta.atr(atrLength)
volAvg = ta.sma(volume, 10)
// ADX Calculation with Smoothing
[_, _, adx] = ta.dmi(adxLength, adxSmoothing)
// Entry Conditions
longCondition = (ta.crossover(ema9, ema21) and close > vwap and rsi > 55 and adx > 25 and close > ema50HTF and volume > volAvg * volMultiplier)
shortCondition = (ta.crossunder(ema9, ema21) and close < vwap and rsi < 45 and adx > 25 and close < ema50HTF and volume > volAvg * volMultiplier)
// Position Sizing Based on Risk %
capitalPerTrade = (strategy.equity * (riskPercent / 100)) / atr
longStop = close - 1.5 * atr
longTarget = close + 3 * atr
shortStop = close + 1.5 * atr
shortTarget = close - 3 * atr
// Entry Logic
if longCondition and not strategy.opentrades
strategy.entry("Long", strategy.long, qty=capitalPerTrade)
strategy.exit("Exit Long", from_entry="Long", stop=longStop, limit=longTarget)
if shortCondition and not strategy.opentrades
strategy.entry("Short", strategy.short, qty=capitalPerTrade)
strategy.exit("Exit Short", from_entry="Short", stop=shortStop, limit=shortTarget)
// Alerts
alertcondition(longCondition, title="Long Entry Alert", message="Long Condition Triggered!")
alertcondition(shortCondition, title="Short Entry Alert", message="Short Condition Triggered!")
// Plot Indicators
plot(ema9, title="EMA 9", color=color.green)
plot(ema21, title="EMA 21", color=color.red)
plot(vwap, title="VWAP", color=color.blue)
plot(ema50HTF, title="HTF EMA 50", color=color.purple)
hline(55, "RSI Long Threshold", color=color.green)
hline(45, "RSI Short Threshold", color=color.red)