モメントム 価格チャネル開閉戦略

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

img

概要

この戦略は価格チャネル指標に基づいている.モメントパラメータを設定することで,異なるサイクルにおける最高値と最低値の平均値を計算し,価格チャネルのミディアンラインを形成し,これに基づいて長線と短線を設定する.価格が長線を突破すると,長行;価格が短線を突破すると,短行する.閉じる条件は価格がチャネルのミディアンラインに戻ることです.

戦略原則

この戦略は,価格チャネル指標を使用して,チャネルミッドラインを形成するために,異なるサイクルにおける最高価格と最低価格の平均値を計算する.ミッドラインに基づいて,長線と短線はシフトパラメータで設定される.具体的には,長線計算式は:ミッドライン + (ミッドライン × 長線パラメータ%);短線計算式は:ミッドライン + (ミッドライン × 短線パラメータ%).

価格がロングラインより低いとき,リミットオーダーでロングポジションを開く.価格がショートラインより高いとき,リミットオーダーでショートポジションを開く.ロングとショートポジションのストップロスの方法は,チャネルミッドラインへの価格回帰である.

利点分析

この戦略には以下の利点があります.

  1. 価格チャネル指標を使用すると,価格動向と主要なサポート/レジスタンスレベルを効果的に把握できます.
  2. ブレイクに関するポジションを開設することで,偽ブレイクによる損失を減らすことができます.
  3. ストップ・ロスの方法は,チェイス・ストップによる過度の損失を避けるために,価格チャネルの中間線を標準として直接採用する.

リスク分析

この戦略にはいくつかのリスクもあります:

  1. 価格チャネルのパラメータの設定が正しくない場合,活発なトレンドを見逃したり,誤ったブレイクが多すぎる可能性があります.
  2. 突破式開口方法は,一定の程度に滑りコストを負担する.
  3. 価格の急激な引き下げで 損失を間に合わない

上記リスクは,パラメータを最適化したり,ストップ損失オーダーを設定したり,判断のための他の指標を組み合わせることで軽減できます.

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

戦略は以下の側面で最適化できます.

  1. 価格チャネルのパラメータを最適化して 最適な組み合わせを見つけます
  2. ろうそくのパターンやインジケータ信号など 異なる開口方法を試してください
  3. ストップ・ロスのオーダー設定を追加して,価格急落による損失を防ぐ.
  4. 取引量,波動性,その他の指標を組み合わせて 株式市場の誤ったブレイクを避ける.

結論

価格チャネル指標に基づいたこの戦略の設計構想は明確である.ブレイクアウトを使用してポジションを開くことはリスクを効果的に制御することができる.しかし,大きなパラメータ最適化スペースとストップロスのメカニズムも改善する必要がある.全体として,この戦略は一定の実用的な価値があり,さらなるテストと最適化に価値がある.


/*backtest
start: 2022-11-29 00:00:00
end: 2023-12-05 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Noro
//2018

//@version=3
strategy(title = "Noro's PCMA Strategy v1.0", shorttitle = "PCMA 1.0", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0)

//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
capital = input(100, defval = 100, minval = 1, maxval = 10000, title = "Lot, %")
per = input(3, title = "Length")
shortlevel = input(10.0, title = "Short line (red)")
longlevel = input(-5.0, title = "Long line (lime)")
fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")

//Price Channel
h = highest(high, per)
l = lowest(low, per)
c = (h + l) / 2
ll = c + ((c / 100) * longlevel)
sl = c + ((c / 100) * shortlevel)

//Lines
shortcolor = needshort ? red : na
longcolor = needlong ? lime : na
plot(sl, linewidth = 2, color = shortcolor, title = "Short line")
plot(c, linewidth = 2, color = blue, title = "SMA line")
plot(ll, linewidth = 2, color = longcolor, title = "Long line")

//Trading
size = strategy.position_size
lot = 0.0
lot := size == 0 ? strategy.equity / close * capital / 100 : lot[1]

if (not na(close[per])) and size == 0 and needlong
    strategy.entry("L", strategy.long, lot, limit = ll, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
    
if (not na(close[per])) and size == 0 and needshort
    strategy.entry("S", strategy.short, lot, limit = sl, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
    
if (not na(close[per])) and size > 0 
    strategy.entry("Close", strategy.short, 0, limit = c, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
    
if (not na(close[per])) and size < 0 
    strategy.entry("Close", strategy.long, 0, limit = c, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))

if time > timestamp(toyear, tomonth, today, 23, 59)
    strategy.close_all()

もっと