モメンタム追従型適応統計的裁定戦略


作成日: 2023-12-11 16:41:27 最終変更日: 2023-12-11 16:41:27
コピー: 0 クリック数: 791
1
フォロー
1621
フォロワー

モメンタム追従型適応統計的裁定戦略

概要

この戦略は,Nadaraya-Watson核帰帰法に基づいて,動的波動率の包囲帯を構成し,価格と包囲帯の交差状況を追跡することによって,低価格で高価格で売る取引信号を実現する.この戦略は,数学分析の基礎を持ち,市場変化に自律的に適応する.

戦略原則

戦略の核心は,価格の動的包囲帯を計算することです. まず,カスタマイズされた回顧期に基づいて価格 ((閉店価格,最高価格,最低価格) のナダラヤ-ワトソン核回帰曲線を構成し,平らな価格見積もりを得ます. その後,カスタマイズされたATR長さのベースでATR指標を計算し,近端因子と遠端因子を組み合わせて,上下包囲帯の範囲を得ます.

戦略的優位性

  1. 数学モデルに基づく,パラメータは制御可能で,過剰最適化には容易ではない.
  2. 市場の変化に適応し,価格と変動のダイナミックな関係を利用して取引の機会を捉える
  3. 対数座標を使用し,異なる時間周期と波動幅の品種をうまく処理できます
  4. カスタマイズ可能なパラメータの調整策の感度

戦略リスク

  1. 数学モデル理論化,リッドディスクのパフォーマンスが予想より低い
  2. 重要なパラメータの選択は経験が必要で,不適切な設定は収益に影響を及ぼす可能性があります.
  3. 取引の機会を逃したかもしれない.
  4. 市場が大きく揺れ動いた時,誤ったシグナルが出る可能性が高い.

これらのリスクは,主にパラメータの最適化,反省,影響要因の理解,慎重な実盤によって回避および軽減されます.

戦略最適化の方向性

  1. パラメータをさらに最適化して,最適なパラメータの組み合わせを見つけます.
  2. 機械学習による自動選択パラメータ
  3. フィルタリング条件を追加し,特定の市場環境で戦略を活性化します.
  4. 他の指標と組み合わせたフィルタリング
  5. 異なる数学モデルのアルゴリズムを試す

要約する

この戦略は,統計分析と技術指標分析を統合し,価格と変動率を動的に追跡することによって,低価格と高価格の取引シグナルを実現する.市場と自身の状況に応じてパラメータを調整することができる.全体的に,戦略の理論的基盤は堅牢であり,実際のパフォーマンスはさらに検証される必要がある.慎重に観察し,慎重に実態を観察する必要があります.

ストラテジーソースコード
/*backtest
start: 2022-12-04 00:00:00
end: 2023-12-10 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// © Julien_Eche
//@version=5

strategy("Nadaraya-Watson Envelope Strategy", overlay=true, pyramiding=1, default_qty_type=strategy.percent_of_equity, default_qty_value=20)

// Helper Functions
getEnvelopeBounds(_atr, _nearFactor, _farFactor, _envelope) => 
    _upperFar = _envelope + _farFactor*_atr
    _upperNear = _envelope + _nearFactor*_atr
    _lowerNear = _envelope - _nearFactor*_atr
    _lowerFar = _envelope - _farFactor*_atr
    _upperAvg = (_upperFar + _upperNear) / 2
    _lowerAvg = (_lowerFar + _lowerNear) / 2 
    [_upperNear, _upperFar, _upperAvg, _lowerNear, _lowerFar, _lowerAvg]

customATR(length, _high, _low, _close) =>
    trueRange = na(_high[1])? math.log(_high)-math.log(_low) : math.max(math.max(math.log(_high) - math.log(_low), math.abs(math.log(_high) - math.log(_close[1]))), math.abs(math.log(_low) - math.log(_close[1])))
    ta.rma(trueRange, length)

customKernel(x, h, alpha, x_0) =>
    sumWeights = 0.0
    sumXWeights = 0.0
    for i = 0 to h
        weight = math.pow(1 + (math.pow((x_0 - i), 2) / (2 * alpha * h * h)), -alpha)
        sumWeights := sumWeights + weight
        sumXWeights := sumXWeights + weight * x[i]
    sumXWeights / sumWeights

// Custom Settings
customLookbackWindow = input.int(8, 'Lookback Window (Custom)', group='Custom Settings')
customRelativeWeighting = input.float(8., 'Relative Weighting (Custom)', step=0.25, group='Custom Settings')
customStartRegressionBar = input.int(25, "Start Regression at Bar (Custom)", group='Custom Settings')

// Envelope Calculations
customEnvelopeClose = math.exp(customKernel(math.log(close), customLookbackWindow, customRelativeWeighting, customStartRegressionBar))
customEnvelopeHigh = math.exp(customKernel(math.log(high), customLookbackWindow, customRelativeWeighting, customStartRegressionBar))
customEnvelopeLow = math.exp(customKernel(math.log(low), customLookbackWindow, customRelativeWeighting, customStartRegressionBar))
customEnvelope = customEnvelopeClose
customATRLength = input.int(60, 'ATR Length (Custom)', minval=1, group='Custom Settings')
customATR = customATR(customATRLength, customEnvelopeHigh, customEnvelopeLow, customEnvelopeClose)
customNearATRFactor = input.float(1.5, 'Near ATR Factor (Custom)', minval=0.5, step=0.25, group='Custom Settings')
customFarATRFactor = input.float(2.0, 'Far ATR Factor (Custom)', minval=1.0, step=0.25, group='Custom Settings')
[customUpperNear, customUpperFar, customUpperAvg, customLowerNear, customLowerFar, customLowerAvg] = getEnvelopeBounds(customATR, customNearATRFactor, customFarATRFactor, math.log(customEnvelopeClose))

// Colors
customUpperBoundaryColorFar = color.new(color.red, 60)
customUpperBoundaryColorNear = color.new(color.red, 80)
customBullishEstimatorColor = color.new(color.teal, 50)
customBearishEstimatorColor = color.new(color.red, 50)
customLowerBoundaryColorNear = color.new(color.teal, 80)
customLowerBoundaryColorFar = color.new(color.teal, 60)

// Plots
customUpperBoundaryFar = plot(math.exp(customUpperFar), color=customUpperBoundaryColorFar, title='Upper Boundary: Far (Custom)')
customUpperBoundaryAvg = plot(math.exp(customUpperAvg), color=customUpperBoundaryColorNear, title='Upper Boundary: Average (Custom)')
customUpperBoundaryNear = plot(math.exp(customUpperNear), color=customUpperBoundaryColorNear, title='Upper Boundary: Near (Custom)') 
customEstimationPlot = plot(customEnvelopeClose, color=customEnvelope > customEnvelope[1] ? customBullishEstimatorColor : customBearishEstimatorColor, linewidth=2, title='Custom Estimation')
customLowerBoundaryNear = plot(math.exp(customLowerNear), color=customLowerBoundaryColorNear, title='Lower Boundary: Near (Custom)')
customLowerBoundaryAvg = plot(math.exp(customLowerAvg), color=customLowerBoundaryColorNear, title='Lower Boundary: Average (Custom)') 
customLowerBoundaryFar = plot(math.exp(customLowerFar), color=customLowerBoundaryColorFar, title='Lower Boundary: Far (Custom)')

// Fills
fill(customUpperBoundaryFar, customUpperBoundaryAvg, color=customUpperBoundaryColorFar, title='Upper Boundary: Farmost Region (Custom)')
fill(customUpperBoundaryNear, customUpperBoundaryAvg, color=customUpperBoundaryColorNear, title='Upper Boundary: Nearmost Region (Custom)')
fill(customLowerBoundaryNear, customLowerBoundaryAvg, color=customLowerBoundaryColorNear, title='Lower Boundary: Nearmost Region (Custom)')
fill(customLowerBoundaryFar, customLowerBoundaryAvg, color=customLowerBoundaryColorFar, title='Lower Boundary: Farmost Region (Custom)')


longCondition = ta.crossover(close, customEnvelopeLow)
if (longCondition)
    strategy.entry("Buy", strategy.long)

exitLongCondition = ta.crossover(customEnvelopeHigh, close)
if (exitLongCondition)
    strategy.close("Buy")