
이는 EMA 추세, 사이클 돌파, 거래 세션 필터링을 결합한 양적 거래 전략입니다. 이 전략은 주로 이동 평균의 추세 방향에 대한 판단을 기반으로 하며, 주요 사이클 위치에서 가격의 돌파 패턴을 거래 신호로 사용합니다. 동시에 거래 기간 필터링을 도입하여 거래 품질을 개선합니다. 이 전략은 위험을 통제하기 위해 백분율 손절매와 이익 실현 방법을 사용합니다.
전략의 핵심 논리에는 다음과 같은 핵심 요소가 포함됩니다.
이 전략은 이동 평균 추세, 가격 패턴, 기간 필터링 등 여러 메커니즘을 결합하여 논리적으로 엄격한 거래 시스템을 구축합니다. 일정한 한계는 있지만, 지속적인 최적화와 개선을 통해 전략의 안정성과 수익성이 더욱 향상될 것으로 기대됩니다. 이 전략은 중장기 추세 추적 시스템의 기본 틀로 적합하며, 실제 거래 요구에 맞게 사용자 정의하고 개선할 수 있습니다.
/*backtest
start: 2024-12-17 00:00:00
end: 2025-01-16 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/
//@version=6
strategy("The Gold Box Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=200)
// Inputs
roundNumberInterval = input.int(5, title="Round Number Interval ($)", minval=1)
useEMA = input.bool(true, title="Use 20 EMA for Confluence")
emaLength = input.int(20, title="EMA Length")
// Session times for London and NY
londonSession = input("0300-1200", title="London Session (NY Time)")
nySession = input("0800-1700", title="New York Session (NY Time)")
// EMA Calculation
emaValue = ta.ema(close, emaLength)
// Plot Round Number Levels
roundLow = math.floor(low / roundNumberInterval) * roundNumberInterval
roundHigh = math.ceil(high / roundNumberInterval) * roundNumberInterval
// for level = roundLow to roundHigh by roundNumberInterval
// line.new(x1=bar_index - 1, y1=level, x2=bar_index, y2=level, color=color.new(color.gray, 80), extend=extend.both)
// Session Filter
inLondonSession = not na(time("1", londonSession))
inNYSession = not na(time("1", nySession))
inSession = true
// Detect Bullish and Bearish Engulfing patterns
bullishEngulfing = close > open[1] and open < close[1] and close > emaValue and inSession
bearishEngulfing = close < open[1] and open > close[1] and close < emaValue and inSession
// Entry Conditions
if bullishEngulfing
strategy.entry("Long", strategy.long, comment="Bullish Engulfing with EMA Confluence")
if bearishEngulfing
strategy.entry("Short", strategy.short, comment="Bearish Engulfing with EMA Confluence")
// Stop Loss and Take Profit
stopLossPercent = input.float(1.0, title="Stop Loss (%)", minval=0.1) / 100
takeProfitPercent = input.float(1.5, title="Take Profit (%)", minval=0.1) / 100
strategy.exit("Exit Long", "Long", stop=close * (1 - stopLossPercent), limit=close * (1 + takeProfitPercent))
strategy.exit("Exit Short", "Short", stop=close * (1 + stopLossPercent), limit=close * (1 - takeProfitPercent))