Update recovery logic EA

MQL5 Indicatori Esperti

Lavoro terminato

Tempo di esecuzione 11 giorni
Feedback del cliente
Mahdi is an excellent developer! Already working with him in some improvement points and will work together in the next projects. 5* +++
Feedback del dipendente
MMIMMI,One of the best clients I've worked with. Very understanding, cooperative, and fair.Recommended A++

Specifiche

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.


Con risposta

1
Sviluppatore 1
Valutazioni
(17)
Progetti
21
19%
Arbitraggio
5
40% / 40%
In ritardo
0
Gratuito
2
Sviluppatore 2
Valutazioni
(22)
Progetti
28
7%
Arbitraggio
9
33% / 33%
In ritardo
1
4%
In elaborazione
3
Sviluppatore 3
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
4
Sviluppatore 4
Valutazioni
(75)
Progetti
80
6%
Arbitraggio
46
11% / 54%
In ritardo
7
9%
In elaborazione
5
Sviluppatore 5
Valutazioni
(319)
Progetti
569
35%
Arbitraggio
83
30% / 45%
In ritardo
206
36%
In elaborazione
6
Sviluppatore 6
Valutazioni
(4)
Progetti
3
33%
Arbitraggio
2
0% / 100%
In ritardo
0
Gratuito
7
Sviluppatore 7
Valutazioni
(10)
Progetti
14
43%
Arbitraggio
0
In ritardo
3
21%
Gratuito
8
Sviluppatore 8
Valutazioni
(3)
Progetti
1
100%
Arbitraggio
3
0% / 100%
In ritardo
0
Gratuito
9
Sviluppatore 9
Valutazioni
(144)
Progetti
186
41%
Arbitraggio
24
58% / 21%
In ritardo
13
7%
Gratuito
10
Sviluppatore 10
Valutazioni
(16)
Progetti
35
23%
Arbitraggio
4
0% / 50%
In ritardo
2
6%
In elaborazione
11
Sviluppatore 11
Valutazioni
(4)
Progetti
4
25%
Arbitraggio
1
0% / 100%
In ritardo
0
Gratuito
Pubblicati: 2 articoli
12
Sviluppatore 12
Valutazioni
(2675)
Progetti
3414
68%
Arbitraggio
77
48% / 14%
In ritardo
342
10%
Gratuito
Pubblicati: 1 codice
13
Sviluppatore 13
Valutazioni
(11)
Progetti
18
28%
Arbitraggio
4
50% / 50%
In ritardo
1
6%
Gratuito
14
Sviluppatore 14
Valutazioni
(16)
Progetti
21
29%
Arbitraggio
2
50% / 0%
In ritardo
4
19%
In elaborazione
15
Sviluppatore 15
Valutazioni
(1)
Progetti
1
0%
Arbitraggio
3
0% / 100%
In ritardo
1
100%
Gratuito
16
Sviluppatore 16
Valutazioni
(2)
Progetti
2
0%
Arbitraggio
3
0% / 100%
In ritardo
1
50%
Gratuito
17
Sviluppatore 17
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
18
Sviluppatore 18
Valutazioni
(29)
Progetti
36
44%
Arbitraggio
4
50% / 50%
In ritardo
3
8%
Gratuito
19
Sviluppatore 19
Valutazioni
(390)
Progetti
416
30%
Arbitraggio
74
19% / 72%
In ritardo
52
13%
In elaborazione
20
Sviluppatore 20
Valutazioni
(13)
Progetti
20
40%
Arbitraggio
1
0% / 100%
In ritardo
1
5%
Gratuito
Ordini simili
Create a bot that can trade and read indicators easy to read for first time users. Bot that can be used on a phone and connect to MT5. It should be easy to install or use on any device especially phone and laptop, preferably the bot that can run over night and controllable when needed
Need Grid + Martingale Type Averaging EA ( Directional Buy or Sell entry then uses grid/martingale for Recovery if need ) * Must Work Buy + Sell Both Side ( Do not Open Buy or Sell at Once Let the Previous Order Close ) * Min Lot size 0.01 * Max Lot Size 1 ( Can be Edited to maximum ) * Auto TP Shift * Auto Averaging Position also Auto Shift TP as per Averaging * After Averaging Close the Trade in Maximum Profit (
C'est un Expert Advisor (EA) MQL5 pour MetaTrader 5, conçu pour l' XAUUSD , combinant un filtre de tendance et une grille adaptative avec gestion de panier ("basket") et protections contre le drawdown. Version 1.00. Logique de trading Filtre de tendance (H4 par défaut) • EMA rapide (50) vs EMA lente (200) pour déterminer la direction (UP/DOWN) • Filtre ADX (période 14, seuil 18) pour éviter de trader en
I have 2 trading view indicators by GainzAlgo that I want code to mt5 , could u advise? I need you to give me response if you can convert This
Looking for an MT4/MT5 independent risk-management service or system that can monitor and automatically close trades opened and managed by another trader’s EA. The existing EA continuously removes/overrides manually added Stop Losses and may also override SLs placed by another EA. I need a solution that does not rely on modifying the existing trade or placing a Stop Loss. Instead, it should independently monitor each
I currently sell a white-label XAUUSD EA, but the existing supplier owns the source code. I now need a new, independently developed EA and licensing system that my company fully owns and controls. I am not requesting decompilation or copying of proprietary code. Existing settings, presets and trading examples will be provided as reference. The developer must first identify any missing strategy rules before
I am looking for an experienced trader, preferably a manual trader, with a minimum 12-month verifiable live trading track record. Requirements: - Target: Up to 10% monthly return - Maximum risk/drawdown tolerance: 20% - Maximum trade duration: 5 hours - No Martingale - No Hedging - No grid or other high-risk strategies - Minimum 12 months continuous track record - Track record must be independently verifiable through
Hello! I'm looking for an experienced programmer to help me fix bugs in NEOLOGICA, PROFIT. The code is written, without errors or warnings, but not everything works correctly. Please help me. I'm looking for a programmer for a long-term collaboration, so that this project can open doors to other interesting projects. :) You need to have access to this platform, but I think that's obvious
I DO NOT need any programming or strategy development. I already have a working NinjaTrader 8 automated strategy based on a 3/5 EMA crossover. I need you to run my existing strategy through NinjaTrader Strategy Analyzer/Optimizer, test the existing adjustable parameters, and find robust settings with the best profit factor and lowest reasonable drawdown. I will provide the existing NinjaScript ZIP. I do not want the
I need this MT5 EA to work according to the following exact logic: SYMBOL: Primarily optimized for XAUUSD/Gold. All important values such as lot size, SL, TP, spread and MA periods must remain adjustable from Inputs

Informazioni sul progetto

Budget
30 - 80 USD