VWAP + RSI Divergence EA with Martingale (MT4)

Şartname

## 🎯 **Project Overview**

I need an **Expert Advisor (EA)** for **MetaTrader 4** that combines signals from a **VWAP indicator** (provided) with **RSI Divergence detection** and includes a **Martingale function** for averaging losing positions. The EA should execute trades when **BOTH** indicators confirm the same direction.

---

## 📊 **Indicators Used**

### 1. VWAP Indicator (Custom)
- **File:** `VWAP_MT4_Gold_Ultimate 2d.mq4` (provided)
- **Buffer Structure:**
  - Buffer 0: VWAP Line
  - Buffer 1: Upper Band
  - Buffer 2: Lower Band
  - Buffer 3: Buy Arrows (`0.0` = no signal, `>0.0` = arrow)
  - Buffer 4: Sell Arrows (`0.0` = no signal, `>0.0` = arrow)

### 2. RSI Divergence (Standard RSI)
- **Type:** Built-in `iRSI()` indicator
- **Divergence Types Required:**
  - **Regular Bullish:** Price makes lower low, RSI makes higher low
  - **Regular Bearish:** Price makes higher high, RSI makes lower high
  - **Hidden Divergences** (optional)
- **Detection:** Swing high/low pivots in RSI

### 3. Divergence Strength Calculation
The EA calculates a divergence strength score from 0 to 100 based on the following factors:

- **Price swing size (20% weight):** The magnitude of the price movement between the two pivot points, normalized by ATR
- **RSI swing size (20% weight):** The magnitude of the RSI movement between the two pivot points
- **Divergence difference (40% weight):** The difference between price and RSI movement directions
- **Trend strength (10% weight):** Based on ADX value
- **RSI context (10% weight):** Bonus if RSI is in overbought/oversold territory

A divergence is considered valid only when its calculated strength is greater than or equal to `MinDivergenceStrength`.

---

## 📈 **Entry Logic**

### Signal Timing: `SignalAtBarClose = true`
- **All signals are evaluated at bar close** (prevents repainting). If set to false, signals are evaluated immediately, which may cause repainting and unreliable backtest results. Use with caution.

### First Entry Signal
A **first trade** is opened when **BOTH** conditions are met on the **same bar**:

#### BUY Signal (LONG)
1. **VWAP:** Green BUY arrow appears (Buffer 3 > 0)
2. **RSI:** Bullish divergence detected

#### SELL Signal (SHORT)
1. **VWAP:** Red SELL arrow appears (Buffer 4 > 0)
2. **RSI:** Bearish divergence detected

---

## 📊 **Martingale Function**

### Concept
When a trade (BUY or SELL) is in loss, **additional trades in the same direction** are opened to improve the average entry price.

### Martingale Entry Conditions
Each Martingale trade requires **TWO conditions**:
1. **Pip Distance:** Price has moved `MartingalePipStep` pips against the position
2. **Signal Confirmation:** One of three modes (user-selectable)

### Martingale Signal Modes

| Mode | Description | Buy Signal | Sell Signal |
|------|-------------|------------|-------------|
| **0** | **Pips Only** | Pip step reached | Pip step reached |
| **1** | **Pips + VWAP Band** | Pip step reached AND price at lower VWAP band | Pip step reached AND price at upper VWAP band |
| **2** | **Pips + RSI Level** | Pip step reached AND RSI < Oversold Level | Pip step reached AND RSI > Overbought Level |

### Martingale Exit Logic
When the **weighted net profit of all open trades in the same direction** reaches `MartingaleMinProfitPips` pips:
- **ALL trades in that direction are closed immediately**

The weighted net profit is calculated as the sum of (pips profit or loss × lot size) for each individual trade. This ensures that larger positions have a greater impact on the closing decision, reflecting the true monetary profit or loss of the combined positions.

### Example (BUY):
```
InitialLotSize = 0.01
MartingaleMultiplier = 1.5
MartingalePipStep = 50
MartingaleMaxTrades = 3
MartingaleMinProfitPips = 20

Trade 1 Buy: 0.01 @ 1.2000
→ Martingale triggered at 1.1950 (-50 pips)
Trade 2 Buy: 0.015 @ 1.1950
→ Martingale triggered at 1.1900 (-50 pips)
Trade 3 Buy: 0.0225 @ 1.1900

At 1.1960:
- Trade 1: -40 pips × 0.01 = -0.4
- Trade 2: +10 pips × 0.015 = +0.15
- Trade 3: +60 pips × 0.0225 = +1.35
- Net = +1.10 (≈ 20 pips profit in weighted terms)

→ ALL trades close at 1.1960!
```

