コンテンツにスキップ

Trend-Filtered_Squeeze_Breakout

EA0181_Trend-Filtered_Squeeze_Breakout_v1.0 / ⚠️ FAILED — 生成失敗・修正失敗・BT不合格

ワンライナー

Trend-Filtered Squeeze Breakout

判定: ⚫ 散(散る(検証に乗らず))

自律生成EA。エントリー不成立 or 検証未成立で評価対象外。量産の中で淘汰された一体。

自律生成ライン(網羅的に量産)

基本情報

項目 項目
シンボル EURUSD エントリー種別 volatility_squeeze
時間足 H4 エグジット trail_sl
方向 both 主要インジケータ

🧬 DNA 5軸

primary_style entry_mechanism regime_target position_logic core_indicator_family
trend_follow volatility_squeeze trending trail_sl volatility_band

📊 バックテスト結果

判定: ❌ FAIL / 期間: — 〜 —

PF 損益率 勝率 最大DD シャープ 取引数
0.40 -5.90% 50.0% 7.04% -0.16 4

📝 仕様書 / Specification

クリックで展開

リサーチEA仕様書: Trend-Filtered Squeeze Breakout

EA識別情報

  • EA名: REF0704_03_Trend_Filtered_Squeeze_Breakout_v1
  • 通貨ペア: GBPJPY
  • 時間足: H4
  • プライマリスタイル: trend_follow
  • エントリーメカニズム: volatility_squeeze
  • レジームターゲット: trending
  • ポジションロジック: trail_sl
  • コアインジケーター系統: volatility_band
  • キャプチャ意図: head (head=新規の頭を取る / middle=頭と尻尾を渡す / tail=枯れ際の反転を取る)

リサーチテーゼ

Trend-Filtered Squeeze Breakout candidate generated from 1 research source(s). The strategy must preserve the source idea while keeping parameters broad enough to survive out-of-sample testing.

根拠ソース

  • [BREAKOUT] ボラティリティブレイクアウト (ATR倍数) の方が単純レベル突破より統計的優位
  • [BREAKOUT] [CONTRA] 「ブレイクを買う」より「ブレイクの失敗を逆張る」方が PF 高いことが多い
  • [BREAKOUT] [FILTER] ロンドン/NYオープン直後のブレイクは continuation 率が高く、東京時間は反転率が高い
  • [BREAKOUT] [RISK] ブレイクアウト戦略は勝率 30-40% が普通、RR 1:3 以上が必須条件

トレード仕様

以下5点は必須です。いずれかが欠落・空欄の場合、この仕様書は不合格としてください。

1. Entry logic(エントリー条件)

Step 1 — Squeeze detection on bar[2] (historical): squeezeActive = (bb_upper[2] - bb_lower[2]) < InpSqueezeThresh * atr[2] (default InpSqueezeThresh=1.5). Step 2 — Breakout on bar[1]: close[1] > bb_upper[1] for BUY, close[1] < bb_lower[1] for SELL. CRITICAL: squeeze (step 1) must be checked on bar[2], breakout (step 2) on bar[1]. Checking both on the same bar is a logical contradiction — squeeze implies narrow BB, breakout outside BB implies wide move. They cannot coexist on the same bar.

2. Exit logic(決済条件)

Partial exit 50% at 1R (distance = entry to initial SL). Trail remaining 50%: ATR trailing stop at InpTrailATR * atr[1] (default InpTrailATR=2.0), only moving in profit direction — NEVER widen stop. Regime exit: if regime condition (volatile/trending) disappears — ADX drops below InpMinADX — close immediately. Time exit: close any open position after InpMaxBars bars (default=48) if still alive. Hard rule: initial SL is NEVER moved against position.

2.5 キャプチャ意図に基づく Exit Discipline (拘束)

キャプチャ意図: HEAD — Head capture: the thesis is to catch a new move from the start. SL must be tight because failed breakouts are the dominant failure mode; TP is wide and a trailing stop locks in the extension.

  • TP: ATR(14, bar[1]) × 3.5
  • SL: ATR(14, bar[1]) × 1.0
  • トレイル: +1.5*ATR 到達後にトレイル開始
  • 時間切れ: 30 bars
  • 部分決済: 部分決済なし

EA 実装ガードレール (絶対遵守):

  • Initial SL must be TIGHT (1.0*ATR or less) — failed breakouts are the main risk.
  • Trailing stop activates only AFTER +1.5*ATR favorable excursion.
  • TP is allowed to be wide (3.5*ATR) but a hard time exit at 30 bars caps the position.
  • Do NOT use partial close — head capture rides the whole move via trailing.

参考 MQL5 擬似コード (実装の出発点):

