
この戦略の核心思想は,価格の波動率を利用して市場の傾向を判断すること.波動率が上昇すると,市場は新しいトレンドを形成していることを示し,波動率が低下すると,現在のトレンドが終了していることを示します.戦略は,価格のパーセントの変化を計算し,それに対均等線フィルターを行って,価格の波動率を反映した指標が得られます.この指標の上部を通過すると買入信号が生み出され,下部を通過すると売り信号が生み出されます.
この戦略は,まず,価格の変化の割合を計算します.
i=(src/nz(src[1], src))*100
次に,長さ35の均線フィルターを通って,プライマリ価格変動率指数pmol2を得る.次に,長さ20の均線を通って,pmol2への二次フィルターを通って,最終的な価格変動率指数pmolを得る.最後に,長さ10の均線を通って,pmolの信号ラインpmolsを得る.pmol上のpmolsを穿越すると,買入信号が生じ,pmolの下のpmolsを穿越すると,売り出信号が生じます.
改善する方向:
この戦略は,パーセント変化と双均線波の計算方法によって,価格変動率を抽出し,市場トレンドの変化を判断する,より成熟した技術指標類の戦略に属している.この戦略はトレンドを捕捉する能力は強いが,転換点の識別能力は一般的である.パラメータを調整し,補助条件を追加することで最適化することができる.
/*backtest
start: 2022-12-01 00:00:00
end: 2023-12-07 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
strategy("Strategy for DPMO", overlay=true)
src=input(close, title="Source")
length1=input(35, title="First Smoothing")
length2=input(20, title="Second Smoothing")
siglength=input(10, title="Signal Smoothing")
ebc=input(false, title="Enable Bar Colors")
upSign = '↑' // indicates the indicator shows uptrend
downSign = '↓' // incicates the indicator showing downtrend
exitSign ='x' //indicates the indicator uptrend/downtrend ending
calc_csf(src, length) =>
sm = 2.0/length
csf=(src - nz(csf[1])) * sm + nz(csf[1])
csf
i=(src/nz(src[1], src))*100
pmol2=calc_csf(i-100, length1)
pmol=calc_csf( 10 * pmol2, length2)
pmols=ema(pmol, siglength)
d=pmol-pmols
hc=d>0?d>d[1]?lime:green:d<d[1]?red:orange
buyDPMO = hc==lime and hc[1]!=lime
closeBuyDPMO = hc==green and hc[1]!=green
sellDPMO = hc==red and hc[1]!=red
closeSellDPMO = hc==orange and hc[1]!=orange
plotshape(buyDPMO, color=lime, style=shape.labelup, textcolor=#000000, text="DPMO", location=location.belowbar, transp=0)
plotshape(closeBuyDPMO, color=green, style=shape.labelup, textcolor=#ffffff, text="X", location=location.belowbar, transp=0)
plotshape(sellDPMO, color=red, style=shape.labeldown, textcolor=#000000, text="DPMO", location=location.abovebar, transp=0)
plotshape(closeSellDPMO, color=orange, style=shape.labeldown, textcolor=#ffffff, text="X", location=location.abovebar, transp=0)
barcolor(ebc?hc:na)
strategy.entry("Long", strategy.long, when=buyDPMO)
strategy.close("Long", when=closeBuyDPMO or sellDPMO)
strategy.entry("Short", strategy.short, when=sellDPMO)
strategy.close("Short", when=closeSellDPMO or buyDPMO)