---

## ⚙️ **Full Parameter List**

### 1. VWAP Settings
| Parameter | Description | Default |
|-----------|-------------|---------|
| `VWAP_ResetPeriod` | Reset period (0=H1,1=H4,2=Daily,3=Weekly,4=Monthly) | 2 |
| `VWAP_StdDevDist` | Band distance in standard deviations | 2.0 |
| `VWAP_ArrowOffset` | Arrow offset in points | 150 |
| `VWAP_UseRealVolume` | Use real volume if available | false |

### 2. RSI Settings
| Parameter | Description | Default |
|-----------|-------------|---------|
| `RSI_Period` | RSI period | 14 |
| `RSI_Overbought` | Overbought level | 70 |
| `RSI_Oversold` | Oversold level | 30 |
| `PivotStrength` | Pivot detection strength (bars left/right) | 2 |
| `MinPivotDistance` | Minimum distance between pivots in bars | 5 |

### 3. Divergence Settings
| Parameter | Description | Default |
|-----------|-------------|---------|
| `EnableRegularDivergence` | Enable regular divergence detection | true |
| `EnableHiddenDivergence` | Enable hidden divergence detection | false |
| `MinDivergenceStrength` | Minimum divergence strength (0-100). Only divergences with a strength >= this value are considered valid signals. | 50 |

### 4. Signal Settings
| Parameter | Description | Default |
|-----------|-------------|---------|
| `SignalAtBarClose` | Evaluate signals at bar close (recommended to prevent repainting) | true |
| `SignalTimeframe` | Timeframe for signal detection | PERIOD_H4 |
| `TradeTimeframe` | Timeframe for trade execution | PERIOD_H4 |

### 5. Lot Size Settings
| Parameter | Description | Default |
|-----------|-------------|---------|
| `InitialLotSize` | Initial lot size for first trade | 0.01 |

### 6. Martingale Settings
| Parameter | Description | Default |
|-----------|-------------|---------|
| `MartingaleEnabled` | Enable Martingale | false |
| `MartingaleMaxTrades` | Maximum number of Martingale trades per direction | 3 |
| `MartingalePipStep` | Pip distance between Martingale trades | 50 |
| `MartingaleMultiplier` | Lot multiplier per step | 1.5 |
| `MartingaleMinProfitPips` | Minimum profit in pips to close all trades | 20 |
| `MartingaleRequiresSignal` | Martingale trade requires signal confirmation | true |
| `MartingaleSignalMode` | Signal mode (0=Pips only, 1=Pips+VWAP, 2=Pips+RSI) | 1 |
| `MartingaleMaxTotalLossPips` | Maximum loss in pips for Martingale positions | 200 |

### 7. Order Management Settings
| Parameter | Description | Default |
|-----------|-------------|---------|
| `StopLossPips` | Stop loss in pips | 50 |
| `TakeProfitPips` | Take profit in pips | 100 |
| `TrailingStopPips` | Trailing stop in pips (0 = disabled) | 0 |
| `OrderComment` | Order comment | "VWAP Divergence" |
| `MagicNumber` | Unique Magic Number | 20260817 |

### 8. Safety Settings
| Parameter | Description | Default |
|-----------|-------------|---------|
| `MaxSpread` | Maximum spread in points | 30 |
| `MaxSlippage` | Maximum slippage in points | 10 |
| `MaxTotalLoss` | Maximum total loss in account currency (EA STOPS COMPLETELY) | 500 |
| `MaxTradesPerDirection` | Maximum open trades per direction (excluding Martingale) | 1 |

### 9. Display Settings
| Parameter | Description | Default |
|-----------|-------------|---------|
| `ShowDivergenceLines` | Draw divergence lines on chart | true |
| `ShowSignalArrows` | Draw signal arrows on chart | true |
| `ShowInfoPanel` | Show info panel on chart | true |

---

