ブル・フラグ・ブレークアウト戦略

作者: リン・ハーンチャオチャン,日付: 2024-02-22 16:41:04
タグ:

img

概要

ブールフラグブレイクストラテジーは,ブールフラグチャートパターンを特定し,トレンドの開始を把握することを目的としたブレイクポイントにエントリーする技術分析戦略である.この戦略は,明確なフラグポールの後,入口機会をフィルタリングしてフラグ範囲を決定するのに役立つ平均真の範囲 (ATR) インジケーターを使用する.

戦略の論理

この戦略の主なステップは以下の通りです.

  1. フラグポールを決定する: 新高値とATRチャンネルのブレイクが必要です.
  2. ポール高度を決定する: ポールトップと前のSMAの距離を測定する.
  3. フラグの範囲を決定する: フラグの底は柱の高さの33%を最小範囲とする.
  4. フラグのパターンを識別します 最後の3つのバーが フラグの範囲内にあるかどうかを判断します
  5. 入力:フラグパターンが表示されたら長引く
  6. 出口: 固定された6バー後に閉じる位置.

フラグポールとフラグを判断する際,戦略はATR指標を巧みに活用して重要なブレイクを決定し,過剰な偽信号を避けるためにフラグの高さをポールの高さの33%以内に厳格に制限する.さらに,フラグを形成するために3つの連続バーを必要とすることが信頼性を向上させる.全体として,戦略規則は厳格に設計されており,初期のトレンドブレイクを捕捉する上でいくつかの利点があります.

利点分析

この戦略の主な利点は以下の通りである.

  1. フラグパターンを使ってトレンド開始を決定することは,高い成功率を持つクラシックな技術分析方法です.
  2. ATRと厳格な範囲制限は 誤信号を大量に回避し 入力精度を向上させます
  3. 6バーの出口ロックを固定して 利益を得て 逆転リスクを回避する
  4. 実行し,理解し,実行しやすい 明確なルール
  5. 様々な市場条件で 柔軟な機会を見つけることができます

リスク分析

この戦略の主なリスクは次のとおりです.

  1. フラグはトレンドを完全に決定できず 欠陥は依然として存在します
  2. 6バーの出口は早すぎるかもしれないし,出口は早すぎるかもしれない.
  3. 市場が乱れると 簡単に偽旗が生まれます
  4. 単一の損失額を効果的に制御できない.

上記のリスクに対処するために,ストップ・ロスを設定し,特定の利益比に達すると利益をロックする出口メカニズムを最適化することができます.また,不安定な市場で誤った信号を避けるために他の指標でフィルタリングすることができます.

オプティマイゼーションの方向性

戦略を最適化するためのいくつかの方向性:

  1. MACDやKDのような指標を組み合わせると 不安定な市場での誤った信号を避けるのです
  2. 適応性を向上させるため,市場体制に基づく ATR マルチプリキュア,脱出期間をパラメータ化します.
  3. ストップ・ロスを設定するか,ダイナミック・アウトアウトの利益引き下げ率を考慮します.
  4. フラグの高さを決定する より良い機能を見つけるために 機械学習アプローチを試してみてください
  5. 実際の勝利率と利益率を評価し ポジションのサイズを動的に調整します

結論

結論として,ブルフラグブレイクストラテジーは,トレンド開始を決定するために技術的なパターンを利用し,かなり古典的な方法であり,エントリールールは多くの偽信号をフィルタリングするために厳格に設計されています. しかし,リスク管理を改善し,戦略が十分な検証と最適化後に異なる市場で安定して動作できるように全体的に終了する余地があります. それは定量的な取引システムにおける貴重な構成要素になることができます.


