Anomaly_Shock_Response¶
EA0152_Anomaly_Shock_Response_v1.0 / ⚠️ FAILED — 生成失敗・修正失敗・BT不合格
ワンライナー
Anomaly Shock Response
判定: ⚫ 散(散る(検証に乗らず))
自律生成EA。エントリー不成立 or 検証未成立で評価対象外。量産の中で淘汰された一体。
自律生成ライン(網羅的に量産)
基本情報¶
| 項目 | 値 | 項目 | 値 | |
|---|---|---|---|---|
| シンボル | GBPJPY | エントリー種別 | event_reaction | |
| 時間足 | H1 | エグジット | fixed_sl | |
| 方向 | both | 主要インジケータ | — |
🧬 DNA 5軸¶
| primary_style | entry_mechanism | regime_target | position_logic | core_indicator_family |
|---|---|---|---|---|
meta | event_reaction | volatile | fixed_sl | price_action |
📊 バックテスト結果¶
判定: ❌ FAIL / 期間: — 〜 —
| PF | 損益率 | 勝率 | 最大DD | シャープ | 取引数 |
|---|---|---|---|---|---|
| 2.58 | +1.61% | 80.0% | 2.00% | 4.51 | 15 |
📝 仕様書 / Specification¶
クリックで展開
リサーチEA仕様書: Anomaly Shock Response¶
EA識別情報¶
- EA名: REF0616_09_Anomaly_Shock_Response_v1
- 通貨ペア: USDCAD
- 時間足: H1
- プライマリスタイル: meta
- エントリーメカニズム: event_reaction
- レジームターゲット: volatile
- ポジションロジック: fixed_sl
- コアインジケーター系統: price_action
- キャプチャ意図: middle (head=新規の頭を取る / middle=頭と尻尾を渡す / tail=枯れ際の反転を取る)
リサーチテーゼ¶
Anomaly Shock Response 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.
根拠ソース¶
- Carry Trade & Seasonal Strategies
- [SEASONAL] [STATS] 月末最終3営業日はWMロイター仲値レートへの収束でドルが一時的に強くなる傾向が統計的に観測される
- [SEASONAL] [TREND] 12月はクリスマス休暇による流動性低下でスプレッド拡大、トレンド系は機能しにくい
- [SEASONAL] [FILTER] 米雇用統計 (NFP) 発表後最初の30分は方向性が確定しやすく、ブレイクアウトエントリー優位
- [SEASONAL] [MR] 月初の週 (1-5営業日) は機関の月次リバランスでドルが買われやすい傾向
トレード仕様¶
以下5点は必須です。いずれかが欠落・空欄の場合、この仕様書は不合格としてください。
1. Entry logic(エントリー条件)¶
Event reaction FADE entry without external news dependency: Detect an event shock from price itself: bar[1] true range > InpShockATR * atr14[2] (default 2.2) and tick volume on bar[1] > 50-bar average volume * InpVolumeMult (default 1.5). BUY fade: the shock candle sweeps down, has a lower wick > 50% of total range, and closes back above its midpoint; enter BUY on bar[0] open. SELL fade: the shock candle sweeps up, has an upper wick > 50% of total range, and closes back below its midpoint; enter SELL on bar[0] open. Context filter: use prior volatility context from bar[2] only — atrSma20[2] > atrSma100[2] * InpVolContextMult (default 1.10). This confirms an active event environment without reusing the shock candle as the regime filter. CRITICAL: fade mode is fixed by this DNA; do not add an input that switches to continuation mode. The EA reads market reaction only and must not depend on a calendar API or future news labels.
2. Exit logic(決済条件)¶
Take profit: shock candle midpoint first, then 1.2R if midpoint is already crossed at entry. Stop loss: fixed beyond the shock candle extreme by 0.3*ATR(14). Time exit: close after InpMaxBars (default=6 on H1, 12 on M15) because event-fade edge decays quickly. Invalidation exit: if the next bar closes beyond the shock extreme in the original shock direction, close immediately. Do not open a second trade from the same shock event.
2.5 キャプチャ意図に基づく Exit Discipline (拘束)¶
キャプチャ意図: MIDDLE — Middle capture: give up the head and the tail. The EA must not chase the extension; it locks in a measured portion and steps aside.
- TP: ATR(14, bar[1]) × 1.5
- SL: ATR(14, bar[1]) × 1.5
- トレイル: トレイル禁止
- 時間切れ: 15 bars
- 部分決済: +1.0*ATR で 50% 部分決済 + 残りは建値SLへ
EA 実装ガードレール (絶対遵守):
- NEVER add a trailing stop — middle capture forbids tail-chasing.
- TP and SL are equal in ATR multiples (1.5 each); do NOT widen TP > SL.
- Time exit at 15 bars is mandatory; do NOT extend in pursuit of further gains.
- Partial close at +1.0*ATR with BE stop is the only allowed exit refinement.
参考 MQL5 擬似コード (実装の出発点):
double atrAtEntry = iATR(_Symbol, _Period, 14)[1];
double tp = entryPrice + side * 1.5 * atrAtEntry;
double sl = entryPrice - side * 1.5 * atrAtEntry;
// NO trailing stop — middle capture explicitly refuses to chase the tail.
// Partial close: close 50% of position at +1.0 * atrAtEntry favorable excursion.
if (favorableExcursion >= 1.0 * atrAtEntry && !partialClosed) {
ClosePartial(0.5); partialClosed = true;
// Move remaining stop to break-even.
ModifyStop(entryPrice);
}
// Time exit: 15 bars from entry, regardless of P/L.
if (barsHeld >= 15) { ClosePosition("middle_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(レジームフィルター)¶
Use prior volatility context only: atrSma20[2] > atrSma100[2] * InpVolContextMult (default 1.10), evaluated before the shock candle. The shock candle itself is the entry trigger, not the regime filter.
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 sample count filter before accepting optimization
- 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 に組み込むこと。
最適化許容範囲¶
- 緩和可能: 確証閾値、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-EXPLORE] Base DNA pool was saturated; this candidate pivots to an exploratory DNA axis.
実装ガードレール¶
- [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)
- [TREND] [FILTER] スプレッドリトライパターン(予約エントリーのスプレッド不良時リトライ): 予約フラグ方式でスプレッド不良時に即破棄せず、MAX_SPREAD_RETRY回まで次バーで再試行する設計。リトライカウンターは予約フラグと同時にリセットし、クールダウンや金曜制限等の他条件で予約破棄する際もリセットを忘れないこと。リトライの粒度(ティック単位 vs バー単位)を設計時に明確にすべき。 (.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)
- [STATS] [META] スリッページ許容値(SetDeviationInPoints)はinputパラメータ化することで、バックテストや運用時の調整が容易になる (.clinerules)
- [TREND] [BREAKOUT] [META] [A2] closes[], highs[], lows[]にはArraySetAsSeries(true)が設定されているが、adxValBufferにはArraySetAsSeries設定がない。また、TRBuffer/ATRBuffer/SMABufferはArrayResizeで固定長確保後にArraySetAsSeriesを呼んでいない(ただしこれらは実際にはCopyBufferで使用されていないため実害は限定的)。 (.clinerules)
ストーリーパッケージ¶
- フック: AIが研究メモから自律発掘した「Anomaly Shock Response」をEA化して検証。
- ブログアングル: 研究アイデアは本当にMT5で再現できるのか、OOSで崩れるかまで公開する。
- 失敗アングル: 失敗時は NO_TRADE / LOW_SAMPLE / OVERFIT / HIGH_DD に分類して次の研究候補へ進む。
免責事項
本EAは自動生成された検証用コードです。実運用可否はご自身で検証してください。
関連用語¶
- 用語集 - バックテスト
- 用語集 - 勝率
- 用語集 - スプレッド
- 用語集 - ATR
- 用語集 - RSI
- 用語集 - マルチタイムフレーム
- 用語集 - ボラティリティ
- 用語集 - CopyBuffer
- 用語集 - スリッページ
- 用語集 - ArraySetAsSeries
- 用語集 - SMA
- 用語集 - ArrayResize