## 🛠️ **Technical Requirements**

### Platform
- **MetaTrader 4 ONLY** (not MT5)
- Compatible with Windows 10/11

### Performance & Stability
- **NO repainting** of signals
- Use `iCustom()` to read VWAP indicator signals
- All parameters must be **optimizable** in Strategy Tester
- **Error handling** with `GetLastError()`
- **Logging** in Experts tab
- The EA must be stable and must not freeze MT4 even during periods of high volatility or when processing many historical bars. The developer should review the VWAP indicator code to ensure it runs efficiently without changing its layout or functionality.

### Code Quality
- **Modular structure:**
  - Signal Engine (VWAP + RSI)
  - Divergence Engine (Pivot detection)
  - Trade Manager (Order open/close)
  - Martingale Manager
  - Risk Manager (MaxLoss monitoring)
- `#property strict` required

- Well-commented code

  • The EA must be stable and must not freeze MT4 even during periods of high volatility or when processing many historical bars

  • The developer is expected to review and optimize the VWAP indicator code for performance without changing its layout or functionality. The indicator currently uses nested loops which may cause performance issues with large history. The developer should implement necessary optimizations to ensure smooth operation while preserving the indicator's visual appearance and signal logic.

  • The EA is primarily designed for XAUUSD (Gold)

  • All pip calculations, stop loss, take profit, Martingale steps, and profit targets must work correctly for XAUUSD

  • XAUUSD has a specific pip value (0.01 for 5-digit brokers) and the EA must handle this correctly

  • All parameters related to pips (StopLossPips, TakeProfitPips, MartingalePipStep, MartingaleMinProfitPips, MartingaleMaxTotalLossPips) must be calculated and applied correctly for this instrument

  • The developer must ensure that  Point  and pip calculations are properly handled for XAUUSD's decimal places


---

## 🛑 **Safety Features**

| Feature | Description |
|---------|-------------|
| **MaxTotalLoss** | If total loss reaches this amount, EA **STOPS ALL TRADING** permanently (until manually reactivated) |
| **MartingaleMaxTotalLossPips** | If Martingale positions reach this loss in pips, all Martingale trades close (EA continues trading) |

**No restrictions:** No `MaxTradesPerDay` restriction. No "only one position per direction" restriction beyond standard Martingale logic (Martingale requires multiple positions).

---

## 📦 **Delivery Requirements**

1. **Source Code:** `.mq4` file
2. **Compiled File:** `.ex4` file
3. **Parameter Set:** Optimized `.set` file
4. **User Guide:** PDF with all parameters explained (in English)
5. **Bugfix Support:** 14 days after delivery
6. **Installation Instructions:** Step-by-step guide

---

## 🔧 **Sample Logic (Pseudocode)**

```mql4
// MARTINGALE SIGNAL LOGIC
if (MartingaleRequiresSignal) {
    switch (MartingaleSignalMode) {
        case 0: // Pips Only
            martingaleSignal = true;
            break;
            
        case 1: // Pips + VWAP Band
            if (direction == BUY) {
                martingaleSignal = (close[i] <= VWAP_LowerBand[i]);
            } else {
                martingaleSignal = (close[i] >= VWAP_UpperBand[i]);
            }
            break;
            
        case 2: // Pips + RSI Level
            if (direction == BUY) {
                martingaleSignal = (RSI[i] < RSI_Oversold);
            } else {
                martingaleSignal = (RSI[i] > RSI_Overbought);
            }
            break;
    }
} else {
    martingaleSignal = true;
}

// ENTRY CONDITIONS
if (MartingaleEnabled && IsLossPosition() && martingaleSignal) {
    OpenMartingaleTrade();
}
```

---

## 📝 **Summary of Martingale Modes**

| Mode | Description | Best For |
|------|-------------|----------|
| **0** | Pips only | Aggressive traders, fast averaging |
| **1** | Pips + VWAP Band | Conservative traders, institutional support/resistance |
| **2** | Pips + RSI Level | Traders who want oversold/overbought confirmation |

---

## 💰 **Budget & Timeline**

- **Budget:** Please provide your quote
- **Timeline:** 2-7 days expected
- **Payment:** MQL5 escrow terms

---

## 📧 **Application Requirements**

