XAUUSD RegimeShift Startegy

MQL5 Uzmanlar

Şartname

Yes. The final “world-class” RegimeShift concept we converged on is an adaptive hybrid EA, not a single trend EA and not a pure recovery EA.

The key idea is:

Classify the market first → select the correct engine → size dynamically → stop using that engine when its market thesis is invalid.

That is the part I would preserve as the final architecture.

RegimeShift — Final Strategy Architecture

Layer Final role
H1 Macro context / large directional pressure
M15 Primary regime classification
M5 Structure, breakout and pullback geometry
M1 Execution timing, shocks and microstructure
M3 Optional fast trend-danger monitor, especially for Range/recovery baskets
Tick data Spread, velocity, shock, execution quality

The EA maintains persistent states rather than switching on every candle:

RANGE → BREAKOUT_READY → TREND_UP / TREND_DOWN → TRANSITION → SHOCK/COOLDOWN.

TrendScore and RangeScore are independent scores, not opposites. Volatility, execution quality and shock risk are additional independent dimensions.

1. RANGE engine

Only operate when there is credible range structure and no accepted breakout.

The range engine uses small initial exposure and bounded same-direction recovery, but no longer follows a blind fixed martingale ladder.

After every fill it recalculates:

\[ Q_{next}=f( RangeQuality,\ Overshoot,\ ReversalEvidence,\ Volatility, TrendRisk,\ Spread,\ Margin,\ BasketStress) \]

Therefore the next layer can be:

increase / same size / smaller / skipped entirely.

The latest safety direction was:

Stage Behaviour
P1–P2 Normal
P3 Begin enhanced observation
P4 Final normal recovery layer / conditional rescue zone
P5 equivalent Risk-management state, not another automatic layer
P6+ No blind progression

This is one of the most important changes from original Latex.

The historical P14-style sequence:

0.01 → .02 → .03 → .05 → .08 → .13 → .22 → ...

must never remain an automatic progression.

2. P4/P5 risk router

When a range basket deteriorates, the EA doesn't simply keep averaging.

At P3 it starts measuring velocity, trend persistence and rebound quality.

At P4, it becomes eligible for a conditional rescue/controlled exit.

If the market continues to deteriorate toward what would previously have been P5/P6, the range thesis is considered damaged.

Then RegimeShift chooses among:

natural rebound exit, small-loss exit, one directional rescue, or hard bounded exit.

The rescue is not a recurring martingale. At most one rescue campaign is allowed.

For the OCO-rescue research, our better region was around:

  • rescue trigger roughly $0.30
  • desired rescue continuation roughly $0.75–$1.00
  • one rescue only
  • strict maximum rescue lot
  • close the entire campaign when liquidation P/L reaches the required BE/small-profit target.

A $0.25 recovery target was rejected because required rescue leverage became excessive.

3. BREAKOUT / TREND engine

Once an actual range breakout is accepted, the EA stops behaving like a mean-reversion system.

The final trend sequence was:

structure → breakout → sustained acceptance → pullback → reacceptance → entry.

Not:

price crosses level → immediately chase .

A trend campaign uses a structural stop and splits exposure into approximately:

Core + Anchor Runner.

The intended allocation is roughly:

\[ 65\% \ Core + 35\% \ Runner \]

subject to broker-valid lot increments.

Core takes the nearer structural/R target.

Anchor stays with the trend and is managed by structural/staged trailing.

Only after profits are secured can the EA pyramid.

4. Trend pyramiding

Pyramiding is profit-funded, never loss-funded.

Each additional layer must be supported by:

  • realized profit from earlier positions;
  • broker-protected open profit;
  • continued structural trend acceptance;
  • adequate remaining room;
  • acceptable execution/spread.

Maximum conceptually around four additional decreasing-risk layers, but the EA may add fewer or none.

The crucial rule:

No averaging down inside the Trend engine.

If the trend thesis fails, reduce or exit.

Do not turn a failed trend trade into a recovery basket.

5. Engine switching

This is what makes RegimeShift different from combining two unrelated EAs.

A campaign has one market thesis at a time.

For example:

RANGE → accepted upside breakout

does not mean:

keep SELL recovery + start BUY trend positions .

Instead:

freeze new range risk → evaluate/flatten damaged range exposure → require transition confirmation → then allow fresh TREND_UP campaign.

Likewise:

TREND → range

means harvest/exit the trend campaign before a new range campaign begins.

No uncontrolled strategy overlap.

6. TRANSITION and SHOCK

These are genuine NO-NEW-RISK states.

