クリプトトレンド逆転戦略

作者: リン・ハーンチャオチャン,日付: 2024-01-12 14:13:36
タグ:

img

概要

この戦略は,PIVOT スウィングの高低点およびブレイクアウトシグナルに基づいて暗号資産のトレンド逆転を特定する.これはブレイクアウト逆転戦略カテゴリーに属している.この戦略は,先ずPIVOTレベルとして最近の最高値と最低値を計算し,価格がこれらのキーレベルを突破した場合を検出し,主要なトレンド変化をシグナル化する.

戦略 の 働き方

  1. PIVOT 高点/低点を計算する

    ta.pivothigh ((() と ta.pivotlow ((() を使って,PIVOTポイントをプロットするために,カスタムバーバック期間の最高高値と最低低値を見つけます.

  2. 突破 信号 を 識別 する

    価格がPIVOT低点以上を突破したり,PIVOT高点以下を突破したりすると,戦略はそれをトレンド逆転信号とみなします.

  3. フィルタ条件を設定する

    重要な距離でPIVOTレベルを突破する価格が必要で,閉じる価格は 150バーの閉じる価格を突破します.

  4. 入口と出口

    トリガー・バイ・シグナルはロング条件で ロングポジションは出口条件で閉じる

利点

  1. PIVOT ポイントは,主要なトレンドシフトに敏感です.
  2. フィルターで統合の傾向を回避する
  3. スウィング・ハイ/ロー・ブレイクで早速逆転を捉える

リスク

  1. より大きなサイクルが 戦略を壊す可能性があります
  2. PIVOT ポイントとフィルターは,各資産の調整が必要です.
  3. 交換手数料の影響結果,ゼロに近い手数料構造が必要

増進 の 機会

  1. 異なるPIVOT回顧期間のテスト
  2. 取引ごとに制御損失に移動ストップ損失を追加する
  3. フィルターのための他の指標と組み合わせる

結論

この戦略は,大きな逆転を捉えるために全体的に堅牢ですが,資産ごとにカスタマイズされたパラメータとリスク制御が必要です.さらなる最適化とガードレールにより,暗号市場全体で良好なパフォーマンスを発揮できます.


/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © nkrastins95

//@version=5
strategy("Swing Hi Lo", overlay=true, margin_long=100, margin_short=100)

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

tf = input.timeframe(title="Timeframe", defval="")

gr="LENGTH LEFT / RIGHT"
leftLenH = input.int(title="Pivot High", defval=10, minval=1, inline="Pivot High",group=gr)
rightLenH = input.int(title="/", defval=10, minval=1, inline="Pivot High",group=gr)
colorH = input(title="", defval=color.red, inline="Pivot High",group=gr)

leftLenL = input.int(title="Pivot Low", defval=10, minval=1, inline="Pivot Low", group=gr)
rightLenL = input.int(title="/", defval=10, minval=1, inline="Pivot Low",group=gr)
colorL = input(title="", defval=color.blue, inline="Pivot Low",group=gr)

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

pivotHigh(ll, rl) =>
    maxLen = 1000
    float ph = ta.pivothigh(ll, rl)
    int offset = 0
    while offset < maxLen
        if not na(ph[offset])
            break 
        offset := offset + 1
    ph[offset]

pivotLow(ll, rl) =>
    maxLen = 1000
    float pl = ta.pivotlow(ll, rl)
    int offset = 0
    while offset < maxLen
        if not na(pl[offset])
            break 
        offset := offset + 1
    pl[offset]


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

ph = request.security(syminfo.tickerid, tf, pivotHigh(leftLenH, rightLenH), barmerge.gaps_off, barmerge.lookahead_on)
pl = request.security(syminfo.tickerid, tf, pivotLow(leftLenL, rightLenL), barmerge.gaps_off, barmerge.lookahead_on)

drawLabel(_offset, _pivot, _style, _color) =>
    if not na(_pivot)
        label.new(bar_index[_offset], _pivot, str.tostring(_pivot, format.mintick), style=_style, color=_color, textcolor=#131722)

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

VWAP = ta.vwap(ohlc4)

longcondition = ta.crossunder(close,pl) and close > close[150]
exitcondition = close > ph

shortcondition = ta.crossover(close,ph) and close < close[150]
covercondition = close < pl

strategy.entry("long", strategy.long, when = longcondition)
strategy.close("long", when = exitcondition)

strategy.entry("Short", strategy.short, when = shortcondition)
strategy.close("Short", when = covercondition)

もっと