
이 전략은 MACD (이동 평균의 종결 분산) 과 RSI (대비적으로 강한 지표) 를 결합한 트렌드 추적 거래 시스템이다. 이 전략은 5 분 시간 주기에서 실행되며, MACD와 신호 라인의 교차와 RSI가 초과 구매 초과 판매 수준을 분석하여 거래 신호를 생성한다. 또한 위험 관리를 구현하기 위해 퍼센트 기반의 손실 및 수익 결제 장치를 통합한다.
이 전략은 다음과 같은 핵심 논리에 기반을 두고 있습니다.
이 전략은 MACD와 RSI의 장점을 결합하여 트렌드 추적과 동적 특성을 겸비한 거래 시스템을 구축한다. 완벽한 위험 제어 장치와 명확한 거래 논리는 좋은 실용성을 갖는다. 제안된 최적화 방향을 통해 전략은 더 발전할 여지가 있다. 실내 적용 시 충분한 피드백 검증을 실시하고 특정 시장 특성에 따라 파라미터를 적절하게 조정하는 것이 좋습니다.
/*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"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
//@version=5
strategy("MACD + RSI Basit Strateji", overlay=true, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// İndikatör parametreleri
fastLength = input(12, "MACD Fast Length")
slowLength = input(26, "MACD Slow Length")
signalLength = input(9, "MACD Signal Length")
rsiLength = input(14, "RSI Period")
rsiOversold = input(45, "RSI Oversold Level")
rsiOverbought = input(55, "RSI Overbought Level")
// Stop Loss ve Take Profit ekledim
stopLoss = input(1.2, "Stop Loss (%)")
takeProfit = input(2.4, "Take Profit (%)")
// MACD hesaplama
[macdLine, signalLine, histLine] = ta.macd(close, fastLength, slowLength, signalLength)
// RSI hesaplama
rsiValue = ta.rsi(close, rsiLength)
// EMA trend filtresi
emaValue = ta.ema(close, 10)
// Alım sinyali koşulları - sadece MACD ve RSI kullanalım
longCondition = macdLine > signalLine and rsiValue < rsiOversold
// Satım sinyali koşulları
shortCondition = macdLine < signalLine and rsiValue > rsiOverbought
// Pozisyon yönetimi - Stop Loss ve Take Profit ekledim
if (longCondition)
strategy.entry("Long", strategy.long)
strategy.exit("TP/SL", "Long",
profit = close * takeProfit / 100,
loss = close * stopLoss / 100)
if (shortCondition)
strategy.close("Long")
// Grafik göstergeleri
plotshape(longCondition, title="Alım",
style=shape.triangleup,
location=location.belowbar,
color=color.green,
size=size.large,
text="AL")
plotshape(shortCondition, title="Satım",
style=shape.triangledown,
location=location.abovebar,
color=color.red,
size=size.large,
text="SAT")
// İndikatörleri göster
plot(rsiValue, "RSI", color=color.purple)
hline(rsiOversold, "Oversold", color=color.gray)
hline(rsiOverbought, "Overbought", color=color.gray)