デュアル期間 ATR ボラティリティ ブレイクアウト 株式トレンド戦略


作成日: 2024-01-17 16:34:23 最終変更日: 2024-01-17 16:34:23
コピー: 1 クリック数: 728
1
フォロー
1617
フォロワー

デュアル期間 ATR ボラティリティ ブレイクアウト 株式トレンド戦略

この戦略は,価格のATRの変動率を計算し,異なる周期のVWAP平均価格と組み合わせて,ロングポジションの入場と出場条件を設定し,株のトレンド追跡取引を実現する.

戦略概要

この策略は主に株式類製品のトレンド追跡に使用され,ATRの変動率を計算し,異なる周期のVWAP価格を組み合わせて,買入販売条件を設定し,トレンドの判断と追跡を実現する.この策略は柔軟で,長線と短線の間を切り替えることができ,中中長線トレンドを捕捉するのに適しています.

戦略原則

策略はATR指標を用いて価格の変動率を計算し,価格が変動率チャネルを突破したかどうかを組み合わせてトレンドの方向を判断する.また,異なる周期のVWAP価格を導入して,長短線トレンドの一致性を判断する.具体的論理は以下の通りである.

  1. 価格を計算するATR変動率チャネル
  2. 価格が波動率チャネルを突破したかどうかを判断する
    1. 突破口を走行する際の判断は多傾向だった
    2. ダウントレンドは空想的傾向と判断される.
  3. 周線と日線VWAP価格を導入
    1. 価格が波動率を突破すると,日線と周線VWAPの両方が価格の上にある場合,ロングポジションシグナルが生じる
    2. 価格が波動率を下回ったとき,日線と周線VWAPが価格を下回っている場合,空仓の信号が生じる

以上は戦略の核心的な論理である.ATRの波動率は短期的傾向を判断し,VWAPの価格は長期的傾向を判断し,両者はトレンドの一致性を判断し,取引信号を生成する.

戦略的優位性

  • ATRとVWAPの組み合わせにより,トレンド判断はより信頼性が高くなります.
  • 設定可能なATR周期パラメータ,戦略の調整感度
  • 異なる周期VWAPを導入し,長短線トレンドの一致性を判断する
  • 長線と短線の間を柔軟に切り替える
  • 株の長線トレンドを追跡する

リスクと最適化

  • トレンド追跡策として,波動調整の段階で取引が増え,滑り込みのリスクが生じる
  • ATRとVWAPのパラメータ設定は,戦略のパフォーマンスに影響し,異なる品種に対して慎重にテストする必要があります.
  • 単一損失を抑えるために,損失防止メカニズムを導入することも検討できる
  • 均線などの指標を組み合わせて入場信号をフィルタリングし,不必要な取引を減らす

要約する

この戦略は,ATR変動率とVWAPの二重判断によって,株式トレンドの追跡を可能にします.戦略の最適化スペースは大きく,パラメータを調整したり,他の技術指標の最適化シグナルを追加したりできます.全体的に,戦略の論理は明確で分かりやすく,安定したパフォーマンスを発揮し,中長期トレンドを追跡するのに適しています.

ストラテジーソースコード
/*backtest
start: 2023-12-17 00:00:00
end: 2024-01-16 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © exlux99

//@version=4
strategy(title="VWAP MTF STOCK STRATEGY", overlay=true )

// high^2 / 2 - low^2 -2

h=pow(high,2) / 2
l=pow(low,2) / 2

o=pow(open,2) /2
c=pow(close,2) /2


x=(h+l+o+c) / 4
y= sqrt(x)

source = y
useTrueRange = false
length = input(27, minval=1)
mult = input(0, step=0.1)
ma = sma(source, length)
range = useTrueRange ? tr : high - low
rangema = sma(range, length)
upper = ma + rangema * mult
lower = ma - rangema * mult
crossUpper = crossover(source, upper)
crossLower = crossunder(source, lower)
bprice = 0.0
bprice := crossUpper ? high+syminfo.mintick : nz(bprice[1])
sprice = 0.0
sprice := crossLower ? low -syminfo.mintick : nz(sprice[1])
crossBcond = false
crossBcond := crossUpper ? true
     : na(crossBcond[1]) ? false : crossBcond[1]
crossScond = false
crossScond := crossLower ? true
     : na(crossScond[1]) ? false : crossScond[1]
cancelBcond = crossBcond and (source < ma or high >= bprice )
cancelScond = crossScond and (source > ma or low <= sprice )

longOnly = true

fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
fromYear = input(defval = 2000, title = "From Year", minval = 1970)
 //monday and session 
// To Date Inputs
toDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31)
toMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12)
toYear = input(defval = 2021, title = "To Year", minval = 1970)

startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = true

srcX = input(ohlc4)
t = time("W")
start = na(t[1]) or t > t[1]

sumSrc = srcX * volume
sumVol = volume
sumSrc := start ? sumSrc : sumSrc + sumSrc[1]
sumVol := start ? sumVol : sumVol + sumVol[1]

vwapW= sumSrc / sumVol

 
//crossUpper = crossover(source, upper)
//crossLower = crossunder(source, lower)
shortCondition = close < vwap and time_cond and (close < vwapW)
longCondition = close > vwap and time_cond and (close > vwapW)

 


if(longOnly and time_cond)
    if (crossLower and close < vwapW )
        strategy.close("long")
    if (crossUpper and close>vwapW)
        strategy.entry("long", strategy.long, stop=bprice)