Update recovery logic EA

MQL5 Indicators Experts

Specification

Hi Developers!


Looking for an experienced dev ( 50 jobs + on the platform ) to make an update on the recovery logic I currently have.


The logic as per now is not a classic recovery martingale, is computing the loss diving by 2 and computing automatically the lots needs to do it in order to make the recovery. ( You can have a look at in the attachments )

Now the logic is done at a daily level ( in case is touching the max entries or the trading day is finished the EA it stops trading ) the update needs to recover a loss in case there are some previous days losses.

Bellow you can find the logic of the actual recovery implementation

Some more details about the core of the EA

🔁 Where and how the recovery is implemented in the code

The recovery system is not in a single line. It is implemented through three components that work together:


1️⃣ Loss tracking – UpdateHistory()

👉 This is where the EA decides which trades were losses and stores their lot sizes

📍 Function:

void UpdateHistory(int idx, int jdx)

📍 Key code:

LotSizes[nTrades] = HistoryDealGetDouble(tk, DEAL_VOLUME); if (pro >= 0) IsLoss[nTrades] = false; else IsLoss[nTrades] = true; nTrades++;

What this does:

  • Reads account trade history

  • Filters only trades:

    • with the current Magic Number

    • after SeqStartTime[idx][jdx] (current sequence only)

  • For every closed trade (DEAL_ENTRY_OUT):

    • stores:

      • LotSizes[] → used volume

      • IsLoss[] → whether it was a loss

📌 Without UpdateHistory() there is no recovery, because GetLot() would have no data.


2️⃣ Recovery lot calculation – GetLot()

👉 THIS is the actual recovery engine

📍 Function:

double GetLot()


🔹 Recovery activation

v = LotSizes[CurIdx]; if (IsLoss[CurIdx]) { ... }

➡️ Recovery starts only if the last trade was a loss.


🔹 Core recovery formula

vv = v / nRecov * SL / TP;

Where:

  • v = lot size of the losing trade

  • nRecov =

    • 2 for the first recovery

    • 4 for chained recoveries

  • SL / TP = risk-to-reward compensation ratio

📌 This is NOT classic martingale
✔ Lot size does not double
✔ Lot grows proportionally to SL / TP


🔹 Recursive recovery (loss chains)

CurIdx++; if (CurIdx == nTrades) { return vv; } else { if (IsLoss[CurIdx]) { res = GetLot(); if (res > 0) break; } }

📌 Meaning:

  • For multiple consecutive losses:

    • the EA walks through the loss chain

    • calculates a controlled recovery volume

    • avoids explosive growth

👉 Recursive but capped recovery


🔹 Safety limits

if (AddInitLot) limit += LotSize; if (Vol > MaxLot) Vol = MaxLot; if (Vol > 0.0001 && Vol < 0.01) Vol = 0.01;

✔ Maximum lot cap
✔ Minimum volume enforcement
✔ Optional addition of initial lot


3️⃣ Applying recovery to real trades – OnTick()

👉 This is where recovery becomes an actual trade

📍 Key code:

Vol = GetLot(); cmnt = "r "; if (Vol < 0 || nTrades == 0) { cmnt = "i "; Vol = UpdatedLotSize(); SeqStartTime[i][k] = TimeCurrent() - 1; }

Decision logic:

Condition Action
GetLot() > 0 Recovery trade ( "r " )
GetLot() < 0 Initial trade
nTrades == 0 Initial trade
Profit achieved Sequence resets

Order comments:

  • "i " = initial

  • "r " = recovery


❌ What this recovery system does NOT do

❌ No forced trades
❌ No grid entries
❌ No lot doubling
❌ No guaranteed breakeven
❌ No recovery without a valid signal

✔ Recovery only affects position sizing, not entries


🧠 Final conclusion

  • Loss detection → UpdateHistory()

  • Recovery math → GetLot()

  • Execution decision → OnTick()

👉 Recovery is volume-based, signal-dependent, and risk-capped.


Responded

