이 전략은 쌍 EMA 평균선 교차를 거래 신호로 사용하고 있으며, 빠른 라인 주기는 65이며, 느린 라인 주기는 240입니다. 동시에 거래량을 필터 조건으로 사용하여, 현재 거래량이 지정된 하락값보다 크면만 거래됩니다. 전략은 각 거래에 대해 고정 위험 금액을 설정하고, 위험 금액에 따라 역동적으로 포지션 크기를 계산합니다. 빠른 라인 상에서 느린 라인을 통과하고 거래량이 조건을 충족하면 더 많이하고, 빠른 라인 아래에서 느린 라인을 통과하고 거래량이 조건을 충족하면 공백하십시오.
이 전략은 65⁄240 쌍평선 교차를 트렌드 판단 근거로 사용하고, 동시에 교류 필터링 조건을 결합하여 신호 신뢰성을 개선한다. 고정 위험 포지션 관리 및 고정 가격 중지 손실 스톱 설치는 위험을 어느 정도 제어하고 적자를 유리한 방향으로 기울일 수 있다. 그러나 전략에는 트렌드 잡기 상대적 지연, 포지션 관리 유연성이 부족, 중지 손해가 동적으로 조정되지 않는 문제도 있다. 미래에는 다중평선 시스템을 구축하고, 포지션 관리를 최적화하고, 동적 중지 손해가 더 안정적이고 신뢰할 수 있는 거래 성능을 얻기 위해 전략에 대한 최적화 및 개선이 가능합니다.
/*backtest
start: 2024-05-06 00:00:00
end: 2024-05-13 00:00:00
period: 3m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("EMA Crossover Strategy with 1:3 RR, Volume Filter, and Custom Stop Loss/Take Profit (BTC)", overlay=true, currency="USD", initial_capital=100)
// Define EMA lengths
ema_length_fast = 65
ema_length_slow = 240
// Calculate EMAs
ema_fast = ta.ema(close, ema_length_fast)
ema_slow = ta.ema(close, ema_length_slow)
// Define crossover conditions
bullish_crossover = ta.crossover(ema_fast, ema_slow)
bearish_crossover = ta.crossunder(ema_fast, ema_slow)
// Plot EMAs
plot(ema_fast, color=color.blue, title="Fast EMA")
plot(ema_slow, color=color.red, title="Slow EMA")
// Define volume filter
volume_threshold = 1000 // Adjust as needed
// Define risk amount per trade
risk_per_trade = 0.5 // $10 USD
// Calculate position size based on risk amount
stop_loss_distance = 100
take_profit_distance = 1500
position_size = risk_per_trade / syminfo.mintick / stop_loss_distance
// Execute trades based on crossovers and volume filter
if (bullish_crossover and volume > volume_threshold)
strategy.entry("Buy", strategy.long, qty=position_size)
strategy.exit("Exit", "Buy", stop=close - stop_loss_distance, limit=close + take_profit_distance)
if (bearish_crossover and volume > volume_threshold)
strategy.entry("Sell", strategy.short, qty=position_size)
strategy.exit("Exit", "Sell", stop=close + stop_loss_distance, limit=close - take_profit_distance)