In TRANSITION:

  • no fresh range basket;
  • no fresh trend campaign;
  • pending orders may be cancelled/recentered;
  • existing exposure is managed defensively.

In SHOCK:

  • cancel unfilled pending risk;
  • freeze recovery additions;
  • do not pyramid;
  • concentrate on existing-risk reduction.

Actual XAU movement velocity is important here, not just indicators.

Our forensic work showed that very fast adverse moves are disproportionately associated with deep baskets. So RegimeShift should continuously measure:

\[ \Delta P_{3s},\Delta P_{10s},\Delta P_{30s},\Delta P_{60s} \]

along with ATR-normalized versions.

7. Scheduled-news protection

News is a separate risk dimension, not part of TrendScore.

The architecture supports two set-file profiles.

Conservative: curated major USD events can block the whole trading day.

Typical Tier-A events:

NFP/main jobs report, CPI/Core CPI, FOMC rate decision, FOMC Minutes, PCE/Core PCE, GDP and major Fed Chair events.

Medium: use configurable pre/post blackout windows instead.

The original trend build used approximately 60/45 minutes for Tier-1 and 30/25 for other high-impact events, while the later Latex research showed why whole-day blocking may be preferable for the conservative profile.

Existing exposure before news is handled independently: small exposure can be flattened, pending orders cancelled, and damaged baskets prevented from adding new risk.

8. Sessions

The EA must not interpret every hour as equivalent.

The original trend research used approximately:

07:00–12:00
12:30–17:00

with first-session minutes blocked and rollover around:

23:45–00:45

excluded.

But these remain set-file parameters, not buried logic.

Session profile, news profile and risk profile should be selectable without changing strategy code.

9. Risk model

The final Trend architecture used approximately:

\[ 0.25\% \text{ planned event risk} \]

with a source hard ceiling around:

\[ 0.50\% \]

For the hybrid version, risk should be campaign-based rather than “risk per order”.

Before any new exposure:

\[ ProjectedWorstLoss = CurrentLiquidationLoss+ NewPositionRisk+ SlippageBuffer+ Commission+ GapStress \]

and:

\[ ProjectedMarginLevel > MinimumSafeMargin \]

must both pass.

The EA also needs independent:

basket hard loss, campaign hard loss, daily soft loss, daily hard loss, weekly hard loss, max time underwater, margin floor, spread guard, execution-fault guard and shock guard.

A hard daily loss means:

flatten managed exposure when required → delete pending risk → lock trading until next configured risk-day reset.

A soft loss means:

stop initiating new campaigns → manage the current one → restart only after defined stabilization criteria.

10. Restart after soft protection

This should not simply use:

wait 30 minutes → start again .

Restart should require time + market evidence.

For example:

\[ Restart = CooldownComplete \land SpreadNormal \land ShockCleared \land RegimeStable \land NoExecutionFault \]

and for Range specifically:

\[ RangeScore > Threshold \land TrendRisk < Threshold \land StructureStable \]

for several completed observations.

Likewise a Trend engine restart requires a fresh structural event, not reuse of the failed setup.

11. Profit protection

Campaign profit protection is monotonic.

Once a campaign earns and secures profit:

future risk cannot be allowed to convert a meaningfully secured campaign into an uncontrolled loss.

Trend pyramids are funded from secured profit.

Range rescue cannot exceed a predefined campaign-risk allowance.

Newest/additional positions are generally reduced first; strategic anchor exposure survives longest when the structure remains valid.

12. Reversal

No instant “BUY → SELL → BUY” flipping.

A reversal sequence is:

invalidate old thesis → close old campaign → verify flat/reconciled state → fresh opposite confirmation → new campaign ID.

This is especially important for rescue logic. We rejected repeated OCO/rescue flipping because it can turn into a high-volume whipsaw machine.


The final state machine

Conceptually, this is the clean version:

FLAT │ REGIME CLASSIFIER │ ┌────────────────┼─────────────────┐ │ │ │ RANGE BREAKOUT_READY TRANSITION/SHOCK │ │ │ Range Engine wait/confirm NO NEW RISK │ │ P1/P2 accepted breakout │ │ P3 ↓ Observe Pullback + Reaccept │ │ P4 TREND CAMPAIGN │ │ Risk Router Core + Anchor / | \ │ rebound rescue exit profit funded │ │ │ pyramids └──────┴─────┘ │ │ Harvest/Exit FLATTEN │ └──────────→ FLAT ←──┘

Machine learning / deep learning

We deliberately did not make ML the live decision-maker for version 1.

