
이 전략은 10일 간단한 이동 평균 ((10SMA) 과 이동 평균 수렴 분산 지표 ((MACD) 의 두 가지 기술 지표를 사용하여 가격의 추세 방향을 판단하여 거래 결정을 내립니다. 가격이 10SMA를 통과하고 MACD 단선에서 느린 선을 통과하면 다중 신호가 발생하며, 가격이 10SMA를 통과하고 MACD 단선에서 느린 선을 통과하면 평소 상태가 더 간단합니다. 이 전략은 시장의 추세적 기회를 포착하는 동시에 두 지표의 공동 확인을 통해 신호의 신뢰성을 높입니다.
이 전략의 핵심은 10SMA의 위치와 가격의 관계를 이용하는 것과 MACD의 빠른 느린 선의 교차를 통해 추세를 판단하는 것입니다. 두 지표의 공동 확인은 신호의 유효성과 신뢰성을 어느 정도 향상시킬 수 있습니다.
10 SMA와 MACD 이중 트렌드 추적 거래 전략은 두 가지 일반적인 기술 지표를 결합하여 시장의 중장기적 트렌드 기회를 간단하고 편리하게 포착합니다. 하나의 지표를 개별적으로 사용하는 것과 비교하여 두 가지 지표의 공동 인지는 신호의 신뢰도와 유효성을 어느 정도 향상시킬 수 있으며 또한 어느 정도의 적응력을 가지고 있습니다. 그러나, 이 전략은 지연, 진동 시장 및 돌발 사건 등의 위험이 있습니다. 실제 응용에서는 시장 특성과 개인 선호에 따라 적절한 최적화 및 개선이 필요합니다.
/*backtest
start: 2023-06-01 00:00:00
end: 2024-06-06 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("10SMA and MACD Strategy", overlay=true)
// Input parameters
length = input(10, title="SMA Length")
macdFastLength = input(12, title="MACD Fast Length")
macdSlowLength = input(26, title="MACD Slow Length")
macdSignalSmoothing = input(9, title="MACD Signal Smoothing")
// Calculate 10SMA
sma10 = ta.sma(close, length)
plot(sma10, title="10SMA", color=color.blue)
// Calculate MACD
[macdLine, signalLine, _] = ta.macd(close, macdFastLength, macdSlowLength, macdSignalSmoothing)
plot(macdLine, title="MACD Line", color=color.red)
plot(signalLine, title="Signal Line", color=color.green)
// Strategy conditions
longCondition = ta.crossover(close, sma10) and ta.crossover(macdLine, signalLine)
shortCondition = ta.crossunder(close, sma10) and ta.crossunder(macdLine, signalLine)
// Plot buy and sell signals
plotshape(series=longCondition, location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=shortCondition, location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// Strategy execution
if (longCondition)
strategy.entry("Long", strategy.long)
if (shortCondition)
strategy.close("Long")