Discussing the article: "Automating Trading Strategies in MQL5 (Part 3): The Zone Recovery RSI System for Dynamic Trade Management"
i cant find tradq mq files where is it
This EA actually based on Martingale, So it's difficult to control large loss,The author has any method to avoid large loss?
Well said. The strategy assumes that price will break out of the initially traded range in order to recover losses. As we know, at least regarding the forex market, price ranges more often than it trends. The method for mitigating catastrophic Martingale losses would be to add a volatility filter for initial trades.
Well said. The strategy assumes that price will break out of the initially traded range in order to recover losses. As we know, at least regarding the forex market, price ranges more often than it trends. The method for mitigating catastrophic Martingale losses would be to add a volatility filter for initial trades.
Sure.
Here's Mladen Rakic's highly efficient MTF ATR code if you want to incorporate it into your code. I've used it elsewhere, and it's a gem.
Forum on trading, automated trading systems and testing trading strategies
most efficient way to call daily ATR from lower timeframes?
Mladen Rakic, 2017.12.25 21:12
Using handles to indicators like that tends to be clumsy (what if we decide to change the time frame or the period "on the fly" - new handle? ... yeeah ...)
More or less mt5 is making us code a bit more to get better results - ATR is a simple case (excluding the time frame and the period, it is not so much lines of code after all, and allows us flexibility that handle usage would not let us). I did not bother with the case explanation when there is less data available than the ATR desired period+1 rates available in the target time frame data - that is the case that built in ATR does not solve intuitively, and this simple code does that better (at least that is my opinion ...). Making this a function is no big deal either and will work better, faster, and in more flexible way than the built in ATR ...
ENUM_TIMEFRAMES _atrTimeFrame = PERIOD_D1; int _atrPeriod = 20; double _atrValue = 0; MqlRates _rates[]; int _ratesCopied = CopyRates(_Symbol,_atrTimeFrame,0,_atrPeriod+1,_rates); if (_ratesCopied>0) for (int i=1; i<_ratesCopied; i++) _atrValue += MathMax(_rates[i].high,_rates[i-1].close)-MathMin(_rates[i].low,_rates[i-1].close); _atrValue /= MathMax(_ratesCopied,1);
I skim through code and wonder why not use the ask price to compute in the buy case? Is there any conflict if I change it ? Thx.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Check out the new article: Automating Trading Strategies in MQL5 (Part 3): The Zone Recovery RSI System for Dynamic Trade Management.
In this article, we create a Zone Recovery RSI EA System in MQL5, using RSI signals to trigger trades and a recovery strategy to manage losses. We implement a "ZoneRecovery" class to automate trade entries, recovery logic, and position management. The article concludes with backtesting insights to optimize performance and enhance the EA’s effectiveness.
The Zone Recovery RSI System combines the Relative Strength Index (RSI) indicator for trade entries with a Zone Recovery mechanism for managing adverse price movements. Trade entries are triggered when the RSI crosses key thresholds—typically 30 for oversold (buy) and 70 for overbought (sell) conditions. However, the system's true power lies in its ability to recover from losing trades using a well-structured Zone Recovery model.
The Zone Recovery system establishes four critical price levels for each trade: Zone High, Zone Low, Target High, and Target Low. When a trade is opened, these levels are calculated relative to the entry price. For a buy trade, the Zone Low is set below the entry price, while the Zone High sits at the entry price. Conversely, for a sell trade, the Zone High is placed above the entry price, while the Zone Low aligns with it. If the market moves beyond Zone Low (for buys) or Zone High (for sells), a counter-trade is triggered in the opposite direction with an increased lot size based on a predefined multiplier. The Target High and Target Low define the profit-taking points for buy and sell positions, ensuring trades are closed at a profit once the market moves favorably. This approach allows for loss recovery while controlling risk through systematic position sizing and level adjustments. Here is an illustration to summarize the whole model.
Author: Allan Munene Mutiiria