The production engine should remain explainable and deterministic.

ML can run in shadow mode, initially something like an HMM/regime model or calibrated classifier, taking features such as:

\[ TrendScores,\ RangeScores,\ ATR,\ ER,\ ADX,\ velocity, spread,\ session,\ news,\ depth,\ basket MAE,\ rebound \]

and predicting things such as:

\[ P(\text{trend continuation}) \]\[ P(\text{return to basket BE before next adverse level}) \]\[ P(\text{P8-style tail} \mid current state) \]

Only after strong walk-forward evidence would ML be permitted to alter live routing. Initially it merely logs:

RULE_DECISION versus ML_SHADOW_DECISION .

That protects us from building a sophisticated overfit model.


The two set files I would ultimately maintain

RegimeShift_CONSERVATIVE.set would use full-day Tier-A blocking, stricter Range acceptance, P4 as the last normal recovery layer, smaller campaign/daily risk, stronger stabilization requirements and no discretionary deeper recovery.

RegimeShift_MEDIUM.set would use narrower news windows, allow slightly broader Range participation, possibly permit one rigorously qualified rescue/extra recovery action, and use somewhat less restrictive regime thresholds.

The strategy code remains identical. Only the risk envelope changes.

So, in one sentence, the final RegimeShift philosophy is:

Exploit mean reversion only while the market demonstrably remains a range; switch to structural continuation only after a breakout proves itself; when neither thesis is reliable, do nothing; and never allow recovery sizing to substitute for an invalidated market thesis.

That is the architecture I would use as the master design for the world-class RegimeShift EA.


Yanıtlandı

