価格波動性ブレイクストラテジーは,二重移動平均値に基づいている.

作者: リン・ハーンチャオチャン, 日時: 2023-12-08 16:44:22
タグ:

img

概要

この戦略の主な考え方は,価格変動を市場動向を判断するために使用することです. 変動が上昇すると,市場は新しいトレンドを形成していることを意味します. そして変動が低下すると,現在のトレンドが終了していることを意味します. 戦略は価格のパーセント変化を計算し,価格変動を反映する指標を得るために二重移動平均値でフィルタリングします. 指標が信号線を超えると購入信号を生成し,下を通ると信号を販売します.

戦略の論理

戦略ではまず価格の変化を計算します

i=(src/nz(src[1], src))*100

その後,iを35期移動平均値でフィルタリングして初期変動指標pmol2を得ます.Pmol2は20期移動平均値で再びフィルタリングして最終指標pmolを得ます.最後に,pmolの10期移動平均値を信号ラインpmolとして使用します.pmolがpmolを超えると購入し,下を通ると販売します.

利点分析

  • 2倍MAフィルタリングで 揮発性を吸収し 騒音をフィルタリングします
  • 変化率を計算すると 価格変動が大きくなり 傾向の変化が目に見えるようになります
  • トレンド開始時に購入し トレンド終了時に販売します

リスク分析

  • ダブルフィルタリングは遅延を引き起こす.
  • 割合変化の計算は価格幅に敏感である.
  • 牛とクマの 間に合う脱出が必要です

オプティマイゼーションの方向性

  • MAパラメータを最適化して トレンドキャッチを改善する
  • 価格変動を計算する異なる方法を試してください.
  • 間違った信号を避けるためにフィルターを追加します.

概要

この戦略は,価格変動を抽出し,トレンド変化を判断するために,パーセント変化とダブルMAフィルタリングを使用する.これは比較的成熟した技術指標戦略に属している.この戦略は,良いトレンドキャッチ能力が有しているが,中程度のターニングポイント認識能力がある.パラメータチューニングや補助条件を追加することによって最適化することができる.


/*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)  


もっと