/*backtest
start: 2024-01-22 00:00:00
end: 2024-02-21 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// © smith26
//This strategy enters on a bull flag and closes position 6 bars later.  Average true range is used instead of a moving average.
//The reason for ATR instead of MA is because with volatile securities, the flagpole must stand up a noticable "distance" above the trading range---which you can't determine with a MA alone.
//This is broken up into multiple parts: Defining a flagpole, defining the pole height, and defining the flag, which will be constrained to the top third (33%) of the pole height to be considered a flag.
//@version=4
strategy("Bull Flag v1.00", overlay=true)

ATR = atr(10) //Average True Range over last 10 bars.

upperATR = ohlc4[1] + ATR[1]  //Open + High + Low + Close divided by 4, + prior ATR.  Just used here for visually plotting the ATR upper channel.
lowerATR = ohlc4[1] - ATR[1] //Open + High + Low + Close divided by 4, - prior ATR.  Just used here for visually plotting the ATR lower channel.

//uncomment these two lines to see ATR channels
plot(upperATR, color=color.orange)
plot (lowerATR, color=color.orange)

//Current close higher than previous close, and current close minus current open is greater than 3 times the previous ATR.  "3x ATR" is chosen because any less was not a noticeable distance above the trading range.
flagpole1 = close>close[1] and (close-open) > (ATR[1] * 3)
plotshape(flagpole1, text="flagpole1", style=shape.arrowdown, size=size.huge) //Plots an arrow for flagpole1 for QA testing

//Two consecutive close higer than their previous close, and current close minus PREVIOUS open is greater than 3 times the previous ATR.
flagpole2 = close>close[1] and close[1]>close[2] and (close-open[1]) > (ATR[1] * 3)
plotshape(flagpole2, text="flagpole2", style=shape.arrowdown, size=size.huge, color=color.yellow) //Plots an arrow for flagpole2 for QA testing

//Three consecutive close higer than their previous close, and current close minus open from 2 bars ago is greater than 3 times the previous ATR.
flagpole3 = close>close[1] and close[1]>close[2] and close[2]>close[3] and (close-open[2]) > (ATR[1] * 3)
plotshape(flagpole3, text="flagpole3", style=shape.arrowdown, size=size.huge, color=color.white) //Plots an arrow for flagpole3 for QA testing

//A flagpole can be any of the three definitions of flagpole.
flagpole = flagpole1 or flagpole2 or flagpole3

//This will return the number of bars since "flagpole" was true.  Not being used, but could be useful.
//since_flagpole = barssince(flagpole)

after_pole_1 = flagpole[1] //This marks the bar directly after a flagpole.  
//plotshape(after_pole_1, text="after_pole_1", style=shape.cross, size=size.large, color=color.white) //Plots a cross for after_pole_1 for QA testing
after_pole_2 = flagpole[2] //This marks the bar two bars after a flagpole.  
after_pole_3 = flagpole[3] //This marks the bar three bars after a flagpole.  

//This returns the price at the "top" of the flagpole (using close price) at the most recent occurence, 0.
pole_top = valuewhen(flagpole, close, 0)
//plot(pole_top, trackprice=true)  //plots a horizontal line at the most recent pole_top

//Measures the distance between last pole top and the previous SMA.
pole_height = pole_top - sma(close, 10)[1] 
//plot(pole_height)

//This marks 33% below the pole_top, which will be the lowest point a flag can be.
flag_bottom = pole_top - (.33 * pole_height)
//plot(flag_bottom)

//The first, second, and third bars after the pole are considered part of a flag when open and close are between the pole_top and flag_bottom
flag1 = after_pole_1 and (open >= flag_bottom) and (open <= pole_top) and (close >= flag_bottom) and (close <= pole_top)
//plotshape(flag1, text="flag1", style=shape.flag, size=size.large, color=color.teal)
flag2 = after_pole_2 and (open >= flag_bottom) and (open <= pole_top) and (close >= flag_bottom) and (close <= pole_top)
//plotshape(flag2, text="flag2", style=shape.flag, size=size.large, color=color.teal)
flag3 = after_pole_3 and (open >= flag_bottom) and (open <= pole_top) and (close >= flag_bottom) and (close <= pole_top)
//plotshape(flag3, text="flag3", style=shape.flag, size=size.large, color=color.teal)

//When all three bars after a flagpole are a flag, the criteria are met and we have a "bull_flag"
//Specifically, when current bar is flag3, previous bar is flag2, and 2 bars ago is flag1, we have a bull_flag.
bull_flag = flag3 and flag2[1] and flag1[2]
plotshape(bull_flag, text="bull_flag", style=shape.flag, size=size.large, color=color.white) //Plots a flag for bull_flag for QA testing


if (bull_flag)
    strategy.entry("Long", strategy.long)

if barssince(bull_flag) == 6 //close 6 bars after entry.
    strategy.close("Long")

もっと