
이 전략은 MACD (이하 이동 평균이 지표에서 벗어나고) 와 RSI (이하 상대적으로 강한 지수) 와 SMA (이하 간단한 이동 평균) 를 결합하여 신뢰할 수 있는 매매 신호를 생성합니다. MACD는 가격의 동적 변화를 포착하는 데 사용되며, RSI는 과매매와 과매매 상태를 식별하는 데 사용되며, SMA는 트렌드 방향을 확인하는 데 사용됩니다. 이 전략은 거짓 신호를 줄이기 위해 여러 가지 조건을 필터링하여 일간 거래에 대한 명확한 출구점을 제공합니다.
이 전략은 다음과 같은 조건으로 진행됩니다.
이 전략은 MACD, RSI, SMA와 같은 기술 지표와 결합하여 다중 필터링 된 일일 거래 전략을 형성한다. 그것은 동력과 추세의 변화를 사용하여 거래 기회를 포착하고 명확한 출입 규칙으로 위험을 통제한다. 이 전략은 불안한 시장에서 도전받을 수 있지만, 추가적인 최적화와 위험 관리를 통해 신뢰할 수있는 일일 거래 도구가 될 수 있습니다.
/*backtest
start: 2024-05-07 00:00:00
end: 2024-06-06 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Day Trading Strategy", overlay=true)
// Parametrii pentru MACD
macdLength = input.int(12, title="MACD Length")
signalSmoothing = input.int(9, title="MACD Signal Smoothing")
src = input(close, title="Source")
// Calculul MACD
[macdLine, signalLine, _] = ta.macd(src, macdLength, 26, signalSmoothing)
macdHist = macdLine - signalLine
// Parametrii pentru RSI
rsiLength = input.int(14, title="RSI Length")
rsiOverbought = input.int(70, title="RSI Overbought Level")
rsiOversold = input.int(30, title="RSI Oversold Level")
// Calculul RSI
rsi = ta.rsi(src, rsiLength)
// Filtru suplimentar pentru a reduce semnalele false
longFilter = ta.sma(close, 50) > ta.sma(close, 200)
shortFilter = ta.sma(close, 50) < ta.sma(close, 200)
// Conditii de intrare in pozitie long
enterLong = ta.crossover(macdLine, signalLine) and rsi < rsiOverbought and longFilter
// Conditii de iesire din pozitie long
exitLong = ta.crossunder(macdLine, signalLine) or rsi > rsiOverbought
// Conditii de intrare in pozitie short
enterShort = ta.crossunder(macdLine, signalLine) and rsi > rsiOversold and shortFilter
// Conditii de iesire din pozitie short
exitShort = ta.crossover(macdLine, signalLine) or rsi < rsiOversold
// Adaugarea strategiei pentru Strategy Tester
if (enterLong)
strategy.entry("BUY", strategy.long)
if (exitLong)
strategy.close("BUY")
if (enterShort)
strategy.entry("SELL", strategy.short)
if (exitShort)
strategy.close("SELL")
// Plotarea MACD si Signal Line
plot(macdLine, color=color.blue, title="MACD Line")
plot(signalLine, color=color.orange, title="Signal Line")
hline(0, "Zero Line", color=color.gray)
plot(macdHist, color=color.red, style=plot.style_histogram, title="MACD Histogram")