
이 전략은 9주기, 15주기, 50주기 EMA 지표를 종합적으로 사용하여 단기평균과 중기평균의 교차 신호를 판단하고 장기평균을 트렌드 필터로 사용하여 거래 위험을 관리하는 동시에 동적 스톱 손실 장치와 함께 거래 위험을 관리합니다. 이 전략은 트렌드 추적 및 위험 관리의 요구를 충분히 고려하여 설계되었습니다.
이 전략의 핵심 논리는 9주기 EMA와 15주기 EMA의 교차 신호를 모니터링하여 거래 시기를 결정하고 50주기 EMA를 트렌드 확인 지표로 사용합니다. 구체적으로:
이것은 합리적이고 논리적으로 명확하게 설계된 트렌드 추적 전략이다. 다중 평균의 조합 사용으로 신호의 신뢰성이 보장되고, 트렌드에 대한 효과적인 추적이 이루어진다. 내장 된 위험 관리 메커니즘은 전략의 안정적인 운영을 보장한다. 제안된 최적화 방향에 의해, 전략에는 더 많은 개선의 여지가 있다. 안정적인 수익을 추구하는 거래 사용자에게 적합하지만, 사용하기 전에 충분한 테스트와 특정 시장 특성에 대한 변수 최적화가 필요합니다.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-27 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("EMA Crossover Strategy with 50 EMA Filter", overlay=true)
// Customizable Inputs
ema9Length = input(9, title="EMA 9 Length")
ema15Length = input(15, title="EMA 15 Length")
ema50Length = input(50, title="EMA 50 Length")
stopLossPoints = input(100, title="Stop Loss Points")
takeProfitPoints = input(200, title="Take Profit Points")
// Calculate EMAs
ema9 = ta.ema(close, ema9Length)
ema15 = ta.ema(close, ema15Length)
ema50 = ta.ema(close, ema50Length)
// Detect crossovers
crossover_above = ta.crossover(ema9, ema15)
crossover_below = ta.crossunder(ema9, ema15)
// Plot EMAs
plot(ema9, color=color.blue, title="EMA 9")
plot(ema15, color=color.red, title="EMA 15")
// Make the 50 EMA invisible
plot(ema50, color=color.new(color.white, 100), title="EMA 50", display=display.none)
// Plot buy and sell signals as shapes
plotshape(crossover_above and close > ema50, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(crossover_below and close < ema50, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// Execute trades
if (crossover_above and close > ema50)
strategy.entry("Buy", strategy.long)
if (crossover_below and close < ema50)
strategy.close("Buy")
// Apply stop loss and take profit
if (crossover_above and close > ema50)
strategy.exit("Exit", from_entry="Buy", loss=stopLossPoints, profit=takeProfitPoints)
// Alerts for notifications
if (crossover_above and close > ema50)
alert("EMA 9 crossed above EMA 15 with price above EMA 50 - Buy Signal", alert.freq_once_per_bar_close)
if (crossover_below and close < ema50)
alert("EMA 9 crossed below EMA 15 with price below EMA 50 - Sell Signal", alert.freq_once_per_bar_close)