実際の範囲に基づく重度の移動平均のクロス期戦略

作者: リン・ハーンチャオチャン開催日:2024年1月17日15時09分28秒
タグ:

img

概要

この戦略は,トレンド判断のためのクロス期指標を構築するためにTrue RangeとWMAを使用している.同時に,安定した利益を追求するために複数のストップロストメカニズムを持つピラミッドポジション蓄積メカニズムを持っています.

戦略原則

この戦略は,まず上方振幅 (sube) と下方振幅 (baja) を計算し,次に順に高速線 (corto) サイクルと遅い線 (largo) サイクルのWMAを計算する.高速線と遅い線の差は,インダクト (ind) を得るためにWMAを通じて再び計算される.インダクトが0を超えると購入信号が生成される.0を下回ると販売信号が生成される.

市場に入場後,戦略は5つのポジションを事前に設定し,ピラミッド (倍増) 方式で累積します.同時に,ストップ・ロスのメカニズムが設定され,リスクを制御するために,現在の浮動利益がストップ・ロスの線を下回っているかどうかを判断するために,次のポジションを開設されます.

利点分析

戦略には,クロスサイクル判断,ピラミッドポジション蓄積,複数のストップ損失などのメカニズムが統合されており,リスクを効果的に制御し,安定した利益を追求することができます.

クロスサイクル判断は,高速線と遅い線の組み合わせを通じてトレンド判断システムを確立し,市場のノイズを効果的にフィルタリングし,トレンドターニングポイントを特定することができます.ピラミッドポジションはトレンドの開始時により多くの利益を得ることができ,複数のストップ・ロストメカニズムは単一の損失を効果的に制御することができます.

リスク分析

この戦略の主なリスクは,急激な市場の逆転を引き起こし,ストップ・ロスのカットオフを誘発し損失を引き起こす突然の出来事の可能性です. さらに,適切なパラメータ設定は戦略の安定性にも影響を与えます.

ストップ・ロスの線を適切に緩和することで,市場の逆転のリスクに対処できます.パラメータ設定を最適化し,サイクルパラメータ,ポジション数,などを調整することで,戦略の安定性が向上します.

最適化方向

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

  1. 判断のための統計指標を増やし 変動性やボリュームなどの指標を使用して パラメータを修正し 戦略をより適応可能にする

  2. 判断のための機械学習モデルを増やし,判断を支援し,戦略の精度を向上させるためにLSTMやその他のディープラーニングモデルを使用します.

  3. ポジション管理のメカニズムを最適化し,ポジションの成長幅を変動利益率に合わせて調整することを検討し,ポジションの成長をより合理的にする.

  4. フューチャー・ヘージング・モデルを導入し,スポット・フューチャー・アービタージを通じてリスクをさらに制御する.

概要

概要すると,これはピラミッドポジション蓄積と複数のストップ損失メカニズムを持つTrue Range指標に基づくクロスサイクルのトレンド戦略であり,リスクを効果的に制御し,安定した利益を追求することができます.これは非常に実践的な定量的な取引戦略です.しかし,リスクの逆転とパラメータ最適化問題には依然として注意が必要です.統計,機械学習などの側面でさらなる最適化を行うことができます.


/*backtest
start: 2023-01-10 00:00:00
end: 2024-01-16 00:00:00
period: 1d
basePeriod: 1h
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/
// © MaclenMtz

//@version=5
strategy("[MACLEN] Rangos", shorttitle="Rangos [https://t.me/Bitcoin_Maclen]", overlay=false )

//------WINDOW----------

i_startTime = input(defval = timestamp("01 Jan 2022 00:00 -0700"), title = "Start Time", group = "Backtest Window")
i_endTime = input(defval = timestamp("31 Dec 2025 00:00 -0700"), title = "End Time")
window = true

//-----------------------------

sube = close>close[1] ? ta.tr : 0
baja = close<close[1] ? ta.tr : 0

corto = input(10)
largo = input(30)
suavizado = input(10)

fastDiff = ta.wma(sube, corto) - ta.wma(baja,corto)
slowDiff = ta.wma(sube, largo) - ta.wma(baja, largo)
ind = ta.wma(fastDiff - slowDiff, suavizado)

iColor = ind>0 ? color.green : ind<0 ? color.red : color.black
plot(ind, color=iColor)
plot(0, color=color.white)

long = ind[1]<ind and ind[2]<ind[1] and ind<0
short = ind[1]>ind and ind[2]>ind[1] and ind>0

plotshape(long and not long[1], style = shape.xcross, color=color.green, location=location.bottom, size=size.tiny)
plotshape(short and not short[1], style = shape.xcross, color=color.red, location=location.top, size=size.tiny)

//Contratos
contrato1 = input(50000)/(16*close)
c1 = contrato1
c2 = contrato1
c3 = contrato1*2
c4 = contrato1*4
c5 = contrato1*8

//cap_enopentrade = strategy.opentrades == 1 ? c1: strategy.opentrades == 2 ? c1+c2: strategy.opentrades == 3 ? c1+c2+c3: strategy.opentrades == 4 ? c1+c2+c3+c4: strategy.opentrades == 5 ? c1+c2+c3+c4+c5 : 0
openprofit_porc = math.round((close-strategy.position_avg_price)/strategy.position_avg_price * 100,2)

porc_tp = input.float(6.5)
safe = input(-6)

//----------------Strategy---------------------------

if strategy.opentrades == 0
    strategy.entry('BUY1', strategy.long, qty=c1, when = long and not long[1] and window)

if strategy.opentrades == 1
    strategy.entry('BUY2', strategy.long, qty=c2, when = long and not long[1] and window and openprofit_porc<safe)

if strategy.opentrades == 2
    strategy.entry('BUY3', strategy.long, qty=c3, when = long and not long[1] and window and openprofit_porc<safe)

if strategy.opentrades == 3
    strategy.entry('BUY4', strategy.long, qty=c4, when = long and not long[1] and window and openprofit_porc<safe)

if strategy.opentrades == 4
    strategy.entry('BUY5', strategy.long, qty=c5, when = long and not long[1] and window and openprofit_porc<safe)

min_prof = strategy.openprofit>0

strategy.close_all(when=short and min_prof)

plot(openprofit_porc)


もっと