MQL
double atrAtEntry = iATR(_Symbol, _Period, 14)[1];
double tp = entryPrice + side * 3.5 * atrAtEntry;
double sl = entryPrice - side * 1.0 * atrAtEntry;  // TIGHT initial SL
// Trailing activates once trade reaches +1.5 * atrAtEntry favorable excursion.
if (favorableExcursion >= 1.5 * atrAtEntry) {
    double trailing = currentPrice - side * 1.5 * atrAtEntry;
    if ((side == +1 && trailing > currentSL) ||
        (side == -1 && trailing < currentSL)) {
        ModifyStop(trailing);
    }
}
if (barsHeld >= 30) { ClosePosition("head_time_exit"); }

上記の Exit Discipline は section 2 (Exit logic) と矛盾する場合、Exit Discipline を優先してください。 メカニズム別の Exit 指示は同方向性の確認、Capture Intent の指示は拘束的な数値規律です。

3. Risk management(資金管理)

Fixed fractional risk per trade, no martingale, no grid expansion, max one position per symbol, and hard daily loss guard.

4. Regime filter(レジームフィルター)

trending regime confirmation using SAME timeframe indicators only

5. Invalidation condition(無効化条件)

If walk-forward repeatedly shows OOS PF < 1.0 or trades collapse after loosening entry filters, archive the DNA.

5点構造チェック: 上記5セクションがすべて記載されていることを確認してください。

フィルター

  • Spread and session filter
  • Regime-specific confirmation filter from source evidence
  • Minimum ATR activity filter
  • Contrarian safety filter: after 3 consecutive losing trades, disable new entries for the next 10 bars

ロジック独立性要件

必須チェック(実装前に確認すること):

  • エントリーシグナル変数とレジームフィルター変数は独立したデータ源または独立したlookbackから計算すること
  • 悪い例: bullishCross = fastMA[1] > slowMA[1]isBearishRegime = fastMA[1] < slowMA[1] を AND 結合 → 同一バーで両立不可、取引ゼロになる
  • 正しいレジーム定義: slowMA[1] - slowMA[10] の傾き、上位足のMA方向、長い lookback(50本以上)の傾き
  • 全フィルターを AND 結合した時に、理論上発火できるバーが存在することをスケッチで確認すること
  • 逆張り戦略では「エントリー条件の否定 ≠ レジーム条件」になっているか必ず確認すること
  • RSI・BB・ATR など同一インジケーターを「シグナル源」と「フィルター源」の両方に使う場合、同じバーで矛盾する不等式を要求していないか確認すること
  • レジーム変数は1本のみ: bullishRegime (または uptrend 等) という bool 変数を1つ定義し、エントリー条件の AND に使うのはその1変数のみにすること。bullishRegime && regimeUp のように2本のレジーム変数を AND 結合することを禁止する。スロープ・価格位置・ADX など複数軸で判断したい場合は、それらを統合した1本の bool 変数にまとめてから AND に組み込むこと。

Primitive Execution Lane

  • レーン: VERIFIED
  • 検証済みprimitive:
  • entry:volatility_squeeze (prior squeeze then release trigger)
  • position:trail_sl (ATR/trend trailing after verified activation)
  • experimental primitive:
  • none
  • 判定理由:
  • All detected strategy and position mechanics map to verified primitives
  • 実装方針: 発想はentry/regime/filterに閉じ込め、発注・部分決済・建値移動・日次停止は検証済みprimitiveを使う。experimentalの場合は専用helperに隔離する。

最適化許容範囲

  • 緩和可能: 確証閾値、ATR活性閾値、セッションウィンドウ、シグナル確証バー数。
  • 緩和不可: 損切り規律、最大ポジション数1、過去の固定価格水準の不使用。
  • 明示的に正当化される場合のみ特殊アプローチを許可: ブローカー非対称性の活用、出金ありマーチンゲール戦略、逆張りセンチメントフェード、地政学イベント裁定、構造的レイテンシエッジ、量子風最適化、群知能ポジションサイジング、ゲーム理論的マーケットメイキング。
  • 特殊アプローチを使用する場合は以下を必須記載: (1) 1トレードおよび1日あたりの厳密なリスク上限(pips/%)、(2) キルスイッチ条件(取引停止条件)、(3) 構造的エッジの存在根拠、(4) エッジ消失時の標準ルールへのフォールバック。
  • 多様性指令: レジストリ内の既存EAがほとんどTREND系ならMRかBREAKOUTを生成。ほとんどテクニカル指標ベースなら、異常/季節/レジームベースまたは学際的(物理/生物/心理)アプローチを生成。未探索の角度を追求すること。
  • 初期最適化範囲: 3〜5パラメータのみ。
  • 取引ゼロの場合: まずエントリー確証を緩和、次にセッション制限、次にATR閾値を緩和。
  • 取引過多の場合: レジームフィルターと最小シグナル距離を強化。

