
이 전략은 지수 이동 평균 ((EMA) 과 상대적으로 강한 지수 ((RSI) 를 기반으로 한 교차 거래 시스템입니다. 전략은 가격과 EMA의 교차와 RSI 지수의 초과 구매 초과 판매 수준을 통해 진입 및 출퇴근 시간을 결정합니다. 시스템은 위험을 효과적으로 제어 할 수있는 완전한 중단 및 수익 메커니즘을 설계했습니다.
이 전략은 다음과 같은 핵심 논리를 기반으로 작동합니다.
이 전략은 EMA와 RSI의 두 가지 고전적인 기술 지표를 결합하여 트렌드 추적과 반전 특성을 갖춘 거래 시스템을 구축한다. 완벽한 위험 제어 메커니즘과 조정 가능한 매개 변수 디자인은 좋은 실용성을 갖는다. 그러나 전략의 매개 변수 최적화와 시장 적응성은 여전히 개선 할 여지가 있으며, 거래자는 실장 적용 시 시장 특성을 결합하여 타겟팅 최적화를 수행하는 것이 좋습니다.
/*backtest
start: 2024-02-21 00:00:00
end: 2024-10-05 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=5
strategy("EMA & RSI Custom Strategy", overlay=true)
// Input Parameters
emaLength = input.int(68, title="EMA Length")
rsiLength = input.int(13, title="RSI Period")
buyOffset = input.float(2, title="Buy Offset (above EMA)")
sellOffset = input.float(2, title="Sell Offset (below EMA)")
stopLossPoints = input.float(20, title="Stop Loss (points)")
buyRSIProfitLevel = input.int(70, title="Buy RSI Profit Level")
sellRSIProfitLevel = input.int(28, title="Sell RSI Profit Level")
// EMA and RSI Calculations
ema = ta.ema(close, emaLength)
rsi = ta.rsi(close, rsiLength)
// Buy Condition
buyPrice = ema + buyOffset
buyCondition = ta.crossover(close, buyPrice)
if buyCondition
strategy.entry("Buy", strategy.long)
// Stop Loss and Profit for Buy
if strategy.position_size > 0
if close <= strategy.position_avg_price - stopLossPoints
strategy.close("Buy", comment="Stop Loss")
if rsi >= buyRSIProfitLevel
strategy.close("Buy", comment="Profit Target")
// Sell Condition
sellPrice = ema - sellOffset
sellCondition = ta.crossunder(close, sellPrice)
if sellCondition
strategy.entry("Sell", strategy.short)
// Stop Loss and Profit for Sell
if strategy.position_size < 0
if close >= strategy.position_avg_price + stopLossPoints
strategy.close("Sell", comment="Stop Loss")
if rsi <= sellRSIProfitLevel
strategy.close("Sell", comment="Profit Target")
// Plot EMA
plot(ema, color=color.blue, title="EMA 68")