VAWSIとトレンド持続反転戦略を動的長さ計算と組み合わせたマルチ指標総合分析システム

VAWSI ATR RSI WMA SMA RMA
作成日: 2024-06-21 15:36:43 最終変更日: 2024-06-21 15:36:43
コピー: 4 クリック数: 567
1
フォロー
1617
フォロワー

VAWSIとトレンド持続反転戦略を動的長さ計算と組み合わせたマルチ指標総合分析システム

概要

この戦略は,複数の指標を組み合わせた総合的な分析システムで,市場動向と潜在的な逆転点を判断するために,主にVAWSI (ボリュームとATR重力強度指数),トレンド継続性指標,修正版ATRに基づいて判断します.この戦略は,異なる市場条件に適応するために,ダイナミックな長さの計算も導入しています.それは,ダイナミックなストップとリターンを設定してリスクを管理し,潜在的な逆転信号が認識されるときに取引します.

この戦略の核心は,市場トレンドの強さ,持続時間,および変動を複数のカスタム指標で測定することで,最適な取引時間を特定することです.これは,特に明らかにトレンドのある市場に適用されますが,異なる市場状態に対処するための適応性メカニズムも含みます.

戦略原則

  1. VAWSI:RMAの代わりにVAWMA (ボリュームとATRの重力移動平均) を使ったRSIに似た原始的な指標である.

  2. トレンド継続性指標: トレンドが持続する期間を測定するための別の原始指標である.これは,ソースデータと指定された長さの最高/最低点の最大偏差を計算し,この偏差を累積して強度指数を作成する.

  3. 改訂ATR:高-低と代数源-前の代数源の最大値を取り,その変化の絶対値を取り,ソースデータで統一する.

  4. 動的長度計算:BlackCat1402の動的長度計算方法を使用して,市場条件に応じて指標の長度パラメータを調整する.

  5. 総合分析:VAWSI,トレンド継続性,ATRの読み込みを組み合わせて,総合指標を生成する.最終値の低い値は,反転が迫っていることを示し,高い値は,市場の不安定さまたは揺れを示している.

  6. ダイナミック・ストップ/利益:総合指標と現在のトレンド方向に基づくダイナミック・ストップと利益のレベル.

  7. 取引シグナル:価格が計算された値線を完全に越えたとき,システムは交差点を確認し取引シグナルを生成する.

戦略的優位性

  1. 多次元分析:複数の指標を組み合わせることで,戦略は異なる角度から市場を分析し,判断の正確さを向上させる.

  2. 適応性:ダイナミックな長さの計算により,戦略は異なる市場条件に適応し,戦略の柔軟性を高めます.

  3. リスク管理: ダイナミックなストップ・ロズとレバレッジの設定は,市場の変化に適応し,リスクをより良くコントロールするのに役立ちます.

  4. 独創性指標:VAWSIとトレンド継続性指標は,従来の指標が無視するシグナルを捉える可能性のあるユニークな市場洞察を提供します.

  5. 転写を防止: barstate.isconfirmed を使用すると,信号が転写されないことを保証し,反測の正確性を向上させる.

  6. カスタマイズ性:複数のパラメータを調整することで,異なる取引品種と時間枠に対応できる.

戦略リスク

  1. 過剰最適化:多くのパラメータが過剰最適化につながり,実盤取引ではうまく機能しない.

  2. 市場適応性:一部の市場では良好なパフォーマンスを示しているが,すべての市場条件,特に波動性が低い市場では適用されない可能性があります.

  3. 複雑性: 戦略の複雑さは,理解し,維持するのが困難になり,操作ミスのリスクが増加する.

  4. 計算密度:複数のカスタム指標と動的計算により,計算負荷が高くなり,実行速度に影響する可能性があります.

  5. 歴史データに依存する:戦略は,多くの歴史データを使って計算し,場合によっては遅滞を引き起こす可能性があります.

最適化の方向

  1. 参数最適化: 異なる市場条件下での戦略のパフォーマンスを向上させるために,機械学習アルゴリズムを使用して,様々な重量と長さの参数を最適化します.

  2. 市場状態認識:異なる市場環境で戦略パラメータを自動的に調整するために,市場状態認識モジュールを追加した.

  3. 信号フィルタリング:偽信号を減らすために,トレンド強度値などの追加のフィルタリングメカニズムを導入する.

  4. 交量分析:交量分析を深め,交量形態認識を導入して信号の信頼性を高める可能性がある.

  5. 多時間枠分析: 取引決定の安定性を高めるために,複数の時間枠の信号を統合する.

  6. リスク管理の最適化:ダイナミックなポジションサイジングや多層のストップダウンのようなより複雑なリスク管理戦略を実現する.

  7. 計算効率: 計算効率を高めるために,特に大量の歴史データを処理する際に,コードを最適化します.

