Update recovery logic EA

MQL5 Indicadores Asesores Expertos

Trabajo finalizado

Plazo de ejecución 11 días
Comentario del Ejecutor
MMIMMI,One of the best clients I've worked with. Very understanding, cooperative, and fair.Recommended A++
Comentario del Cliente
Mahdi is an excellent developer! Already working with him in some improvement points and will work together in the next projects. 5* +++

Tarea técnica

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.


Han respondido

1
Desarrollador 1
Evaluación
(17)
Proyectos
21
19%
Arbitraje
5
40% / 40%
Caducado
0
Libre
2
Desarrollador 2
Evaluación
(22)
Proyectos
28
7%
Arbitraje
9
33% / 33%
Caducado
1
4%
Trabaja
3
Desarrollador 3
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
4
Desarrollador 4
Evaluación
(75)
Proyectos
80
6%
Arbitraje
46
11% / 54%
Caducado
7
9%
Trabaja
5
Desarrollador 5
Evaluación
(319)
Proyectos
574
35%
Arbitraje
83
31% / 45%
Caducado
207
36%
Libre
6
Desarrollador 6
Evaluación
(4)
Proyectos
3
33%
Arbitraje
2
0% / 100%
Caducado
0
Libre
7
Desarrollador 7
Evaluación
(10)
Proyectos
14
43%
Arbitraje
0
Caducado
3
21%
Libre
8
Desarrollador 8
Evaluación
(3)
Proyectos
1
100%
Arbitraje
3
0% / 100%
Caducado
0
Libre
9
Desarrollador 9
Evaluación
(144)
Proyectos
186
41%
Arbitraje
24
58% / 21%
Caducado
13
7%
Libre
10
Desarrollador 10
Evaluación
(16)
Proyectos
35
23%
Arbitraje
4
0% / 50%
Caducado
2
6%
Trabaja
11
Desarrollador 11
Evaluación
(4)
Proyectos
4
25%
Arbitraje
1
0% / 100%
Caducado
0
Libre
Ha publicado: 2 artículos
12
Desarrollador 12
Evaluación
(2678)
Proyectos
3422
68%
Arbitraje
78
47% / 14%
Caducado
343
10%
Trabaja
Ha publicado: 1 ejemplo
13
Desarrollador 13
Evaluación
(11)
Proyectos
18
28%
Arbitraje
4
50% / 50%
Caducado
1
6%
Libre
14
Desarrollador 14
Evaluación
(16)
Proyectos
21
29%
Arbitraje
2
50% / 0%
Caducado
4
19%
Libre
15
Desarrollador 15
Evaluación
(1)
Proyectos
1
0%
Arbitraje
3
0% / 100%
Caducado
1
100%
Libre
16
Desarrollador 16
Evaluación
(2)
Proyectos
2
0%
Arbitraje
3
0% / 100%
Caducado
1
50%
Libre
17
Desarrollador 17
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
18
Desarrollador 18
Evaluación
(30)
Proyectos
38
45%
Arbitraje
4
50% / 50%
Caducado
3
8%
Trabaja
19
Desarrollador 19
Evaluación
(390)
Proyectos
416
30%
Arbitraje
74
19% / 72%
Caducado
52
13%
Trabaja
20
Desarrollador 20
Evaluación
(13)
Proyectos
20
40%
Arbitraje
1
0% / 100%
Caducado
1
5%
Libre
Solicitudes similares
I am looking for an experienced MQL5 developer or development team to build a scalable Telegram-to-MT5 copy trading system. The main purpose of the system is to monitor trading signals from my Telegram channel and automatically execute those signals on connected client MT5 accounts. Core Requirements Receive and parse trading signals from Telegram Automatically execute trades on connected MT5 accounts Support more
Thana ram 30 - 200 USD
Hello, I want to develop a custom MT5 Expert Advisor (EA) for XAUUSD Gold. IMPORTANT: I want a proper rule-based automated trading EA, NOT a martingale, grid or guaranteed-profit bot. 1. MARKET & TIMEFRAME - Platform: MT5 - Symbol: XAUUSD only - Main trend timeframe: M15 - Entry timeframe: M5 - Must support broker suffixes such as XAUUSDm, XAUUSD., etc. 2. TREND RULE BUY trend: - M15 price above EMA 50 - EMA 50 above
I need a TradingView Pine Script (v6) indicator that gives BUY and SELL signals in real time on the live chart. MAIN REQUIREMENT – NO REPAINTING: 1. Signals must appear only when the candle closes (barstate.isconfirmed). Example: on 1-min chart, signal for the 10:35 candle must appear at 10:36 and never disappear or move. 2. Signals on historical bars must look exactly the same as they looked live. 3. No lookahead
Description I am looking for a highly skilled MQL5 Developer & Trader with strong experience in EA optimization, stress testing, and forward validation. The EA is already coded and running. What I need now is: 1.Simple code editing, code adjustment/upgrading and code tamplates inserting, 2.Parameter Optimization & Re-Validation – Find the best stable settings for XAUUSD (not overfitted). 3.Robustness / Stress Testing
المطلوب موشر لتداول الذهب مجرب وقوية يعطي اشاره قوية فقط مع وقف خساره ومختبر ومجرب في حال الموافقه علي لموشر بعد التجربه لمدة ٣ ايام يتم الشراء دايم مبلغ ٢٠٠ دولار
Strategy 40 - 60 USD
yo i have a strategy i would really like to turn into a signal bot basically please this is very technical and serious to me the strategy needs more time 1 time frame and the bot most be 100% accurate
can you help me use a Tickblaze Algo NRBO on the NT platform? I have it somewhat set up, but I have other questions about running it & knowing how to operate it in NT. Thank you if anyone have experience in this kindly bib and let do it asap
I need a trading system similar to the attached files. Check attachment for details on the indicator. i guess the indicator contains some of (Rainbow MA , MTF Dashboard , Symbol Switcher , and Trend Histogram), though may not be exactly as listed
I have a EA/Bot I’ve designed and want it to be put onto me MetaTrader5 this month. I’m new here and also need to figure out how to get a live account and add a UK broker
Hi. I am looking for an experienced MQL5 developer for an advanced XAUUSD MT5 indicator. Before choosing a developer, I would like to see a small proof-of-concept or an example of a similar indicator you have already developed. My final indicator must be written from scratch in MQL5 and I must receive the complete .mq5 source code + compiled .ex5 . Main requirements: XAUUSD MT5 / MQL5 Indicator only — NO AutoTrading

Información sobre el proyecto

Presupuesto
30 - 80 USD