
この戦略は,10日単調移動平均 ((10SMA)) と移動平均収束散度指数 ((MACD)) の2つの技術指標を利用し,価格のトレンド方向を判断するためにそれらの交差信号を使用して取引決定を行う.価格が10SMAを上を通過し,MACDの快線がスローラインを穿過すると,多信号が生じ,価格が10SMAを下を通過し,MACDの快線の下のスローラインを穿過すると,平仓多信号が生じます.この戦略は,市場のトレンドの機会を捉え,同時に2つの指標の共同確認によって信号の信頼性を高めるように試みます.
この戦略の核心は,価格と10SMAの位置関係とMACDの急行線の交差を活用してトレンドを判断することであり,両指標の共同確認は,信号の有効性と信頼性を一定程度に向上させることができる.
10SMAとMACDの二重トレンドトラッキング取引戦略は,一般的な2つの技術指標の組み合わせを使用して,市場における中長期のトレンドの機会を簡単で使いやすい方法で捉えます. 一つの指標を単独で使用するよりも,2つの指標の共同承認は,信号の信頼性と有効性を一定程度向上させることができ,また一定の適応性があります. しかし,この戦略には,遅滞,振動市,突発などのリスクもあります.
/*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")