
이것은 쌍평선 교차 신호에 기반한 양적 거래 전략이다. 전략은 두 개의 이동 평균을 사용한다. 하나는 주 신호 라인이고, 다른 하나는 평평한 신호 라인이다. 가격과 평평한 신호 라인의 교차 상황을 모니터링하여 거래 신호를 생성하여 시장 추세를 파악하고 동력을 추적한다. 전략의 핵심 장점은 간단하고 효과적인 신호 생성 메커니즘과 유연한 파라미터 구성 옵션에 있다.
전략은 두 단계의 이동 평균 계산을 사용한다. 먼저 기본 이동 평균을 계산한다 (기본 주기는 9), 그 다음 이 평균에 대한 두 번째 평면 처리를 한다 (기본 주기는 5). 전략은 간단한 이동 평균 (SMA), 지수 이동 평균 (EMA), 평면 이동 평균 (SMMA), 가중된 이동 평균 (WMA) 및 성량 가중된 이동 평균 (VWMA) 을 포함하여 여러 가지 평균 계산 방법을 제공합니다. 상반된 가격대가 평면 이동 신호선을 상향으로 넘으면 다중 신호를 생성하고, 가격대가 평면 신호선을 상향으로 넘으면 하위 신호를 생성합니다.
이것은 고전적인 트렌드 추적 전략의 개선된 버전이며, 두 층의 이동 평균의 설계로 전략의 단순성을 유지하면서 안정성을 향상시킵니다. 전략은 좋은 확장성과 유연성을 가지고 있으며, 매개 변수 최적화 및 기능 확장으로 다양한 시장 환경에 적응할 수 있습니다. 그러나 사용자는 거래 비용을 제어하고 위험을 관리하는 데 주의를 기울여야하며, 실제 거래 전에 충분한 재검토가 권장됩니다.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-25 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Moving Average 1.0 Strategy", overlay=true)
// Input for Moving Average Length
len = input.int(9, minval=1, title="Length")
src = input(close, title="Source")
offset = input.int(title="Offset", defval=0, minval=-500, maxval=500)
// Calculate the Moving Average
out = ta.sma(src, len)
// Plot the Moving Average
plot(out, color=color.blue, title="MA", offset=offset)
// Function to choose the type of moving average
ma(source, length, type) =>
switch type
"SMA" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"SMMA (RMA)" => ta.rma(source, length)
"WMA" => ta.wma(source, length)
"VWMA" => ta.vwma(source, length)
// Input for Smoothing Method and Length
typeMA = input.string(title="Method", defval="SMA", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="Smoothing")
smoothingLength = input.int(title="Smoothing Length", defval=5, minval=1, maxval=100, group="Smoothing")
// Calculate the Smoothing Line
smoothingLine = ma(out, smoothingLength, typeMA)
// Plot the Smoothing Line
plot(smoothingLine, title="Smoothing Line", color=color.rgb(120, 66, 134, 35), offset=offset)
// Strategy Logic
if (ta.crossover(close, smoothingLine))
strategy.entry("Buy", strategy.long)
if (ta.crossunder(close, smoothingLine))
strategy.entry("Sell", strategy.short)