拡張性のあるブレイクアウト取引戦略

作者: リン・ハーンチャオチャン開催日:2023年10月30日 17:25:17
タグ:

img

概要

スケーラブル・ブレークアウト・トレーディング・ストラテジーは,価格変動によって識別された主要なサポートおよびレジスタンスレベルを価格が突破したときの取引信号を生成する.これは高度に柔軟で拡張可能なブレークアウト・ストラテジーである.このストラテジーは,パラメータを調整することによって異なるタイムフレームに適応し,最適化のために追加のフィルターとリスク管理メカニズムを簡単に統合することができる.

機能 する 方法

戦略はまず,swings()フォークバック期間をベースにスウィングの高低を計算する関数です.フォークバック期間は,フォークバック期間と設定されます.swingLookbackパラメータ,デフォルト20バー. 価格がスウィング・ハイを突破するとロング・シグナルが起動し,価格がスウィング・ローを突破するとショート・シグナルが起動します.

具体的には,閉じる価格がスウィング高価格よりも大きいまたはそれと同等であるとき,ロング信号が起動する.閉じる価格がスウィング低価格よりも小さいまたはそれと同等であるとき,ショート信号が起動する.

戦略は,stopTargetPercentストップ・ロスのレベルを定義するパラメータです.例えば,ロング・ストップ・ロスはスイング・ハイの 5%以下,ショート・ストップ・ロスはスイング・ローズの 5%以上に設定できます.

この戦略の利点は,取引頻度を制御するためにバックバック期間を調整する柔軟性である.より短いバックバック期間により,ブレイクアウトに敏感になり,取引頻度が増加する.より長いバックバック期間により,敏感性と取引頻度が低下するが,機会を逃す可能性がある.最適なバックバック期間を見つけることは戦略を最適化するために重要です.

利点

  • シンプルなブレークアウト論理,理解し,実装しやすい
  • チェックバック期間により,パラメータを最適化し,取引頻度を制御できます.
  • ストップ・ロスト,トライリング・ストップ,その他のリスク管理を簡単に統合
  • フィルターを追加し,収益性を向上させるため高度に拡張可能
  • 日中取引やスウィング取引の任意の時間枠に適用される

リスクと緩和策

  • 短すぎた回顧期間が過剰取引を引き起こす可能性があります
  • 長い見直し期間が取引機会を逃す可能性があります
  • ストップ・ロスは幅が大きすぎると利益の可能性が減る
  • ストップ・ロスは,頻繁に停止される可能性があります.

緩和策

  • 最適なパラメータを見つけるために異なるバックバック期間をテスト
  • ストップ・ロスのレベルを最適化して,利益とリスクのコントロールを均衡させる
  • 利潤をロックするために後退停止またはチェンデリア出口を追加します
  • 取引信号の品質を改善するためにフィルターを追加
  • バックテストによってパラメータを最適化

増進 の 機会

この戦略は,いくつかの方法で強化できます.

  1. 最適なパラメータを見つけるために異なる回顧期値をテストします.

  2. 5m,15m,1hなどの異なるタイムフレームをテストして 最適なタイムフレームを決定します

  3. ストップ・ロスの割合を最適化して 利益の可能性とリスク管理を バランスさせる

  4. 劣った設定を減らすため 音量や不安定性などのフィルターを追加します

  5. リスク管理のメカニズムを 統合します

  6. パラメータの最適化 ウォークフォワード分析と機械学習

  7. パラメータの自動最適化のために AI/機械学習を導入します

結論

スケーブルブレイクアウト・トレーディング・ストラテジーは,堅牢でカスタマイズ可能なブレイクアウト・システムである. ルーックバックを調整し,フィルターを追加することで,使いやすくて高度に適応可能である. リスク管理をリスク制御に簡単に統合することができる. パラメータ最適化と機械学習統合により,ストラテジーは変化する市場に適応するために時間とともに進化することができる. 全体的に,推奨される普遍的なブレイクアウト・ストラテジーである.


/*backtest
start: 2023-09-29 00:00:00
end: 2023-10-29 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/
// © deperp

//@version=5
// strategy("Range Breaker", overlay=true, initial_capital=100000, default_qty_type=strategy.percent_of_equity, default_qty_value=10, commission_type=strategy.commission.percent, commission_value=0.07, pyramiding=0)

// Backtest Time Period

useDateFilter = input.bool(true, title="Begin Backtest at Start Date",
     group="Backtest Time Period")
backtestStartDate = input(timestamp("1 Jan 2020"), 
     title="Start Date", group="Backtest Time Period",
     tooltip="This start date is in the time zone of the exchange " + 
     "where the chart's instrument trades. It doesn't use the time " + 
     "zone of the chart or of your computer.")

inTradeWindow = true

swingLookback = input.int(20, title="Swing Lookback", minval=3)
stopTargetPercent = input.float(5, title="Stop Target Percentage", step=0.1)

// Calculate lockback swings
swings(len) =>
    var highIndex = bar_index
    var lowIndex = bar_index
    var swingHigh = float(na)
    var swingLow = float(na)
    
    upper = ta.highest(len)
    lower = ta.lowest(len)
    
    if high[len] > upper
        highIndex := bar_index[len]
        swingHigh := high[len]

    if low[len] < lower
        lowIndex := bar_index[len]
        swingLow := low[len]

    [swingHigh, swingLow, highIndex, lowIndex]


// Strategy logic
[swingHigh, swingLow, highIndex, lowIndex] = swings(swingLookback)
longCondition = inTradeWindow and (ta.crossover(close, swingHigh))
shortCondition = inTradeWindow and (ta.crossunder(close, swingLow))

if longCondition
    strategy.entry("Long", strategy.long)
if shortCondition
    strategy.entry("Short", strategy.short)

longStopTarget = close * (1 + stopTargetPercent / 100)
shortStopTarget = close * (1 - stopTargetPercent / 100)

strategy.exit("Long Stop Target", "Long", limit=longStopTarget)
strategy.exit("Short Stop Target", "Short", limit=shortStopTarget)

// Plot break lines
// line.new(x1=highIndex, y1=swingHigh, x2=bar_index, y2=swingHigh, color=color.rgb(255, 82, 82, 48), width=3, xloc=xloc.bar_index, extend=extend.right)
// line.new(x1=lowIndex, y1=swingLow, x2=bar_index, y2=swingLow, color=color.rgb(76, 175, 79, 47), width=3, xloc=xloc.bar_index, extend=extend.right)


// Alert conditions for entry and exit
longEntryCondition = inTradeWindow and (ta.crossover(close, swingHigh))
shortEntryCondition = inTradeWindow and (ta.crossunder(close, swingLow))

longExitCondition = close >= longStopTarget
shortExitCondition = close <= shortStopTarget

alertcondition(longEntryCondition, title="Long Entry Alert", message="Enter Long Position")
alertcondition(shortEntryCondition, title="Short Entry Alert", message="Enter Short Position")
alertcondition(longExitCondition, title="Long Exit Alert", message="Exit Long Position")
alertcondition(shortExitCondition, title="Short Exit Alert", message="Exit Short Position")

もっと