Please include in your proposal:
1. **Estimated timeline** and delivery date
2. **Your experience** with Martingale EAs and divergence detection in MT4
3. **Confirmation** that you work with MT4 (not MT5)
4. **Any questions** or clarifications needed
5. **Examples** of similar EAs you have developed

---

## 📎 **Attachment**
- `VWAP_MT4_Gold_Ultimate 2d.mq4` (provided)

---

**Ready to hire!** 🚀
**Platform:** MetaTrader 4 ONLY

**Budget:** Open to negotiation


*********TO ALL APPLICANTS: I am currently on vacation and will be offline for a few hours but will get back to each of you soon again. Thank you so much for applying I will let you know soon and make a decision. Looking forward to working with you.*********

Yanıtlandı

1
Geliştirici 1
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
2
Geliştirici 2
Derecelendirme
(109)
Projeler
181
25%
Arabuluculuk
24
17% / 75%
Süresi dolmuş
16
9%
Serbest
3
Geliştirici 3
Derecelendirme
(394)
Projeler
508
23%
Arabuluculuk
60
57% / 25%
Süresi dolmuş
59
12%
Yüklendi
4
Geliştirici 4
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
5
Geliştirici 5
Derecelendirme
(21)
Projeler
27
7%
Arabuluculuk
9
33% / 33%
Süresi dolmuş
1
4%
Çalışıyor
6
Geliştirici 6
Derecelendirme
(62)
Projeler
77
58%
Arabuluculuk
6
67% / 17%
Süresi dolmuş
1
1%
Yüklendi
7
Geliştirici 7
Derecelendirme
(17)
Projeler
21
19%
Arabuluculuk
5
40% / 40%
Süresi dolmuş
0
Serbest
8
Geliştirici 8
Derecelendirme
(62)
Projeler
90
29%
Arabuluculuk
24
13% / 58%
Süresi dolmuş
7
8%
Çalışıyor
9
Geliştirici 9
Derecelendirme
(612)
Projeler
715
33%
Arabuluculuk
46
48% / 41%
Süresi dolmuş
14
2%
Meşgul
10
Geliştirici 10
Derecelendirme
(1)
Projeler
1
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
Yayınlandı: 1 kod
11
Geliştirici 11
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
12
Geliştirici 12
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
13
Geliştirici 13
Derecelendirme
(25)
Projeler
31
13%
Arabuluculuk
13
0% / 77%
Süresi dolmuş
9
29%
Serbest
14
Geliştirici 14
Derecelendirme
(4)
Projeler
5
40%
Arabuluculuk
0
Süresi dolmuş
0
Çalışıyor
Yayınlandı: 1 kod
15
Geliştirici 15
Derecelendirme
(1)
Projeler
1
0%
Arabuluculuk
1
0% / 0%
Süresi dolmuş
0
Çalışıyor
16
Geliştirici 16
Derecelendirme
(3)
Projeler
8
63%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
17
Geliştirici 17
Derecelendirme
(205)
Projeler
266
21%
Arabuluculuk
24
50% / 17%
Süresi dolmuş
0
Çalışıyor
18
Geliştirici 18
Derecelendirme
(170)
Projeler
182
46%
Arabuluculuk
3
33% / 33%
Süresi dolmuş
1
1%
Yüklendi
19
Geliştirici 19
Derecelendirme
(1)
Projeler
1
0%
Arabuluculuk
1
0% / 100%
Süresi dolmuş
0
Serbest
20
Geliştirici 20
Derecelendirme
(1)
Projeler
1
100%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
21
Geliştirici 21
Derecelendirme
(13)
Projeler
31
23%
Arabuluculuk
8
25% / 63%
Süresi dolmuş
5
16%
Serbest
22
Geliştirici 22
Derecelendirme
(11)
Projeler
11
0%
Arabuluculuk
5
20% / 60%
Süresi dolmuş
2
18%
Serbest
23
Geliştirici 23
Derecelendirme
(51)
Projeler
61
38%
Arabuluculuk
15
27% / 60%
Süresi dolmuş
1
2%
Serbest
24
Geliştirici 24
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
25
Geliştirici 25
Derecelendirme
(6)
Projeler
8
38%
Arabuluculuk
1
100% / 0%
Süresi dolmuş
2
25%
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
(64)
Projeler
144
46%
Arabuluculuk
20
40% / 20%
Süresi dolmuş
32
22%
Serbest
29
Geliştirici 29
Derecelendirme
(32)
Projeler
33
42%
Arabuluculuk
0
Süresi dolmuş
3
9%
Serbest
30
Geliştirici 30
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
31
Geliştirici 31
Derecelendirme
(4)
Projeler
7
57%
Arabuluculuk
1
100% / 0%
Süresi dolmuş
0
Serbest
32
Geliştirici 32
Derecelendirme
(6)
Projeler
8
38%
Arabuluculuk
1
0% / 100%
Süresi dolmuş
0
Serbest
33
Geliştirici 33
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
34
Geliştirici 34
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
35
Geliştirici 35
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
Yayınlandı: 1 kod
Benzer siparişler
[20:54, 8/17/2026] Abhi NEW: Experienced MQL5 Coder Wanted — Debug & Go-Live Support for XAUUSD Grid Strategy [20:56, 8/17/2026] Abhi NEW: I have a working MQL5 Expert Advisor (EA) for a Gold (XAUUSD) grid-based trading strategy that needs professional review, modification, and support getting it correctly running live. What I have: - Existing .mq5 source code for the strategy - A detailed strategy specification
I am looking for a professional and market-savvy MQL developer to build a disciplined, stable Scalping Expert Advisor (EA). The ideal developer must have a solid understanding of Trend Identification, Fibonacci Levels, and Technical Indicators , alongside strict risk management implementation. Key Focus Areas & Developer Requirements: Market & Analysis Expertise: ⚬ Deep understanding of Trend direction (Market
Decompile EA 50 - 200 USD
I have an EA I want to Decompile or create EA Having same logic and same conditions for EA its an fixed SL TP bot I will provide a copy of EA just understand the logic and create or decompile the EA
LUCK 30+ USD
I want to work for me and make alot of money for me when. I want a trade bot on my mt5 .and show me all the thing's i want to see on my mt5 account
I need an expert Ninjatrader8 developer that can build this indicator. Can you build indicator like this? Ather https://share.google/HaxK5snnOWFR08ghd If you know you can do this send me message or bid to my proposal
profitable EAs wanted with at least 3 to 5 years backtest. you be submit your proofs such as graphic results, backtesting results, and your demo or weekly the eas has traded
Fvg order 50 - 300 USD
Strategy Objective Create a disciplined, rules‑driven trading framework that identifies high‑probability reversals during the Asia session by leveraging levels formed in the final hours of New York. The goal is consistent execution, controlled risk, and scalable automation. Core Approach Track and define the key price extremes set during late New York trading. Monitor Asia session behavior for liquidity sweeps beyond
Requirements Specification GoldV16 V0 – MT5 XAUUSD Netting EA 1. Platform: - MetaTrader 5 - MQL5 - XAUUSD - NETTING account 2. Position rule: - Only ONE XAUUSD position may be open at any time. - Fixed lot only. - No Martingale. - No automatic lot increase. 3. Stop Loss: - Stop Loss must be sent immediately when a trade opens. - Default SL distance: 1.00 USD in gold price. - SL distance must be adjustable in Inputs
MQL5 developer needed to code a macro-driven gold trading Expert Advisor for MetaTrader. Body: We have a documented macro-driven trading strategy for gold that needs to be converted into a working MetaTrader Expert Advisor. Experience integrating external data sources, such as economic calendar events or interest rate and dollar index data, into MQL5 is required. An N.D.A. must be signed before strategy details are
MACD + EMA 30 - 100 USD
J’ai fais un indicateur tradingview que j’aimerai adapter à MT5. celui ci indique une flèche pour des achats ou des ventes lorsque le prix atteint un niveau tracé auparavant par l’indicateur également. Les conditions sont les suivantes : timeframe 1 minute Buy Stop / Sell Stop sur le niveau tracé. SL placé sur la EMA 21 au moment du du déclenchement de l’ordre avec possibilité de le modifier. Le TP à 1.5R

Proje bilgisi

Bütçe
50+ USD
KDV (19%): 9.5 USD
Toplam: 60 USD
Geliştirici için
45 USD

Müşteri

(37)
Verilmiş siparişler46
Arabuluculuk sayısı0