1
Geliştirici 1
Derecelendirme
(286)
Projeler
358
29%
Arabuluculuk
37
27% / 65%
Süresi dolmuş
10
3%
Çalışıyor
2
Geliştirici 2
Derecelendirme
(400)
Projeler
518
24%
Arabuluculuk
61
57% / 25%
Süresi dolmuş
60
12%
Çalışıyor
3
Geliştirici 3
Derecelendirme
(436)
Projeler
645
53%
Arabuluculuk
35
63% / 20%
Süresi dolmuş
6
1%
Yüklendi
4
Geliştirici 4
Derecelendirme
(73)
Projeler
94
56%
Arabuluculuk
5
80% / 20%
Süresi dolmuş
2
2%
Yüklendi
5
Geliştirici 5
Derecelendirme
(182)
Projeler
196
46%
Arabuluculuk
4
50% / 25%
Süresi dolmuş
1
1%
Yüklendi
6
Geliştirici 6
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
7
Geliştirici 7
Derecelendirme
(1)
Projeler
1
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
Yayınlandı: 2 kod
8
Geliştirici 8
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
9
Geliştirici 9
Derecelendirme
(42)
Projeler
112
56%
Arabuluculuk
2
50% / 0%
Süresi dolmuş
3
3%
Serbest
Yayınlandı: 1 kod
10
Geliştirici 10
Derecelendirme
(623)
Projeler
727
34%
Arabuluculuk
47
49% / 40%
Süresi dolmuş
14
2%
Yüklendi
11
Geliştirici 11
Derecelendirme
(2676)
Projeler
3415
68%
Arabuluculuk
77
48% / 14%
Süresi dolmuş
343
10%
Çalışıyor
Yayınlandı: 1 kod
12
Geliştirici 12
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
13
Geliştirici 13
Derecelendirme
(1)
Projeler
1
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
Yayınlandı: 4 kod
14
Geliştirici 14
Derecelendirme
(16)
Projeler
30
40%
Arabuluculuk
3
33% / 67%
Süresi dolmuş
7
23%
Çalışıyor
15
Geliştirici 15
Derecelendirme
(319)
Projeler
571
35%
Arabuluculuk
83
31% / 45%
Süresi dolmuş
206
36%
Çalışıyor
16
Geliştirici 16
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
17
Geliştirici 17
Derecelendirme
(211)
Projeler
274
21%
Arabuluculuk
25
52% / 16%
Süresi dolmuş
0
Yüklendi
18
Geliştirici 18
Derecelendirme
(59)
Projeler
93
43%
Arabuluculuk
4
0% / 100%
Süresi dolmuş
4
4%
Çalışıyor
19
Geliştirici 19
Derecelendirme
(20)
Projeler
28
39%
Arabuluculuk
8
25% / 38%
Süresi dolmuş
2
7%
Yüklendi
Yayınlandı: 8 makale, 35 kod
20
Geliştirici 20
Derecelendirme
(1)
Projeler
1
0%
Arabuluculuk
0
Süresi dolmuş
1
100%
Serbest
21
Geliştirici 21
Derecelendirme
(9)
Projeler
11
27%
Arabuluculuk
0
Süresi dolmuş
2
18%
Çalışıyor
Yayınlandı: 1 kod
22
Geliştirici 22
Derecelendirme
(64)
Projeler
144
46%
Arabuluculuk
21
38% / 24%
Süresi dolmuş
32
22%
Serbest
23
Geliştirici 23
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Çalışıyor
24
Geliştirici 24
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
25
Geliştirici 25
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
26
Geliştirici 26
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
27
Geliştirici 27
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
28
Geliştirici 28
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
29
Geliştirici 29
Derecelendirme
(25)
Projeler
33
18%
Arabuluculuk
6
50% / 33%
Süresi dolmuş
4
12%
Serbest
30
Geliştirici 30
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
31
Geliştirici 31
Derecelendirme
(11)
Projeler
15
33%
Arabuluculuk
0
Süresi dolmuş
1
7%
Çalışıyor
32
Geliştirici 32
Derecelendirme
(369)
Projeler
457
55%
Arabuluculuk
24
54% / 17%
Süresi dolmuş
31
7%
Çalışıyor
Benzer siparişler
Hello, I need an MQL5 Expert Advisor for MT5 on XAUUSD (H1) using a 1.0 lot size where every $1 movement matters. The logic must work as follows: When any active trade reaches $20.0 in profit, close that specific trade immediately and open a new opposite trade automatically. When an active trade reaches a loss of $4.0, DO NOT close the existing trade; instead, keep it open and immediately open a new opposite trade
I'm looking to purchase a profitable trading robot (EA) for MetaTrader. Requirements: Backtest Requirements: Verified backtest results covering exactly 2 years of historical data (no more, no less) Data must be from a reputable source with tick-level accuracy (99% modeling quality preferred) Please include key metrics: total net profit, profit factor, maximum drawdown, win rate, and Sharpe ratio Strategy Explanation
Surebot 100+ USD
I want a sure bot that will be able to plat a good and nice trade thst i will benefit from and that i all use to make it in life
i have indicator for Trading View, also copy for NT, i need someone to improve and check the NT version (indicator is simple is volume density koncept)…. when i put same settings on TV version and NT version i have diffrerent results, but this can be because diffrent market data or fact that TV sending tick info in blocks , not tick by tick like NT8 on both. I(ndicator base on counting volume) so besied that is it
MT5 Expert — Custom Manual Fibonacci Automation & Cycle Synchronization Project Overview I am looking for an experienced MT5 / MQL5 Expert developer to build a fully customized Expert based on my own chart cycle/engine and manual Fibonacci workflow. This is not an auto-trading robot . The Expert is designed to assist my manual trading workflow by automating the repetitive chart and Fibonacci process while keeping the
Hi, I am looking for a profitable MT5 EA,If you are interested in this job, grateful if you could provide a brief description of the strategy and one week demo trial , Thank you
I need a developer who can write me a XML file for a dbot robot to trade any deriv option instruments and trading mode A market analyser is needed. Let it automatically scan the market and choose the instrument and with the best input parameters for a given trading mode and show the predicted win rate as shown in the videos below; https://vt.tiktok.com/ ZSb14aoAA/ https://vt.tiktok.com/ ZSb1bFBkA/
Bobolink 1 30+ USD
I need a trading robot that can automatically analyse the market, identify trading opportunities, manage trades, and use clear risk controls. The robot should be reliable, easy to monitor, and suitable for testing before real trading
I am looking for an experienced MQL5 developer to research, develop, and integrate a Smart Early Exit system into my existing XAUUSD EA. The EA is already fully functional. The objective of this job is not to redesign the strategy or modify the entry logic , but to improve how losing trades are managed. The Early Exit system should identify trades that are showing signs of genuine deterioration and close them before
VEE STRATEGY ROBOT 30 - 200 USD
//+------------------------------------------------------------------+ //| M5 Trend Pullback EA | //| Exness / MT5 | //| Forex + XAUUSD | //| Risk: 0.5% per trade | //+------------------------------------------------------------------+ #property strict #property version "1.00" #property description "M5 EMA50/EMA200 + RSI + ATR Trend Pullback EA" #include <Trade/Trade.mqh> CTrade trade;

Proje bilgisi

Bütçe
50 - 100 USD

Müşteri

Verilmiş siparişler1
Arabuluculuk sayısı0