バックテスト合格基準

  • Backtest at least 24 months with the latest 3 months held out.
  • Use walk-forward setting 4:2 when MT5 runner is available.
  • Reject if OOS/IS PF ratio is below 0.70 or if OOS PF min is below 1.10.
  • Reject if OOS trade count is below 15 trades per held-out window (minimum 30 total); first loosen entry filters before optimizing profit targets.
  • OOS PF is the only success metric. IS PF is parameter sanity, not the headline.
  • A profitable strategy must answer 'why does this work?' from a stated hypothesis (microstructure, behavioral bias, seasonal anomaly, regime shift). Chains of indicators with no thesis are presumed curve-fit.

過学習対策

  • Robust > Profitable. A PF=1.20 strategy that survives every OOS window beats a PF=2.50 one that wins in one window and crashes in another.
  • Keep each numeric parameter in a wide theory-backed range; do not tune to a single date range.
  • Use canonical defaults (RSI=14, ATR=14, BB=20/2, MA=20/50/200). Magic numbers (RSI=17, ATR=23, BB=18/1.7) are a red flag of curve-fitting unless the spec cites prior research justifying that exact value.
  • Limit optimization to 3-5 core parameters in the first pass.
  • Forbid AND-chains of more than 4 filters at entry. Each added filter shrinks sample size and looks like edge but is usually fit.
  • If a single time-of-day or day-of-week window dominates the trade history, the edge is calendar artifact, not strategy.
  • Prefer regime filters with clear market meaning over curve-fitted thresholds.
  • Stop improving the candidate after repeated NO_TRADE/LOW_SAMPLE failures.

学習フィードバック

  • [DIVERSITY-GRADE] variant: too_similar(max_sim=0.93 >= 0.7)

実装ガードレール

  • [PRIMITIVE-LANE: VERIFIED] Keep creativity in entry/regime/filter logic; use verified execution primitives only.
  • [PRIMITIVE-LANE: VERIFIED] Mapped primitives: entry:volatility_squeeze (prior squeeze then release trigger); position:trail_sl (ATR/trend trailing after verified activation).
  • [PRIMITIVE-LANE: VERIFIED] Do not introduce martingale/grid/latency/arbitrage execution mechanics during MQL5 generation.
  • [META] [RISK] [CONTRA] MT5 Strategy Testerは同名EAのinput値をキャッシュすることがあり、mq5側のinputデフォルトを変更して再コンパイルしても、BTでは前回値が使われる場合がある。inputデフォルト変更の検証では、別EA名/別ファイル名にするか、tester.ini/ExpertParametersで明示的に値を渡し、Testerログの「started with inputs」を必ず確認する。 (.clinerules)
  • [RISK] [META] [CONTRA] 【部分決済後のコメント管理パターン】MQL5ではPositionModifyでコメントを変更できないため、TP1部分決済後の状態管理にコメントプレフィックスを使う設計は「二重部分決済」リスクを内包する。対策として: (1)グローバルなulong配列でTP1済みチケットを管理する、(2)部分決済後に残りを即クローズ→新コメントで再エントリーする、のいずれかのパターンを採用すること。 (.clinerules)
  • [TREND] [BREAKOUT] [FILTER] [META] マルチタイムフレームEAでATR等のボラティリティ指標をCopyBufferする際、エントリー判定用の価格・MA(start_pos=1で確定足参照)とATR(start_pos=0で未確定バー参照)でstart_posが混在しやすい。設計方針として「全バッファのstart_posを統一する」か「ATRのみ最新値を使う理由をコメントで明記する」かを決めておくべき。 (.clinerules)
  • [RISK] DEAL_POSITION_IDによるトレード集計: 部分決済を含むポジションでは同一ポジション由来の複数DEALが発生する。連敗カウント等のトレード単位集計にはDEAL_COMMENTではなくDEAL_POSITION_IDを使用し、カウント済みIDを配列で管理することで重複計上を防ぐ。 (.clinerules)
  • [RISK] 【OnTradeTransactionによる決済検出パターン】ポジションクローズの検出にはOnTradeTransaction(trans.type == TRADE_TRANSACTION_DEAL_ADD && DEAL_ENTRY_OUT)を使用し、DEAL_POSITION_IDでエントリー管理配列と照合する設計が堅牢。HistorySelectによるポーリング方式より確実でリアルタイム性が高い。 (.clinerules)
  • [TREND] [BREAKOUT] [META] [A2] closes[], highs[], lows[]にはArraySetAsSeries(true)が設定されているが、adxValBufferにはArraySetAsSeries設定がない。また、TRBuffer/ATRBuffer/SMABufferはArrayResizeで固定長確保後にArraySetAsSeriesを呼んでいない(ただしこれらは実際にはCopyBufferで使用されていないため実害は限定的)。 (.clinerules)
  • [FILTER] SYMBOL_SPREADはポイント単位のlong値を返すため、価格単位に変換するには* _Pointを直接使用する (.clinerules)
  • [FILTER] スキャルピングEAでXAUUSD等のスプレッド変動が大きい銘柄を扱う場合、pips単位ではなく価格単位(ドル)でスプレッド閾値・トレランスを指定する設計が適切。_Digits==2環境ではpips×_Pointが意図しない極小値になる (.clinerules)

