N Trades Per Set Martingale Expert Advisor For MT4
WE IMPROVED THIS EXPERT ADVISOR FOR YOU!!!
PLEASE NOTE: This expert advisor was publicly available for free usage on other websites and is not programmed by us. We explain the functionality and possible improvements of the EA. Furthermore, we are convinced that fully automatic Expert Advisors will fail in the long run. On the other hand, our semi-automatic approach with detecting the best setups and then activating our Expert Advisors (e.g. V-Power EA, EdgeZone EA) produced many successful traders and some of them even got prop traders at prop trading firms. Therefore, we added a similar semi-automatic trading feature (to allow only buy or only sell trades) to the free Expert Advisors. You can download the modified version here and enjoy!
Table Of Contents:
- N Trades Per Set Martingale Expert Advisor For MT4
- The N Trades Per Set Martingale Expert Advisor For MT4 – Entry Criteria
- The N Trades Per Set Martingale Expert Advisor For MT4 – Exit Criteria
- The N Trades Per Set Martingale Expert Advisor For MT4 – Room for Improvement
The N Trades Per Set Martingale Expert Advisor For MT4 applies the martingale position sizing not on every trade but after a number of losing trades declared by the user in Inputs. This makes this expert advisor a little different from other martingale systems. However, as with the standard martingale money management approach, the lot size multiplier used for the next trade after a certain number of losing trades is two.
When run in the strategy tester over a period of five months of historical data, the trading system generated a little profit with an acceptable amount of drawdown. It is interesting to note that the robot managed to make money even if the win rate was less than 50 percent and the risk-reward ratio is only one. The most probable reason for this is the use of the martingale lot sizing approach. While the end result was positive, the overall impression was neutral. This is due to the fact that the robot earned just a little money over a few months of test data.
The N Trades Per Set Martingale Expert Advisor For MT4 – Entry Criteria

The N Trades Per Set Martingale Expert Advisor displays some information on the chart where it is running. As can be seen in the image above, the user can see the status of the robot, that it is working. Also, three values of the spread are shown (real-time spread, maximum spread, minimum spread and average spread). It is not clear how the spread values are used in the trading system. It appears that the robot opened a trade immediately after being dropped on the chart using a demo account.
There are very minimal parameters in Inputs available to the user to adjust. These are all the parameters one can see in the expert settings, although the algorithm looks pretty complex and lengthy. These parameters and the default values are explained below:
- MagicStart = 4779 – This integer is used as the magic number for trades initiated by this expert advisor.
- N_trades_per_set = 3 – This parameter does not mean that each set contains three trades. This number refers to the consecutive number of wins or losses after which the robot decides whether to increase or reset the lot size. If the last three trades were winners, the robot will reset the lot size to the initial position size. If the last three trades were losers, the robot will increase the lot size on the next trade.
- TP = 50 – The robot will set the take profit of each trade to 50 pips.
- SL = 50 – The robot will set the stop loss of each trade to 50 pips.
- Factor = 2 – The lot size of the previous trade is multiplied by this factor to get the lot size on the next trade. This occurs when the last three trades lost.
- Divisor = 100000 – This number is divided to the account balance to get the initial lot size of trades.
The expert advisor does not use any type of technical indicators to generate a trade entry. When a tick is received, the robot runs through the orders in the trade pool to count the open trades on the current symbol. If there are any, the expert advisor stops further calculation and returns the command to the terminal. If there is no trade yet, the robot sends a trade request to the server with specifications for lot size, stop loss and take profit.
The robot determines the lot size based on the account balance and the Divisor variable in Inputs. Whatever the current account balance is, it is divided by 100,000 to get the trade volume. No further calculation is done to check if the lot size thus obtained is correct. Meanwhile, the stop loss requested is 50 pips and the take profit requested is 50 pips, striking an equal balance between risk and reward on every trade.
The N Trades Per Set Martingale Expert Advisor For MT4 – Exit Criteria
The N Trades Per Set Martingale Expert Advisor does not engage orders once they went live. It gives the market full freedom to decide the result of an open trade. If price hits the stop loss, the trade ends in loss, but if price touches the take profit, the trade is adjudged victorious and ends in profit. No trailing and breaking even operations are performed. While this looks like a very simplistic trade management approach, it has an incidental advantage of keeping the risk-reward ratio constant. The only way for the trading system to generate money is a high win rate or the use of the martingale money management strategy.
The N Trades Per Set Martingale Expert Advisor For MT4 – Room for Improvement
While the N Trades Per Set Martingale Expert Advisor made money in testing, the overall result is not satisfactory due to some apparent issues noted when the robot was running. First, the robot opened buy trades only throughout five months of test period. There could be at least short-term uptrends and downtrends during this period, so it is not clear or understandable why the robot did not take sell trades as well. It could be that there is a bug in the program code causing this unexpected phenomenon.
Another observation is that the robot started taking trades at a lot size of 0.01. After some time, for some reason, the position size jumped to 0.10. This type of change in algorithm does not look normal. Based on the account balance used for testing, dividing the balance with the divisor should result to 0.10. Instead, the robot started out with 0.01, which is unusual. The user might ask why it started with 0.01 when it should be 0.10 in the first place. This is not an easy question to answer. The only way to find out is to read the code, which is actually a difficult route to take considering the length and complexity of the program source code.
At the culmination of testing, the robot generated about two percent of the starting balance. Considering the trading system was run for five months of test data, this end result is just too small. One could say that the robot is safe to use but not profitable enough for the serious trader or investor to think about. Further testing might provide different results, so the user is free to do his own investigation. The user may use various trading instruments and periods in his testing and may consider running the robot in optimization mode. If the test run shows positive results, the user can do forward testing using demo account next.
Since automated trading using mechanical trading systems is risky, the user should be more careful when using a martingale trading system as it poses more risk than an ordinary automated trading system. There are many martingale-based trading systems out there, and this is just one of them, just a little different. The most important criterion for martingale systems is the amount of profit in consideration with the drawdown. At least one year of test data should be used when testing a martingale system to see if it holds under different market conditions. This is a stress test that these systems should undergo. If the robot succeeds in this testing, the monthly profit over the test period should be considered. A 10 percent monthly return is good enough if the drawdown is kept at bay. A martingale system is considered safe if it maintains a drawdown of less than 20 percent.