Stop Reverse EA is a Metatrader Expert Advisor that provides an aggressive framework for your trading activity. It provides proper risk calculations and a martingale trade recovery strategy which consists on taking alternative trades in opposite directions until the initial trade is recovered and a profit is realized.
Product Links
The Stop and Reverse EA for MT4 and MT5 can be found here.
It can also be downloaded from the mql5.com market.
1. What this EA is
Stop Reverse EA is a Metatrader Expert Advisor that provides an aggressive framework for your trading activity. It provides proper risk calculations and a martingale trade recovery strategy which consists on taking alternative trades in opposite directions until the initial trade is recovered and a profit is realized.
Once the EA is attached to the chart and properly configured, all you need to do is take trades by clicking “buy” or “sell” on the chart buttons displayed at the top-right corner of the chart or enable one of the automated entry strategies the EA offers.
Once a trade is taken, the EA will then take over position management for you and all you have to do is wait until the chart is flat -no trades- to trade again. It is paramount not to meddle with the initial trade once a recovery trade has been placed.
This EA implements a martingale recovery strategy made simple for the average user. Input parameters are limited and understandable. Most inputs of the EA are drop-down menus which makes it almost impossible for the user to enter unreasonable values. Any parameter that can be auto-calculated by the EA has been removed from the inputs to avoid confusion. Others have been broken down into ratios based on others.
This expert advisor is, probably, the most effective martingale recovery expert advisor you can find on the internet, but also the easiest one to use. I have spent a tremendous amount of time coding the visual elements of this tool, to make sure you understand how it works and to make the EA behave as you’d expect it to, in a predictable fashion.
This user guide will allow you to understand the EA and start trading in one hour.
2. What does it do?
Once a trade has been taken, one of the two scenarios will take place.
a) The trade is correct – if your trade goes into profits, the EA will apply a straightforward management comprised of a break-even in pips and a trailing-stop until the trade is stopped out at a profit. Optionally, you can set a take-profit in pips which is evaluated in stealth mode – without sending the take-profit order to the broker-
b) The trade goes straight into losses – If your initial trade is incorrect and goes into red, the EA will apply the martingale progression, aiming to recover the initial trade plus a profit. It will do so placing alternative pending orders -in opposite directions-, with increasing lot sizes until an exit point is reached or until all the trade plan is allocated.
Occasionally, the trade plan will be fully allocated without reaching an exit point. In this case, the EA will stop trading and the predefined risk allocation will be lost. If the EA is properly used, this won’t be a problem to the health of your account, besides the money lost.
3. What broker and accounty type should I use?
The EA can be applied to any symbol offered by your broker. That being said, you should avoid…
-
- Symbols with big spreads
- Symbols with big swap costs
- Futures with rollover fees
If you must trade symbols with high spreads or with low liquidity, make sure to increase the zone parameter to avoid spread hikes executing a large portion of your trade plan in a short period of time. We will review this further in the user guide.
You can trade with any broker of your choosing, but it is recommended to use a fixed spread account to avoid spread hikes triggering lots of pending orders in a short period of time. A fixed spread account will have the same spread all the time, no matter what, albeit a big higher than variable spread accounts.
The best environment to trade are fixed spread accounts.
4. Loading the EA to the chart
The download page of the product has straightforward download and install instructions which you will be able to follow easily. Once the EA has been installed in your Metatrader4 platform, load it to an empty chart from navigator->expert advisors.
The EA can be loaded to any timeframe without making any change in settings: since the EA does not use high-low-close-open data from the chart, the timeframe where it is loaded is irrelevant. You can change between timeframes, even if the recovery process is active, without problems and without need of changing the settings.
Congratulations! You have loaded the EA to the chart and it is displaying a lot of information which you’ll need to understand to make good decisions. Information is grouped and displayed in different corners of the chart.
-
- The top-right corner holds risk allocation and displays the risk profile
- The top-left corner holds current settings of the EA
- The bottom of the chart holds information for the current symbol
5. The risk settings
The risk allocation is directly related to the recovery inputs the EA mades available for you. It is your job to enter the martingale settings which best fit your trading activity, and to do so before taking a single trade.
The maximum net exposure is the total lots invested into the martingale process. Not the last trade lot size, but the total sum of each trade of the martingale process.
The maximum drawdown is the maximum loss expressed as percentage of balance the EA has calculated you will suffer if all the trades of the martingale process must be closed at a loss.
The EA will evaluate the maximum drawdown and display risk allocation as safe, aggressive or dangerous.
The risk responds to total exposure, and the total exposure depends directly of the martingale settings of the EA. This means that you can edit the settings of the EA to tailor the risk for each symbol to your liking. To do so, you’ll need to change the following parameters. As you read the guide, feel free to play around with them and see the impact on the risk and total exposure on the chart.
-
-
Amount of trades: This parameter controls how many trades should be placed during the martingale process. More trades means the recovery process will be longer and implies more risk because it increases the final net exposure, but it also means less deals will incur in partial losses.
-
-
-
Zone in Pips: The zone is the distance in pips between the alternative trades of the martingale. A bigger zone implies more risk because trades are allowed to run into losses more before being closed, but it also shields you from spread hikes.
-
As a rule of thumb, make sure the zone is at least 30-50 times bigger than the spread. For instance, if you trade EURUSD, which has a typical spread of 1.8 pips, you can safely set a zone of 50 pips. However, if you trade GPBJPY, which has a typical spread of 4 pips, you should set a zone of at least 100 pips to be safe from spread hikes.
Setting a zone below 50 pips is not recommended, because during volatile times the broker might increase the spread wildly and you don’t want your trade plan to be executed without actual market movement. If you do, you do so at your own risk.
-
-
Lot size: The EA builds a plan for the martingale process using your recovery settings covered above and the initial lot size of your trade. A higher initial lot size increases the final net exposure and total risk.
-
The above explained risk settings allow for infinite combinations. For instance, if you don’t want to trade with 0.01 lots because your trades are often accurate, you can increase the initial lot size and then decrease the amount of trades, to lower the risk back to a safe level.
Play around with these settings until you find a reasonable risk for each pair you are trading.
In the EA input list, all parameters affecting the risk are highlighted with a ** in their name.
6. Multi-pair risk considerations
If you are going to trade several pairs, as we all do, it is imperative that you know that risks aggregate. For instance if you trade EURUSD, GBPUSD and USDJPY with a risk of 15% each and you take a trade in all those at the same time, the total risk is actually 45%, which is not good, even though the EA will say that the risk is safe for those pairs individually.
The above happens because you are setting into motion three martingale progressions which, god forbid, can all go wrong at the same time, incurring into a combined loss on the three symbols at the same time.
So, what can you do to keep risk in check? You should configure the EA in all the pairs you want to trade, which can be as many as you like, and then make sure not to trade more than 2 pairs simultaneously. For example, you can configure a 10% risk in all pairs and avoid having more than two active pairs, limiting the final exposure to a 20% of your account.
The amount of simultaneous pairs you want to trade call for different settings, regardless of the risk profile displayed on screen. If, on the other hand, you want to trade only EURUSD you can configure the EA to behave aggressively.
In the above example, we have the following risks for each pair:
-
- 15,45% for EURUSD
- 10,90% for GBPUSD
- 10.41% for USDJPY
So, the total risk, if we were to start a trade on these pairs at the same time, would be 31,75%. A bit high for my taste, but these settings are wise if we were to have only two active pairs at any given moment.
7. Position management settings
I know you are eager to trade now, but first let’s review the position management settings. The first thing you need to know is that the position management settings only apply to your first trade, and not during the recovery process.
The following parameters control how your initial trade is managed, if your initial trade is correct. Once the second trade of the trade plan is executed, the following settings are completely ignored and the recovery settings come into play.
-
-
Break-even in pips: This parameter controls how fast does the EA make the first trade risk free. Once the trade reaches the break-even level, the stop-loss is moved above the entry price, leaving equal distance between the entry price and the current price. For example, a break-even of 10 pips will move the stop-loss to +5 pips when the trade is +10 pips in profit. A small break-even value will cause more trades to be stopped out at a small profit prematurely, but on the flip side, less trades will fall into the recovery process. A big value aims for longer trades, but will cause more trades to fall into recovery before the break-even applies.
-
-
-
Trailing-Stop: The trailing stop is expressed as percentage of the maximum achieved trade profits. This particular trailing-stop method allows profits to run without neglecting the trailing-stop when profits are small. The actual trailing-stop value in pips will change according to the trade profit. A 50% trailing stop is a very wide one, leaving 50% of the trade profits as wiggle room for the market. On the other hand, a 10% trailing stop is very tight, leaving only 10% wiggle room for the market before the trailing-stop it hit. For example, assuming a 20% trailing-stop, values would change as exemplified below.
-
Trailing-Step in pips: The trailing step in pips represents the minimum increase from the last trailing-stop value. For instance, if you set a trailing-step of 5 pips, the trailing-stop won’t be moved unless the new value is at least 5 pips away from the current one, and 5 pips away from the current market price.
-
-
-
Take-Profit in pips: Optionally, you can set a take-profit level in pips for your first order. This take-profit level is not sent to the broker, but evaluated and executed in stealth mode instead. If set to zero, it is not used. Default settings are risk-averse and will break-even trades fast.
-
8. Starting trades
To take a trade, click on BUY or SELL button on the chart and the trade will be placed for you with the proper lot size automatically. These buttons, besides being awfully convenient, are only displayed on the chart when the EA is ready to manage new trade.
Once the initial trade is placed, the trade buttons disappear and a another to close all trades is displayed instead. If you click on it, a confirmation dialog will prompt you for confirmation and close all trades in the chart immediately after if you confirm.
Once the EA is properly configured, your trading activity becomes very simple. All you need to do is taking the initial trade clicking on BUY or SELL, and then wait until the chart is flat again -no trades- to start a new trade.
Once you have taken the initial trade, a pending order will be placed in the opposite side of the zone matching the second trade of the trade plan. This pending order will be deleted automatically by the EA when the initial trade is closed by you, or by the EA.
Please note that the EA does not support bidirectional trading: do not buy and sell at the same time. Place just one initial trade, buy or sell, and wait until the chart clears to take a new trade.
Do not add additional trades to the initial trade, as each additional trade would double the risk of the recovery process or make it unfeasible altogether. This ensures that the martingale risk is controlled and exactly the same all the time.
If you want to start the deal placing pending orders, you can do so. If you place multiple pending orders on the chart, the EA will delete all others when the first one is executed, and start the recovery process on a clean chart.
If you configure the EA on the computer and take trades from your phone or mobile device, it is ok. Just keep in mind that this EA will not manage trades without a stop-loss. If the trade has no stop-loss, the EA will not manage it.
9. Automated entry strategies
The EA provides many simple automated entry strategies as an alternative to manual trading. This provides a certain level of automation to your trading, but will never match the quality of your discretional entries, as no entry strategy is profitable in all market conditions. That being said, you can switch between them according to what you see on the market. The list of automated entry strategies available is the following. Eventually more entry strategies will be added, which might not be included in this list.
10. Starting trades reading a custom indicator
Stop Reverse EA is equipped to take trades according to a custom indicator of your choosing, which must follow a convention to communicate with Stop Reverse EA. It must store one of the following constants into a non-drawing but accessible buffer. Please note that this feature is missing in the Metatrader5 version.
-
- Buy: Store 0 in the buffer
- Sell: Store 1 in the buffer
- Do nothing: Store EMPTY_VALUE in the buffer
By storing one of the following values into a buffer in your indicator, and making Stop Reverse to read from it, Stop Reverse will be able to buy, sell and close trades when your custom indicator wants to. Kindly note that, closing trades will only work if there are no recovery trades opened. The indicator is read upon bar closing and the trade session filters applied.
To make things simpler, consider the example below, named MyIndicator.mq4, which buys when a bar closes above the high of the last bar, and shorts when a bar closes below the low of the last bar.
#property copyright "Arturo Lopez Perez" #property link "http://www.pointzero-trading.com" #property description "Indicator example for the custom indicator feature." #property version "1.0" #property strict //---- indicator settings #property indicator_chart_window #property indicator_buffers 0 //---- constants #define ShortName "My Indicator" #define OP_CLOSE_BUY 3 #define OP_CLOSE_SELL 4 #define OP_CLOSE_ALL 5 //---- indicator buffers double SignalBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(1); // We only need one buffer SetIndexBuffer(0,SignalBuffer); // This is the signal buffer (0) return(0); } int deinit() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int start = 1; int limit; int counted_bars = IndicatorCounted(); // check for possible errors if(counted_bars < 0) return(-1); // Iteration Limit limit = Bars - 1 - counted_bars; // Iterate all bars from past to present for(int i = limit; i >= start; i--) { // Ignore first bar if(i >= Bars-1) continue; // Store empty value first, no action by default SignalBuffer[i] = EMPTY_VALUE; // If bullish breakout if(Close[i] > High[i+1]) SignalBuffer[i] = OP_BUY; // If bearish breakout if(Close[i] < Low[i+1]) SignalBuffer[i] = OP_SELL; } return(0); }
Please copy the above code into your MetaEditor, and click compile.
The compiler should compile the indicator without errors, making the indicator usable. To use it in Stop Reverse EA, select “Custom Indicator” as entry strategy, type the indicator name (MyIndicator) in the Custom Indicator parameter and set the signal buffer number to 0.
As you work with other indicators to make them compatible with Stop Reverse, the signal buffer number will change. For instance if you edit an indicator which has 5 buffers used, you’ll have to add an additional buffer and enter the correct buffer number in Stop Reverse EA. You can make unlimited indicators, as complex as you want, for Stop Reverse EA to trade.
11. Trading Sessions
To avoid starting trades in sessions you don’t want to trade, you can enable or disable the following sessions in the indicator inputs. These sessions are evaluated only to take the initial trade, not to perform recovery trades. The session filter is evaluated when you are using a custom indicator too.
12. Chaging the martingale process
The martingale process will follow the settings to the letter, and you should not change them on the fly. Therefore you must be completely sure about your risk settings before trading. The only thing you can do on the fly during a martingale process is stopping it. If you do so, the EA will close all trades at that time, take the loss or profit at that moment, and sit iddle. However, you can change the amount of trades on the fly if less trades have been taken so far: for example if the original trade plan was to trade 12 trades and so far the EA has taken 6, you can change recovery trades to any value above 6.
13. Closing deals manually
The EA displays a button labeled “Close All” on the top-right corner of the chart. If you click on it, the deal will be completely closed right away, regardless of the profit or loss result of the trades at the current moment.
14. Backtesting
I have intentionally left the backtest of the expert advisor for the end of the user guide, because you must understand the relationship between the recovery settings and the execution risk of the EA before you can run any meaningful backtest. It makes no sense to judge the performance of an EA based on a backtest with dangerous recovery settings, as the EA will surely over-leverage your account or go into a margin call and stop the test at a loss.
To perform a backtest, first you have to find the desired risk profile for the balance of the account you wish to test. To do that, you’ll have to first launch the test in visual mode. The visual mode will show you information on the chart as the EA trades, and you’ll be able to stop the test and change the settings if the settings are undesirable.
To start the test, select an entry strategy from the EA inputs and click on Start. The EA will either start trading or inform you that the risk allocation is dangerous. If the risk allocation is dangerous, the EA won’t trade and you’ll be forced to change the recovery settings to start a new backtest.
Once you launch a safe or aggressive test, the EA will take completely random trades until the test stops. It won’t reflect true trading activity because in live trading, you will be deciding the trades, but it will give you information about how the recovery process is handled and the expected equity curve you can expect.
You can test any timeframe above M30 or H1 in control points mode. The control points mode generates 8 ticks for each bar in the test, which is more than enough to test this particular expert advisor.
Hopefully you’ll test will look very similar to mine. That being said backtests are not the best way to measure the performance of this expert because it needs human decisions to operate: only you can decide what to trade, when to trade it, what settings to use, what symbols to avoid and when and many other things which a machine can never decide for a human being.
15. Input Parameters
When loading the expert to any chart, you will be presented with a set of options as input parameters. Don’t despair if you think they are too many, because parameters are grouped into self-explanatory blocks. Each functional parameter is explained below.
-
- Lot-Size – This parameter controls the size of the initial trade.
- Break-even in pips – This parameter controls at which profit in pips the EA moves the stop-loss above/below the open price securing profits. This parameter only affects the first trade, not during the recovery process.
- Trailing Stop – Percentage of the max. favorable excursion (MFE) used as trailing-stop. A small value is a tight stop, and a big value is a wide stop. This parameter only affects the first trade, not during the recovery process.
- Trailing Step in pips – Minimum increase in pips for the trailing stop value and, at the same time, the minimum distance from the new stoploss and the current market price. This parameter only affects the first trade, not during the recovery process.
- Take Profit in pips – Stealth take-profit for the first trade.
- Entry Strategy – Select how the EA should enter the market
- Custom Indicator Name – If you chose to take trades based on a custom indicator, type the name, case-sensitive, in this parameter.
- Custom Indicator Signal Buffer – If you chose to take trades based on a custom indicator, type the buffer number in this parameter.
- Trade Assian Session – Enable or disable Assian Trading Session (gmt based)
- Trade Europe Session – Enable or disable Europe Trading Session (gmt based)
- Trade America Session – Enable or disable America Trading Session (gmt based)
- Trades – Maximum amount of trades to place during the martingale.
- Zone – Distance in pips between alternative orders. A higher value will decrease trading frequency but will make deals to last longer. If the spread is below one pip, you can use a zone of 50 pips. If the spread is between 2 and 3 pips, you should seta zone over 75 pips. If the spread is above 3 pips, you need a zone of at least 100 pips.
- OK Risk Color – Label color if risk allocation is safe
- Medium Risk Color – Label color if risk allocation is aggressive
- High Risk Color – Label color if risk allocation is dangerous
- Color for text labels – Color for the chart text labels
- Font size for labels – Font size for the chart text labels
- Size of the lines – Line width for the break-even and exit lines
- Manual Pip Value – Use it to override the broker pip-value in price
- Magic Number – The magic number allows the EA to identify its own trades when reloaded or the platform restarts. As a rule of thumb, never change it unless you know what you are doing.
- Custom Comment – Enter your custom comment for all trades here.
16. Questions
Feel free to post your comments or questions below. Thank you!
Hello! Please tell me, in the tester on the demo version, you can only see the work of Averaging EA 14 or can you enter the transaction? I have only the exit button on the chart, it opens the positions itself, but how can I make them open? Regards, Alesander
Hi! The tester supports not chart events, so manual trades can’t be placed in the tester. Thanks.
What is the ” zone step ” parameter? I don’t see it listed above. It’s listed directly underneath the ” zone ” parameter.