Update recovery logic EA

MQL5 Indicateurs Experts

Tâche terminée

Temps d'exécution 11 jours
Commentaires du client
Mahdi is an excellent developer! Already working with him in some improvement points and will work together in the next projects. 5* +++
Commentaires de l'employé
MMIMMI,One of the best clients I've worked with. Very understanding, cooperative, and fair.Recommended A++

Spécifications

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.


Répondu

1
Développeur 1
Évaluation
(15)
Projets
19
16%
Arbitrage
5
40% / 40%
En retard
0
Gratuit
2
Développeur 2
Évaluation
(18)
Projets
22
9%
Arbitrage
6
33% / 50%
En retard
1
5%
Travail
3
Développeur 3
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
4
Développeur 4
Évaluation
(75)
Projets
80
6%
Arbitrage
46
11% / 54%
En retard
7
9%
Travail
5
Développeur 5
Évaluation
(309)
Projets
556
35%
Arbitrage
78
32% / 42%
En retard
202
36%
Travail
6
Développeur 6
Évaluation
(4)
Projets
3
33%
Arbitrage
2
0% / 100%
En retard
0
Gratuit
7
Développeur 7
Évaluation
(10)
Projets
14
43%
Arbitrage
0
En retard
3
21%
Gratuit
8
Développeur 8
Évaluation
(3)
Projets
1
100%
Arbitrage
3
0% / 100%
En retard
0
Gratuit
9
Développeur 9
Évaluation
(144)
Projets
186
41%
Arbitrage
24
58% / 21%
En retard
13
7%
Gratuit
10
Développeur 10
Évaluation
(16)
Projets
35
23%
Arbitrage
4
0% / 50%
En retard
2
6%
Travail
11
Développeur 11
Évaluation
(3)
Projets
3
33%
Arbitrage
0
En retard
0
Gratuit
Publié : 2 articles
12
Développeur 12
Évaluation
(2644)
Projets
3360
68%
Arbitrage
77
48% / 14%
En retard
342
10%
Gratuit
Publié : 1 code
13
Développeur 13
Évaluation
(11)
Projets
18
28%
Arbitrage
4
50% / 50%
En retard
1
6%
Gratuit
14
Développeur 14
Évaluation
(11)
Projets
13
23%
Arbitrage
0
En retard
4
31%
Chargé
15
Développeur 15
Évaluation
Projets
1
0%
Arbitrage
1
0% / 100%
En retard
1
100%
Travail
16
Développeur 16
Évaluation
(2)
Projets
2
0%
Arbitrage
3
0% / 100%
En retard
1
50%
Gratuit
17
Développeur 17
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
18
Développeur 18
Évaluation
(13)
Projets
15
27%
Arbitrage
3
67% / 0%
En retard
0
Chargé
19
Développeur 19
Évaluation
(390)
Projets
416
30%
Arbitrage
74
19% / 72%
En retard
52
13%
Travail
20
Développeur 20
Évaluation
(13)
Projets
19
37%
Arbitrage
1
0% / 100%
En retard
1
5%
Travail
Commandes similaires
XAU/USD Alert Bot MT4 30 - 120 USD
Project Summary: Create an alert-only MT4 EA for XAU/USD (5-minute chart) that detects a specific sequence of price action events and sends push notifications and optional sound/Telegram alerts when all conditions are met. ⸻ 1. Inputs / Settings • Enable/Disable Alerts → Boolean (true/false) • FVG minimum width (pips) → Default 2 • Order Block maximum width (pips) → Default 30 • Optional time filter → Default
I need a MetaTrader 5 Expert Advisor (EA) for Forex trading. Account size: $1000 Requirements: 1. The EA should work only on Forex pairs. 2. Automatic Buy and Sell trades. 3. Lot size starting from 0.04. 4. Stop Loss and Take Profit settings. 5. Only one trade at a time. 6. Works on pairs like EURUSD, GBPUSD, USDJPY etc. 7. Risk management suitable for a $1000 account. 8. Easy settings for lot size, SL, TP and risk
Hi, I need a custom MT5 indicator based on a multi-timeframe fractal break reversal. 1️⃣ The indicator should use two timeframes: Higher Timeframe (HTF) Lower Timeframe (LTF) (Timeframes should be adjustable in inputs, e.g., HTF = H1 and LTF = M5) 2️⃣ Use standard fractals to detect fractal highs and fractal lows. 3️⃣ Primary signal (HTF): When a Lower High fractal is formed and price breaks that Lower High in one
I’ve been following your profile and I'm interested in your expertise with the ATAS API and C# development. I have a clear technical scope for a high-performance M1 indicator focused on Binary Options and Scalping. ​The core logic is based on institutional Order Flow convergence: ​Stacked Imbalances: 300% ratio with a minimum of 3 consecutive levels. ​Delta/Price Divergence: Filtering for market exhaustion (New Highs
can you help me with editing the existing ATR Trailing Stop Indicator to include a logic to include additional script, where my ninZaRenko bars when it closes above OR below the dynamic stop line, I will be out of trade. Please remember, in this Indicator, now when the price touches the stop line, I am stopped out .. . I want to edit the script, in lieu of the price touch, I like to update this logic to when the bar
APARTE DE PASAR EL CÓDIGO A MT5 QUIERO QUE CONTENGA TODOS LOS DATOS NECESARIOS PARA QUE ESTE NUEVO CÓDIGO SE PUEDA USAR EN LA FÁBRICACIÓN DE UN ROBOT, NO SE MUCHO DE ESTO PERO INVESTIGUE QUE DEBE LEER BUFFERS Y OTRAS COSAS
HENGtaykong 30 - 200 USD
Create a ZigZag indicator, which is constructed based on extreme values determined using oscillators. It can use any classical normalized oscillator, which has overbought and oversold zones. The algorithm should first be executed with the WPR indicator, then similarly add the possibility to draw a zigzag using the following indicators: CCI Chaikin RSI Stochastic Oscillator Algorithm and Terms The first stage is the
Hello programmer! I am looking to build an Indicator with your help :) you must speak English so if we have to conference call to work out details WHAT Indicator DOES: Alerts when pullbacks end and trend resumes ARROWS: 🟢 Green = Confirmed Long 🔴 Red = Confirmed Short 🔵 Blue = Add to position ⚫ Black = Better second chance 🟡 Yellow = Early warning (inside bar) ⚪ White = Early warning (pullback) CORE RULE: - Trail
I need an Expert Advisor for MetaTrader 5 based on SMT and CISD strategy using NASDAQ and S&P500. Strategy logic: - The bot compares NASDAQ and S&P500. - Timeframe: 3 minutes. - First condition: One of the pairs must take liquidity from a previous high or low while the other pair does NOT take that liquidity (SMT divergence). - Second condition: The pair that took liquidity must close back below the high (or above
Pinescript 100+ USD
I’m looking for a Pine Script developer who can reverse engineer the “Swing Only” logic of the Polytrends indicator on TradingView. The goal is to recreate how the swing trends are detected and plotted so it can be used as a custom indicator. If you have experience with TradingView Pine Script and reverse-engineering indicator logic , please reach out

Informations sur le projet

Budget
30 - 80 USD