
이것은 15주기 및 50주기 지수 이동 평균 ((EMA) 의 교차를 기반으로 한 거래 전략입니다. 전략은 지능적인 정지 및 이득을 통해 위험-이익 비율을 최적화합니다. 이 전략은 트렌드 반전 신호를 포착 할 수있을뿐만 아니라 시장의 변동에 따라 거래 매개 변수를 자동으로 조정하여 전략의 안정성과 수익성을 향상시킬 수 있습니다.
전략의 핵심 논리는 빠른 EMA ((15주기) 와 느린 EMA ((50주기) 의 교차 신호를 기반으로 한다. 빠른 선에서 느린 선을 통과할 때, 시스템은 다중 신호를 발생시킨다; 빠른 선 아래 느린 선을 통과할 때, 시스템은 공백 신호를 발생시킨다. 위험 관리를 최적화하기 위해, 전략은 동적 중지 손실 설정 방법을 채택한다. 즉, 이전 2K 선의 최저 개장 가격은 다중 스톱으로 손실을, 최고 개장 가격은 공백 스톱으로 손실을 취한다. 이익 목표는 위험의 2배로 설정되어, 좋은 위험 수익을 보장한다. 전략은 기본으로 30%의 계좌를 사용한다. 이러한 재무 관리 방법은 위험을 제어하는 데 도움이 된다.
이 전략은 구조적으로 완전하고 논리적으로 명확한 일직선 교차 전략이다. 고전적인 기술 분석 방법과 현대적인 위험 관리 기술을 결합함으로써 전략은 더 나은 위험 수익 특성을 달성한다. 약간의 최적화 공간이 있지만, 전략의 기본 프레임워크는 실용성과 확장성이 좋다. 제안된 최적화 방향에 의해 전략의 성능이 더 향상될 것으로 보인다.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-11 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("EMA Cross - Any Direction", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=30)
// Input for EMAs
ema_short_length = input(15, title="Short EMA Length")
ema_long_length = input(50, title="Long EMA Length")
// Calculate EMAs
ema_short = ta.ema(close, ema_short_length)
ema_long = ta.ema(close, ema_long_length)
// Plot EMAs
plot(ema_short, color=color.blue, title="15 EMA")
plot(ema_long, color=color.red, title="50 EMA")
// Entry Conditions (Any EMA Cross)
cross_condition = ta.crossover(ema_short, ema_long) or ta.crossunder(ema_short, ema_long)
// Determine Trade Direction
is_long = ta.crossover(ema_short, ema_long)
is_short = ta.crossunder(ema_short, ema_long)
// Stop Loss and Take Profit
long_stop_loss = ta.lowest(open[1], 2) // Lowest open of the last 2 candles
short_stop_loss = ta.highest(open[1], 2) // Highest open of the last 2 candles
long_take_profit = close + 2 * (close - long_stop_loss)
short_take_profit = close - 2 * (short_stop_loss - close)
// Execute Trades
if (cross_condition)
if (is_long)
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", "Long", stop=long_stop_loss, limit=long_take_profit)
else if (is_short)
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", "Short", stop=short_stop_loss, limit=short_take_profit)
// Plot Stop Loss and Take Profit Levels
plot(long_stop_loss, color=color.orange, title="Long Stop Loss", style=plot.style_circles, linewidth=2)
plot(long_take_profit, color=color.green, title="Long Take Profit", style=plot.style_circles, linewidth=2)
plot(short_stop_loss, color=color.orange, title="Short Stop Loss", style=plot.style_circles, linewidth=2)
plot(short_take_profit, color=color.red, title="Short Take Profit", style=plot.style_circles, linewidth=2)