要約する

VAWSIとトレンド継続逆転戦略は,複数の革新的な指標とダイナミックパラメータの調整を組み合わせた複雑で包括的な取引システムである.その優点は,多次元的な市場分析と自己適応性であり,異なる市場条件下で潜在的逆転の機会を探すことができる.しかし,戦略の複雑さは,過度な最適化と適応性の課題をもたらします.

この戦略は,特にパラメータ調整,市場状態の識別,リスク管理の面で,さらなる最適化によって強力な取引ツールになる可能性がある.しかし,ユーザーは,戦略が完璧ではなく,継続的なモニタリングと調整が必要であることを注意すべきである.実用的なアプリケーションでは,模擬口座で十分なテストが行われ,他の分析ツールと市場知識と組み合わせて取引決定を行うことが推奨されている.

ストラテジーソースコード
/*backtest
start: 2024-05-21 00:00:00
end: 2024-06-20 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("VAWSI and Trend Persistance Reversal", overlay=true, max_bars_back = 4999, process_orders_on_close = true)


//INPUTS
sltp = input.float(title = "Minimum SL/TP", defval = 5.0)
rsi_weight = input.float(title = "Wawsi weight", defval = 100.0)
half_weight= input.float(title = "Trend Persistence Weight", defval = 79.0)
atr_weight = input.float(title = "ATR Weight", defval = 20.0)
com_mult = input.float(title = "Combination Mult", defval = 1, step = .001)
smoothing = input.int(title = "Trend Persistence smooth length", defval = 3)
CycPart = input.float(1.1, step = .001, title = "Length Cycle Decimal")
src = close
hclose = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, src)

//BlackCat1402's Dynamic Length Calculation
EhlersHoDyDC(Price, CycPart) =>
    // Vars: 
    Smooth = 0.00
    Detrender = 0.00
    I1 = 0.00
    Q1 = 0.00
    jI = 0.00
    jQ = 0.00
    I2 = 0.00
    Q2 = 0.00
    Re = 0.00
    Im = 0.00
    Period = 0.00
    SmoothPeriod = 0.00
    pi = 2 * math.asin(1)
    DomCycle = 0.0

    //Hilbert Transform
    Smooth := bar_index > 5 ? (4 * Price + 3 * nz(Price[1]) + 2 * nz(Price[2]) + nz(Price[3])) / 10 : Smooth
    Detrender := bar_index > 5 ? (.0962 * Smooth + .5769 * nz(Smooth[2]) - .5769 * nz(Smooth[4]) - .0962 * nz(Smooth[6])) * (.075 * nz(Period[1]) + .54) : Detrender
    //Compute InPhase and Quadrature components
    Q1 := bar_index > 5 ? (.0962 * Detrender + .5769 * nz(Detrender[2]) - .5769 * nz(Detrender[4]) - .0962 * nz(Detrender[6])) * (.075 * nz(Period[1]) + .54) : Q1
    I1 := bar_index > 5 ? nz(Detrender[3]) : I1

    //Advance the phase of I1 and Q1 by 90 degrees
    jI := (.0962 * I1 + .5769 * nz(I1[2]) - .5769 * nz(I1[4]) - .0962 * nz(I1[6])) * (.075 * nz(Period[1]) + .54)
    jQ := (.0962 * Q1 + .5769 * nz(Q1[2]) - .5769 * nz(Q1[4]) - .0962 * nz(Q1[6])) * (.075 * nz(Period[1]) + .54)

    //Phasor addition for 3 bar averaging
    I2 := I1 - jQ
    Q2 := Q1 + jI

    //Smooth the I and Q components before applying the discriminator
    I2 := .2 * I2 + .8 * nz(I2[1])
    Q2 := .2 * Q2 + .8 * nz(Q2[1])

    //Homodyne Discriminator
    Re := I2 * nz(I2[1]) + Q2 * nz(Q2[1])
    Im := I2 * nz(Q2[1]) - Q2 * nz(I2[1])
    Re := .2 * Re + .8 * nz(Re[1])
    Im := .2 * Im + .8 * nz(Im[1])

    Period := Im != 0 and Re != 0 ? 2 * pi / math.atan(Im / Re) : Period
    Period := Period > 1.5 * nz(Period[1]) ? 1.5 * nz(Period[1]) : Period
    Period := Period < .67 * nz(Period[1]) ? .67 * nz(Period[1]) : Period
    //Limit Period to be within the bounds of 6 bar and 50 bar cycles
    Period := Period < 6 ? 6 : Period
    Period := Period > 50 ? 50 : Period
    Period := .2 * Period + .8 * nz(Period[1])
    SmoothPeriod := .33 * Period + .67 * nz(SmoothPeriod[1])
    //it can add filter to Period here
    DomCycle := math.ceil(CycPart * SmoothPeriod) > 34 ? 34 : math.ceil(CycPart * SmoothPeriod) < 1 ? 1 : math.ceil(CycPart * SmoothPeriod)
    DomCycle

wma(src, length) =>
    wma = 0.0
    sum = 0.0
    norm = length * (length + 1) / 2
    for i = 0 to length - 1
        sum := sum + src[i] * (length - i)
    wma := sum / norm


length = math.round(math.ceil(EhlersHoDyDC(hclose,CycPart)))

// Traditional Function initialization
highest_custom(src, length) =>
    x = src
    for i = 0 to math.min(length, 4999)
        if src[i] > x
            x := src[i]
    x
lowest_custom(src, length) => 
    x = src
    for i = 0 to math.min(length, 4999)
        if src[i] < x
            x := src[i]
    x

rma(src, len) =>
    sum = 0.0
    for i = 0 to len - 1
        math.min(1, len)
        sum += src[i]
    rma = sum / len
    rma := nz(rma[1]) * (len - 1) / len + src / len
    
sma(src, length) =>
    math.sum(src, length) / length

hln(src, length) =>
    TR = math.max(math.abs(src - src[1]), high - low)
    TR := src / math.abs(ta.change(rma(TR, length)))
    TR := (1 / TR) * 100

vawma(src, length) =>
    atr = ta.atr(1)
    aavg = sma(atr, length)
    vavg = sma(volume, length)
    weighted_sum = 0.0
    sum_weights = 0.0
    weighted = 0.0
    for i = 0 to length
        weight = ((volume[i] / vavg + (atr[i]) / aavg) / 2)
        weighted_sum += src[i] * weight
        sum_weights += weight
    a = (weighted_sum / sum_weights)

vawsi(src, len) =>
    rmaUp = vawma(math.max(ta.change(src), 0), len)
    rmaDown = vawma(-math.min(ta.change(src), 0), len)
    rsi = 100 - (100 / (1 + rmaUp / rmaDown))

trendPersistence(src, length, smoothing) =>
    trendu = math.abs(src - highest_custom(src, length))
    trendd = math.abs(src - lowest_custom(src, length))
    trendu := wma(trendu, smoothing)
    trendd := wma(trendd, smoothing)
    trendu := ta.change(ta.cum(trendu))
    trendd := ta.change(ta.cum(trendd))
    trend = wma(math.max(trendu, trendd), smoothing)
    rmaUp = rma(math.max(ta.change(trend), 0), length)
    rmaDown = rma(-math.min(ta.change(trend), 0), length)
    rsi = 100 - (100 / (1 + rmaUp / rmaDown))

//Strategy Calculations
sl = ((100 - sltp) / 100) * close
tp = ((100 + sltp) / 100) * close

var bool crossup = na
var bool crossdown = na
var float dir = na
var float BearGuy = 0

BullGuy = ta.barssince(crossup or crossdown)
if na(BullGuy)
    BearGuy += 1
else
    BearGuy := math.min(BullGuy, 4999)


rsiw = rsi_weight / 100
cew = half_weight / 100
atrw = atr_weight / 100

atr = hln(hclose, length) * atrw
ce = 1 / trendPersistence(hclose, length, smoothing)
com = 1 / math.max(math.abs(vawsi(hclose, length) - 50) * 2, 20)

comfin = (((com * rsiw) + (ce * cew) - atr)) * com_mult

lower = highest_custom(math.min((math.max(highest_custom(src, BearGuy) * (1 - comfin), sl)), src[1]), BearGuy)
upper = lowest_custom(math.max((math.min(lowest_custom(src, BearGuy) * (1 + comfin), tp)), src[1]), BearGuy)

var float thresh = na

if na(thresh)
    thresh := lower
if na(dir)
    dir := 1
if crossdown
    dir := -1
if crossup
    dir := 1
if dir == 1
    thresh := lower
if dir == -1
    thresh := upper

crossup := ta.crossover(hclose, thresh) and barstate.isconfirmed
crossdown := ta.crossunder(hclose, thresh) and barstate.isconfirmed

//STRATEGY
if crossup
    strategy.entry("long", strategy.long)
if crossdown
    strategy.entry("Short", strategy.short)

//PLOTTING
col = hclose > thresh ? color.lime : color.red
plot(thresh, linewidth = 2, color = color.new(col[1], 0))