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
(15)
Progetti
19
16%
Arbitraggio
5
40% / 40%
In ritardo
0
Gratuito
2
Sviluppatore 2
Valutazioni
(18)
Progetti
22
9%
Arbitraggio
6
33% / 50%
In ritardo
1
5%
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
(309)
Progetti
556
35%
Arbitraggio
78
32% / 42%
In ritardo
202
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
(3)
Progetti
3
33%
Arbitraggio
0
In ritardo
0
Gratuito
Pubblicati: 2 articoli
12
Sviluppatore 12
Valutazioni
(2644)
Progetti
3360
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
(11)
Progetti
13
23%
Arbitraggio
0
In ritardo
4
31%
Caricato
15
Sviluppatore 15
Valutazioni
Progetti
1
0%
Arbitraggio
1
0% / 100%
In ritardo
1
100%
In elaborazione
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
(13)
Progetti
15
27%
Arbitraggio
3
67% / 0%
In ritardo
0
Caricato
19
Sviluppatore 19
Valutazioni
(390)
Progetti
416
30%
Arbitraggio
74
19% / 72%
In ritardo
52
13%
In elaborazione
20
Sviluppatore 20
Valutazioni
(13)
Progetti
19
37%
Arbitraggio
1
0% / 100%
In ritardo
1
5%
In elaborazione
Ordini simili
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

Informazioni sul progetto

Budget
30 - 80 USD