
이 전략은 3개의 서로 다른 기간의 지수 이동 평균 ((EMA) 와 상대적으로 강한 지수 ((RSI) 를 사용하여 시장의 추세와 거래 신호를 판단한다. 가격이 200일 EMA를 돌파하고 RSI가 50보다 크면 구매 신호를 발생시키고, 반대로 가격이 200일 EMA를 돌파하고 RSI가 50보다 작으면 판매 신호를 발생시킨다. 이 전략은 해상선 수준의 파도 거래에 적합하다.
이 전략은 EMA의 다중 머리 배열과 RSI의 강한 영역의 거래 신호를 통해 비교적 명확한 중기 및 장기 트렌드 상황을 포착 할 수 있습니다. 그러나 트렌드 전환 초기 및 변동 시장에서 일반적으로 수행하는 것은 전체적으로 트렌디 시장에 적합합니다. 이후에는 신호, 포지션, 스톱 손실, 필터 조건 등에서 더욱 최적화하여 전략의 안정성과 수익 위험 비율을 향상시킬 수 있습니다.
/*backtest
start: 2024-05-01 00:00:00
end: 2024-05-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Lexi Supreme", overlay=true)
// Calculate EMA 200
ema200 = ta.ema(close, 200)
// Calculate EMA 50
ema50 = ta.ema(close, 50)
// Calculate EMA 21
ema21 = ta.ema(close, 21)
// Calculate RSI
rsiValue = ta.rsi(close, 14)
// Buy condition: RSI above 50 and price crosses above EMA 200
buyCondition = ta.crossover(close, ema200) and rsiValue > 50
// Sell condition: RSI below 50 and price crosses below EMA 200
sellCondition = ta.crossunder(close, ema200) and rsiValue < 50
// Position Size (1% of account balance)
positionSize = 1
// Stop Loss and Take Profit values for buy trades
stopLossBuy = ema200 - 0.00050
takeProfitBuy = 0.00100
// Stop Loss and Take Profit values for sell trades
stopLossSell = ema200 + 0.00050
takeProfitSell = 0.00100
// Plot EMA 200 line in blue
plot(ema200, color=color.blue, title="EMA 200")
// Plot EMA 50 line in red
plot(ema50, color=color.red, title="EMA 50")
// Plot EMA 21 line in green
plot(ema21, color=color.green, title="EMA 21")
// Plot buy entry points in yellow
plotshape(series=buyCondition, title="Buy Signal", color=color.yellow, style=shape.triangleup, location=location.belowbar, size=size.small)
// Plot sell entry points in white
plotshape(series=sellCondition, title="Sell Signal", color=color.white, style=shape.triangledown, location=location.abovebar, size=size.small)
// Strategy entry and exit conditions with position size, stop loss, and take profit for buy trades
if (buyCondition)
strategy.entry("Buy", strategy.long, qty=positionSize)
strategy.exit("Take Profit/Stop Loss Buy", from_entry="Buy", stop=stopLossBuy, limit=close + takeProfitBuy)
// Strategy entry and exit conditions with position size, stop loss, and take profit for sell trades
if (sellCondition)
strategy.entry("Sell", strategy.short, qty=positionSize)
strategy.exit("Take Profit/Stop Loss Sell", from_entry="Sell", stop=stopLossSell, limit=close - takeProfitSell)