feat: Coupled ORB risk methods — new InpOrbRiskMethod input with CalcOrbRisk() that sets SL and reward:risk togethe, Daily bias control — new InpDailyBiasMode replacing the old InpUseSessionBiasFilter bool, with IsDirectionAllowed(), Defaults flipped OFF — InpUseOBRetestEntry and InpUseSessionLevelLadder now default false (kept as optional add-ons). InpRRRatio default bumped to 2.0, README updated, Bumped the version to 1.40
This commit is contained in:
@@ -11,9 +11,36 @@ A MetaTrader 5 Expert Advisor for scalping **XAUUSD (Gold/USD)** on **M15** (als
|
||||
|
||||
### Opening Range Breakout
|
||||
1. At the start of each enabled session, accumulate the **ORB High** and **ORB Low** over the first 15 real-time minutes
|
||||
2. Detect a **confirmed breakout** using a strict N-bar filter (no false breaks)
|
||||
2. Detect a **confirmed breakout** (candle closing beyond the range; optional strict N-bar filter to avoid false breaks)
|
||||
3. Wait for price to **retest** the broken ORB level
|
||||
4. Enter on the retest
|
||||
4. Enter on the retest, sized and stopped by the selected **ORB Risk Method**
|
||||
|
||||
### ORB Risk Methods (coupled SL + Reward:Risk)
|
||||
The `InpOrbRiskMethod` input selects a risk profile that fixes **both** the stop-loss
|
||||
placement and the reward:risk target together, per the ORB strategy specification:
|
||||
|
||||
| Method | Stop Loss | Reward:Risk |
|
||||
|--------|-----------|-------------|
|
||||
| `Boundary 1:2` (default) | Broken range boundary (long=ORH, short=ORL) | 1:2 |
|
||||
| `Mid 1:1.5` | Range midpoint (50%) | 1:1.5 |
|
||||
| `Opposite 1:1` | Opposite range boundary (long=ORL, short=ORH) | 1:1 |
|
||||
| `Legacy` | Uses `InpSLMode` / `InpTPMode` / `InpRRRatio` manually | — |
|
||||
|
||||
If the chosen method produces an invalid stop (wrong side of entry), the EA falls
|
||||
back to the legacy `InpSLMode` / `InpTPMode` settings.
|
||||
|
||||
### Daily Bias
|
||||
The `InpDailyBiasMode` input controls which trade directions are permitted each day:
|
||||
|
||||
| Mode | Behaviour |
|
||||
|------|-----------|
|
||||
| `Auto` (default) | The first confirmed ORB breakout of the day sets the tradeable direction; later trades must align with it |
|
||||
| `Off` | No trades taken today (use on news / high-uncertainty days) |
|
||||
| `Long only` | Only long entries processed |
|
||||
| `Short only` | Only short entries processed |
|
||||
|
||||
Breakout **detection** is never suppressed — only trade **execution** is gated, so
|
||||
levels and structure keep updating regardless of bias.
|
||||
|
||||
### Order Block Confirmation
|
||||
- A **volume pivot** is identified where the bar at index `[length]` has the highest volume in a symmetric window
|
||||
@@ -22,11 +49,11 @@ A MetaTrader 5 Expert Advisor for scalping **XAUUSD (Gold/USD)** on **M15** (als
|
||||
- **Bearish OB zone**: `[hl2, high]` of the pivot bar
|
||||
- OBs are removed (mitigated) when price penetrates the zone
|
||||
|
||||
Entry is taken when the ORB retest aligns with a nearby Order Block (optional — configurable).
|
||||
Entry is taken when the ORB retest aligns with a nearby Order Block (optional add-on, **disabled by default** via `InpUseOBRetestEntry`).
|
||||
|
||||
Active exposure is session-scoped: one open trade is allowed per session, and different sessions may each hold one trade on the same day.
|
||||
|
||||
### Session Level Ladder (New)
|
||||
### Session Level Ladder (optional, disabled by default)
|
||||
- After a confirmed session breakout direction, the EA can trade between that session's ORB levels:
|
||||
- Bullish ladder: `Low -> Mid`, then `Mid -> High`
|
||||
- Bearish ladder: `High -> Mid`, then `Mid -> Low`
|
||||
@@ -108,7 +135,12 @@ server time internally.
|
||||
| Parameter | Default | Description |
|
||||
|-----------|---------|-------------|
|
||||
| `InpEntryMode` | `Market` | Market order on retest close, or Limit at ORB level |
|
||||
| `InpUseStrictFilter` | `true` | Strict N-bar breakout filter (recommended) |
|
||||
| `InpUseStrictFilter` | `false` | Strict N-bar breakout filter (`false` = simple close-cross) |
|
||||
| `InpWaitForRetest` | `true` | Wait for an ORB retest before entering |
|
||||
| `InpBreakoutExpireBars` | `20` | Bars before an armed breakout expires (`0` = never) |
|
||||
| `InpUseOBRetestEntry` | `false` | Order Block retest entry add-on (optional, default OFF) |
|
||||
| `InpMaxRetestsPerSession` | `3` | Max retest entries per session (per breakout) |
|
||||
| `InpDailyBiasMode` | `Auto` | Daily bias: Auto / Off (no trades) / Long-only / Short-only |
|
||||
| `InpUseBreakoutVolFilter` | `false` | Require a volume spike on the breakout bar (fakeout filter) |
|
||||
| `InpBreakoutVolMult` | `1.5` | Breakout bar volume must be ≥ this × average volume |
|
||||
| `InpBreakoutVolAvgBars` | `20` | Number of bars used for the volume average |
|
||||
@@ -116,7 +148,7 @@ server time internally.
|
||||
### Session Level Ladder Settings
|
||||
| Parameter | Default | Description |
|
||||
|-----------|---------|-------------|
|
||||
| `InpUseSessionLevelLadder` | `true` | Enable level-to-level ladder entries after breakout direction confirmation |
|
||||
| `InpUseSessionLevelLadder` | `false` | Enable level-to-level ladder entries after breakout direction confirmation (optional, default OFF) |
|
||||
| `InpLadderOnDailyOpen` | `true` | Enable ladder entries on Daily Open session |
|
||||
| `InpLadderOnTokyo` | `true` | Enable ladder entries on Tokyo session |
|
||||
| `InpLadderOnLondon` | `true` | Enable ladder entries on London session |
|
||||
@@ -138,23 +170,24 @@ server time internally.
|
||||
| Parameter | Default | Description |
|
||||
|-----------|---------|-------------|
|
||||
| `InpLotMode` | `Risk %` | Fixed lot or auto-calculated from risk % |
|
||||
| `InpFixedLotSize` | `0.01` | Fixed lot (used when LotMode = Fixed) |
|
||||
| `InpRiskPercent` | `1.0` | % of balance to risk per trade |
|
||||
| `InpFixedLotSize` | `0.05` | Fixed lot (used when LotMode = Fixed) |
|
||||
| `InpRiskPercent` | `0.05` | % of balance to risk per trade |
|
||||
|
||||
### Stop Loss
|
||||
| Parameter | Default | Description |
|
||||
|-----------|---------|-------------|
|
||||
| `InpSLMode` | `OB Boundary` | SL placement: OB Boundary / Fixed Pips / ATR-based / ORB Opposite Boundary (buy=ORL, sell=ORH) / ORB Range Midpoint |
|
||||
| `InpSLPips` | `20.0` | SL in pips (Fixed mode) |
|
||||
| `InpOrbRiskMethod` | `Boundary 1:2` | Coupled risk method (sets SL + RR together); `Legacy` uses the manual settings below |
|
||||
| `InpSLMode` | `OB Boundary` | SL placement (Legacy only): OB Boundary / Fixed Pips / ATR-based / ORB Opposite Boundary / ORB Range Midpoint |
|
||||
| `InpSLPips` | `100.0` | SL in pips (Fixed mode) |
|
||||
| `InpATRMultiplier` | `1.5` | ATR multiplier for SL (ATR mode) |
|
||||
| `InpATRPeriod` | `14` | ATR period |
|
||||
|
||||
### Take Profit
|
||||
| Parameter | Default | Description |
|
||||
|-----------|---------|-------------|
|
||||
| `InpTPMode` | `RR Ratio` | TP by fixed pips or Risk:Reward ratio |
|
||||
| `InpTPPips` | `40.0` | TP in pips (Fixed mode) |
|
||||
| `InpRRRatio` | `2.0` | Risk:Reward ratio (RR mode) — 2.0 = 1:2 |
|
||||
| `InpTPMode` | `RR Ratio` | TP by fixed pips or Risk:Reward ratio (Legacy only) |
|
||||
| `InpTPPips` | `100.0` | TP in pips (Fixed mode) |
|
||||
| `InpRRRatio` | `2.0` | Risk:Reward ratio (Legacy RR mode) — 2.0 = 1:2 |
|
||||
|
||||
### Trade Management
|
||||
| Parameter | Default | Description |
|
||||
@@ -162,7 +195,7 @@ server time internally.
|
||||
| `InpBreakevenTrigPips` | `15.0` | Move SL to breakeven when profit reaches this |
|
||||
| `InpBreakevenOffPips` | `2.0` | Breakeven SL offset above/below entry |
|
||||
| `InpTrailingStopPips` | `0.0` | Trailing stop distance — `0` = disabled |
|
||||
| `InpMaxTradesPerDay` | `3` | Max trades opened per calendar day |
|
||||
| `InpMaxTradesPerDay` | `8` | Max trades opened per calendar day |
|
||||
| `InpMaxPosPerSession` | `1` | Max simultaneous positions per session |
|
||||
|
||||
### Risk Management
|
||||
|
||||
Reference in New Issue
Block a user