ストーリーパッケージ

  • フック: AIが研究メモから自律発掘した「Trend-Filtered Squeeze Breakout」をEA化して検証。
  • ブログアングル: 研究アイデアは本当にMT5で再現できるのか、OOSで崩れるかまで公開する。
  • 失敗アングル: 失敗時は NO_TRADE / LOW_SAMPLE / OVERFIT / HIGH_DD に分類して次の研究候補へ進む。

Spec Validation Warnings (auto-generated)

  • CONTRADICTION: Exit logic と Exit Discipline で時間切れバー数が矛盾
  • Fix: Exit Discipline を優先する仕様書の指示に従い、30 bars に統一すること。InpMaxBars のデフォルトを 30 に変更するか、コード生成時に Exit Discipline の値を使用すること
  • CONTRADICTION: Exit logic と Exit Discipline で部分決済の有無が矛盾
  • Fix: Exit Discipline を優先し、部分決済なしの単一ポジション・トレールのみに統一すること。Exit logic の Partial exit 記述を削除する
  • CONTRADICTION: Exit logic と Exit Discipline でトレール開始条件が矛盾
  • Fix: Exit Discipline を優先し、+1.5*ATR 有利幅到達後にトレール開始する方式に統一すること。InpTrailATR=2.0 の即時トレールではなく、発火条件を追加すること
  • WARNING: Exit logic と Exit Discipline で TP 設定が矛盾
  • Fix: Exit Discipline に明示的な TP=3.5*ATR を追加するか、仕様を統一すること。現状の Exit logic では TP が未定義で、Exit Discipline では TP が定義されている
  • WARNING: Exit logic と Exit Discipline で SL 幅が数値的に一致するが表現が異なる
  • Fix: Exit Discipline の 1.0*ATR を採用し、Exit logic にも明記すること。現状では section 2 の SL 計算式が欠落している
  • WARNING: Source Evidence に「ロンドン/NYオープン直後のブレイクは continuation 率が高く、東京時間は反転率が高い」とあるが、Filters セクションに具体的なセッション時間帯フィルター(ロンドン/NYオープンの時間ウィンドウ指定)が実装として記載されていない。Spread and session filter としか書かれておらず、時間帯の具体性が不足
  • WARNING: Regime filter に 'trending regime confirmation using SAME timeframe indicators only' とあるが、具体的な指標・閾値・計算式が記載されていない。ADX のみか、MA傾きも含むか不明。実装時にエントリーシグナル(BB squeeze/breakout)と独立したデータ源を確保する必要がある
  • WARNING: Minimum ATR activity filter の閾値・計算式が未記載。Entry logic の squeeze 判定で ATR[2] を使用しているが、これと独立した 'minimum ATR activity' の定義が不明
  • WARNING: Contrarian safety filter: 'after 3 consecutive losing trades, disable new entries for the next 10 bars' — これはエントリー抑制フィルターだが、部分決済なし(Exit Discipline)の前提では1トレードが完全勝敗となる。しかし Exit logic に部分決済が残っている場合、'losing trade' の定義が曖昧になる(50%決済時の損益基準)
  • WARNING: Entry logic の Step 1 で squeezeActive = (bb_upper[2] - bb_lower[2]) < InpSqueezeThresh * atr[2] とあるが、BB幅とATRの単位が異なる(BB幅は価格単位、ATRも価格単位だが、BBの標準偏差ベースとATRのレンジベースでスケールが異なる可能性)。InpSqueezeThresh=1.5 が理論的に妥当な範囲か検証が必要
  • WARNING: Entry logic の Step 2 で close[1] > bb_upper[1] とあるが、BUY breakout で close が BB upper を上回る場合、同時に bar[1] の ATR は拡大しているはず。これは 'squeeze on bar[2]' と時間分離されているため論理的には成立するが、実際の市場で bar[2] の squeeze から bar[1] の breakout への遷移が頻繁に起きるかはデータ依存
  • WARNING: Source Evidence の [CONTRA] 「ブレイクを買う」より「ブレイクの失敗を逆張る」方が PF 高いことが多い — これは本EAが trend-follow / breakout を採用していることに対する反論であり、テーゼとの整合性に注意が必要。ただしこれは戦略選択の警告であり、ロジック矛盾ではない

免責事項

本EAは自動生成された検証用コードです。実運用可否はご自身で検証してください。

EA1000 一覧に戻る


関連用語

— SPONSORED —