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:
📌 Without UpdateHistory() there is no recovery, because GetLot() would have no data.
2️⃣ Recovery lot calculation – GetLot()
👉 THIS is the actual recovery engine
📍 Function:
🔹 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:
📌 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:
👉 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
👉 Recovery is volume-based, signal-dependent, and risk-capped.
Benzer siparişler
Your XAUUSD Buy Stop / Sell Stop Grid EA Strategy 1. Initial order placement Buy Stop orders — 5 orders Place 5 Buy Stop pending orders above the current market price. Each order is spaced 1.00 XAUUSD price unit apart. Initial lot sizes range from 0.01 to 0.05 lots . Sell Stop orders — 5 orders Place 5 Sell Stop pending orders below the current market price. Each order is spaced 1.00 XAUUSD price unit apart. Initial
I am looking for an experienced and highly competent MQL5 developer to create a bespoke, fully automated Forex Expert Advisor for Meta Trader 5 for my Apple iMac. The EA will incorporate a proprietary trading strategy involving multiple position management, dynamic trade execution, advanced profit management and sophisticated risk controls. Key technical requirements: Automated trade execution and management
Hello developers and quantitative traders, I am looking to purchase a license for an EXISTING, professionally developed MT5 quantitative portfolio Expert Advisor with a long-term, independently verifiable trading history. Purchase budget: $5,000–$15,000 USD Additional annual maintenance fee: $1,000 USD I am willing to establish a long-term commercial relationship with the developer. IMPORTANT: I am NOT looking for
Hello. I have some custom chartbooks/studies that run on ACSIL C++ in Sierra Charts trading platform. I need them put into pinescript to be able to be used in trading view and look similar to the charts we are giving you. also need it to be able to work on ninja trader NinjaScript (C#)/java, and MQL4 and MQL5 for metatrader 4 and 5. You would have to assist with testing. Let me know if you can help with this task
Project: XAUUSD Gold Trading Robot for MetaTrader 5 I want to develop a fully automated Expert Advisor (EA) for MetaTrader 5, designed exclusively for Gold (XAUUSD) and compatible with the Exness broker. Trading Strategy: Liquidity + CHOCH + Retest Identify important buy-side and sell-side liquidity zones using previous highs and lows, equal highs/lows, and confirmed swing points. Wait for a clear liquidity sweep
I am looking to acquire an EXISTING and PROVEN MetaTrader 5 Expert Advisor. I am NOT looking for someone to develop a random new strategy from scratch. The objective is to find a robust EA with an existing track record, verify its performance and robustness, and purchase the MQL5 source code together with clearly defined commercial rights. MAIN REQUIREMENTS The EA should meet most or all of the following
Hello, I am a serious buyer interested in acquiring an existing, stable and profitable Expert Advisor (EA) specifically designed to: 👉 mainly (XAUUSD) or any other exchange rate This is a full purchase order. ⚠️ I'm not interested in creating a new EA from scratch. Only ready-to-use, proven systems with a real track record of performance. ✅ EA Requirements (Stringent) 📌 Symbol and Strategy ✔️ Trade Gold Only
Here is a professional, detailed requirements specification draft for your MQL5 freelance order based on your prompt: Strategy Objective: Develop an automated Expert Advisor (EA) featuring a 1:3 Risk-to-Reward ratio optimized for a small starting budget. Core Trading Logic: Execute automatic Buy and Sell trades using high-probability entry signals. Target a strict 90% theoretical win-rate structure through
i want to fix my gold martingale bot MT5. RSI 14 ENTRY 30 BUY 70 SELL Lot 0.02 0.04 0.07 TP 150 for all SL 90 30 30 once total daily profit is 200$ stop trading stop trading once 2 consecutives total losses stop trading if spread exceeded 30 and between hour 15 & 17 PM Move SL to breakeven point once the profit exceeded 50 from from breakeven thanks
MarketMind Breakout Pro XAUUSD H1 — Donchian Breakout EA Project type: Personal EA development and backtesting Platform: MetaTrader 5 Instrument: XAUUSD Timeframe: H1 Strategy: Donchian Channel breakout with EMA 200 Project overview This project evaluates a Donchian breakout trading strategy for XAUUSD on the H1 timeframe. The system uses channel-based breakout conditions and an EMA 200 trend filter. Historical