
“双均線遅延突破策”は,よく使われる技術分析取引策である.この策は,2つの異なる周期の簡易移動平均 ((SMA) と平均真波幅 ((ATR) の指標を組み合わせ,市場傾向の転換点を捕捉し,低リスクの高収益の取引を実現することを目的としている.その核心思想は,均線の遅延性と市場の変動性を利用し,価格が均線を破り,波動率が制御可能な範囲にあるときに取引信号を生成することである.
この戦略の基本原則は以下の通りです.
上記の原理から,この戦略は,均線システムのトレンド判断とATR指標の波動率測定を組み合わせ,トレンド追跡を主として,引き返しのリスクを制御しながら,トレンド型戦略であることがわかります.
“双均線落後突破戦略”には以下の利点があります.
この戦略には利点があるものの,以下のリスクがあります.
このリスクに対して,以下の点で最適化や改善を行うことができます.
この戦略は以下の点で最適化できます.
上記の最適化は,戦略の適応性,安定性,収益性を向上させることができます.しかし,過度な最適化は,戦略曲線の適合につながり,サンプル外での不良なパフォーマンスを引き起こす可能性があるので,サンプル内および外での十分なフィットバック検証が必要であることに注意してください.
“双均線遅れ突破戦略”は,均線システムによってトレンドの方向を判断し,ATR指標を利用してリスクを制御し,トレンドの動きを捉えると同時にリスク管理を兼ね備えるクラシックなトレンド追跡型の戦略である.一定の遅滞性および頻繁な取引の問題があるにもかかわらず,停止損失を最適化し,信号フィルタリング,パラメータの適応,最適化,ポジション管理などの方法を導入することにより,この戦略のパフォーマンスをさらに向上させ,実用的な量化取引戦略にすることができる.
/*backtest
start: 2024-03-01 00:00:00
end: 2024-03-31 23:59:59
period: 4h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy(title="2 Moving Averages", shorttitle="2MA", overlay=true)
// Moving Averages
len = input(14, minval=1, title="Length MA1")
src = input(close, title="Source MA1")
ma1 = sma(src, len)
len2 = input(50, minval=1, title="Length MA2")
src2 = input(close, title="Source MA2")
ma2 = sma(src2, len2)
// Plotting Moving Averages
plot(ma1, color=#0b6ce5, title="MA1")
plot(ma2, color=#00ff80, linewidth=2, title="MA2")
// ATR Bands
atrLength = input(14, title="ATR Length")
atrMultiplier = input(1.5, title="ATR Multiplier")
upperBand = high + atr(atrLength) * atrMultiplier
lowerBand = low - atr(atrLength) * atrMultiplier
u =plot(upperBand, color=color.rgb(217, 220, 223, 84), title="ATR Upper Band")
l = plot(lowerBand, color=color.rgb(217, 220, 223, 84), title="ATR Lower Band")
fill(u, l, color=#471eb821, title="ATR Background")
// Conditions for plotting arrows
upArrowCondition = ma1 > ma2 and crossover(close, ma1)
downArrowCondition = ma1 < ma2 and crossunder(close, ma1)
// Plotting arrows
plotshape(upArrowCondition, style=shape.arrowup, color=color.rgb(66, 45, 255), size=size.normal, location=location.belowbar, title="Up Arrow")
plotshape(downArrowCondition, style=shape.arrowdown, color=color.red, size=size.normal, location=location.abovebar, title="Down Arrow")
// Checkbox for trade execution
showTrades = input(true, title="Hiển thị giao dịch")
// Buy Condition
if (upArrowCondition and showTrades)
strategy.entry("Buy", strategy.long)
// Sell Condition
if (downArrowCondition and showTrades)
strategy.entry("Sell", strategy.short)
// Stop Loss and Take Profit
stopLossBuy = low - atr(14) * atrMultiplier
takeProfitBuy = close + (close - stopLossBuy) * 2
stopLossSell = high + atr(14) * atrMultiplier
takeProfitSell = close - (stopLossSell - close) * 2
strategy.exit("Exit Buy", "Buy", stop=stopLossBuy, limit=takeProfitBuy)
strategy.exit("Exit Sell", "Sell", stop=stopLossSell, limit=takeProfitSell)