1
Developer 1
Rating
(15)
Projects
19
16%
Arbitration
5
40% / 40%
Overdue
0
Free
2
Developer 2
Rating
(17)
Projects
21
10%
Arbitration
5
40% / 40%
Overdue
1
5%
Loaded
3
Developer 3
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
4
Developer 4
Rating
(75)
Projects
80
6%
Arbitration
46
11% / 54%
Overdue
7
9%
Working
5
Developer 5
Rating
(306)
Projects
549
35%
Arbitration
79
32% / 42%
Overdue
197
36%
Loaded
6
Developer 6
Rating
(4)
Projects
3
33%
Arbitration
2
0% / 100%
Overdue
0
Free
7
Developer 7
Rating
(9)
Projects
13
38%
Arbitration
0
Overdue
3
23%
Free
8
Developer 8
Rating
(3)
Projects
1
100%
Arbitration
3
0% / 100%
Overdue
0
Free
9
Developer 9
Rating
(144)
Projects
186
41%
Arbitration
24
58% / 21%
Overdue
13
7%
Free
10
Developer 10
Rating
(15)
Projects
34
24%
Arbitration
4
0% / 50%
Overdue
2
6%
Working
11
Developer 11
Rating
(1)
Projects
1
0%
Arbitration
0
Overdue
0
Free
Published: 2 articles
12
Developer 12
Rating
(2627)
Projects
3338
67%
Arbitration
77
48% / 14%
Overdue
342
10%
Free
Published: 1 code
13
Developer 13
Rating
(11)
Projects
18
28%
Arbitration
4
50% / 50%
Overdue
1
6%
Free
14
Developer 14
Rating
(6)
Projects
7
29%
Arbitration
0
Overdue
1
14%
Busy
15
Developer 15
Rating
Projects
0
0%
Arbitration
1
0% / 100%
Overdue
0
Free
16
Developer 16
Rating
(2)
Projects
2
0%
Arbitration
3
0% / 100%
Overdue
1
50%
Free
17
Developer 17
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
18
Developer 18
Rating
(8)
Projects
8
13%
Arbitration
0
Overdue
0
Loaded
19
Developer 19
Rating
(390)
Projects
416
30%
Arbitration
74
19% / 70%
Overdue
52
13%
Working
20
Developer 20
Rating
(12)
Projects
18
39%
Arbitration
1
0% / 100%
Overdue
1
6%
Working
Similar orders
Platform: MT5 | Instrument: XAUUSD | Broker: IC Markets (ECN) Style: High-speed scalping / short-term momentum | Timeframes: M1 & M5 | Operation: Fully automated, 24/5 Overview We seek an experienced MQL5 developer to build a fast, reliable EA for live trading. The EA must: Detect symbol specifications automatically (digits, tick size, contract size) Operate continuously without manual intervention Follow logical
I want recovery zone system to attach with any other ea on chart to manage per trade by zone recovery strategy with management of sl tp to cover in profits or neutral
Monthly >Previous month High and Low.High is Resistance and Low is Support level Daily > Demand and supply zones. Demand Below Support Level and Supply Above Resistance Level. 4HOUR >Up-Tren,Down-Trend and Cosolodation >Market Structure CHOCH,BOS >3 phase movement HH,HL and LL,LH. Entry
Our EA was martiangle on EURUSD that double lot size in every 20 pips we want to change parameters for what to do in trending market so we want devloper who can help us to modify the and guide us what parameters we can change in trending market
Hello, I am looking for an experienced MT5 (MQL5) developer to review, test, and validate an existing Expert Advisor. The EA is already developed. The requirement is analysis, debugging, and refinement , not a full rewrite. Scope of Work Review entry and exit execution Validate hedging behavior (ON vs OFF) Review support/resistance handling and trade triggering Identify logic mismatches between expected vs actual
We are looking for an experienced cTrader (cAlgo) developer to port and implement AI Gold Sniper , an advanced automated trading system originally built for MT4/MT5, to cTrader . System Overview: AI Gold Sniper is a XAU/USD (Gold) trading EA that uses GPT-4o AI , deep learning (CNN), recurrent networks (RNN), and natural language processing (NLP) to analyze: Historical price data Macroeconomic indicators (interest
EA Development mentor 30 - 40 USD
am looking for a Mentor that has verifiable experience trading forex and commodities. Somebody who has a couple years experience in failures and successes. I am not a beginner. I have modest success already with discretionary trading. I have had an EA created that is very promising. It has extensive testing with very good results. The idea would be to work together advancing the existing EA and build additional EA's
Existing EA 30 USD
I’m looking to acquire an existing, profitable Expert Advisor (EA) with full source code to add to our client investment portfolio. To be clear, this is not a request to develop or design a new strategy. If you already have an EA that is proven, consistent, and production-ready, I’m open to reviewing it immediately. Please apply only if you meet all the requirements below. Submissions without a proper introduction or
Need to create an MT5 EA based on break out strategy. This will be all in one EA including daily breakout, hourly breakout, support and resistance breakout, pivot breakout, super trend break out, moving average breakout. Extra features include TP, SL, breakeven, notifications, dashboard
Forex Time: 7am to 10am (Can trade up until 11:45am)(enter around 10am) Indicator: prev day indicator by electrified Strategy is based off Wondafx profitable ftmo strategy. Search it up on Youtube before you apply. Currency Pairs: EURUSD AND GBPUSD Criteria for entry: Stop hunt, three levels of rise and fall, max 100 pip distance and three candle formation Time frame: 15 min Risk reward: 1:2 Max 1 trade a day Trade 1

Project information

Budget
30 - 80 USD