PersistentAnti Expert Advisor

You can now download the PersistentAnti Expert Advisor for free on AtoZ Markets indicators gallery. This expert advisor is available for both MT4 and MT5.

PersistentAnti Forex expert advisor exploits the idea of trend persistency. It is believed that the Forex market charts may switch between persistent and anti-persistent modes. In a persistent mode, the established trend is likely to continue. In an anti-persistent mode, a positive change is likely to be followed by a negative one, and a negative change will probably be followed by a positive one. Obviously, such a property, when detected, can be of great help to any trader. Going with the trend in a persistent mode and catching a reversal in an anti-persistent mode seems like a good idea for an effective trading strategy.

Applying the Concept

There are many ways to detect current (or, more precisely, past) persistence or anti-persistence state of the market, including Hurst exponent, Z-Score and others. Unfortunately, they all have some significant disadvantages.

The presented expert advisor uses a simple, albeit naïve, method to assess the short-term (anti-)persistence. It counts the bars that followed the direction of a previous bar and compares the resulting number with the number of bars that did not follow the direction of a previous bar during some (short) period. If the share of persistent bars exceeds some set threshold, the chart is believed to be in a persistent mode. If the share of anti-persistent bars exceeds the same threshold, the chart is considered to be in an anti-persistent mode. If neither number of persistent bars nor number of anti-persistent bars exceeds the threshold, the EA considers the current mode as unclear and abstains from entering new positions.

The most interesting part is that this expert advisor trades contrary to the detected mode. It will use a buy trade following a bearish bar and a sell trade following a bullish bar in a persistent mode. At the same time, it will issue a sell order following a bearish bar and a buy order following a bullish bar in an anti-persistent mode. This behavior seems completely out of logic, but it is a result of backtesting (without any over-optimization). Since the EA opens a position at the beginning of a bar and closes at the beginning of the next one (or the bar after the next one, etc.) without applying any stop-loss or take-profit levels, the strategy is completely reversible. Of course, you are free to experiment with reversing it back — there is an input parameter for that. Remember, that with a reversible EA, if your backtests result in big losses, you can always reverse it and end up with gains.

Input Parameters

  • N (default = 10) — the number of bars to look back for (anti-)persistence detection.
  • Ratio (default = 0.66) — the ratio of (anti-)persistent bars to consider opening a new position or resuming with the current one.
  • Reverse (default = true) — if true, trades contrary to the detected market persistence mode, otherwise trades in accordance with it.
  • Lots (default = 0.1) — the number of standard Forex lots to open positions for. Ignored if MM = true.
  • Slippage (default = 100) — the acceptable price slippage in pips.
  • MM (default = false) — if true, fixed fractional position sizing will be used.
  • MaxPositionSize (default = 5) — the maximum position size in standard lots when MM = true.
  • OrderComment (default = “PersistentAnti”) — the commentary for positions opened by this EA.
  • Magic (default = 2013041816277982) — the order magic number to filter positions opened by this EA. Used only in MT4.

PersistentAnti Expert Advisor backtesting results

The demo test of the PersistentAnti Expert Advisor on the MetaTrader 4 platform for a period of one year (2020) showed ~ 4.9% profit with ~ 3.4% maximum drawdown. EA concluded 337 trades, of which 53.12% were profitable. The volume of used positions was set at 0.1 standard lots. The test used the default settings on the EUR/USD H4 chart.

How to trade with PersistentAnti Expert Advisor

The expert advisor is very simple and so is its algorithm of actions:

  1. On new bar opening, go through previous N bars.
  2. For each bar check if the preceding bar was bullish or bearish. Then compare it to the bar in the current iteration.
  3. If both are bullish or both are bearish, record one point for the persistent mode. If bars’ directions differ, record a point for the anti-persistent mode.
  4. Close previous position if a position in opposite direction should be opened or if neither persistence nor anti-persistence has been detected.
  5. If Reverse is turned on (default) and ratio of persistent bars exceeds the given value, sell after a bullish bar or buy after a bearish one. If the anti-persistent bars prevail, sell after a bearish bar or buy after a bullish one.
  6. If Reverse is turned off and ratio of persistent bars exceeds the given value, buy after a bullish bar or sell after a bearish one. If the anti-persistent bars prevail, buy after a bearish bar or sell after a bullish one.

How to download and install an expert advisor

In order to install an expert advisor on your MT4 platform, you need to follow these steps:

  1. Click on the “Download Indicator” button located at the bottom of the screen.
  2. Save the file to your computer.
  3. Extract and move the files into the MT4>Experts folder of the MetaTrader4 software file directory.
  4. Restart your Metatrader platform.
  5. Find and activate “PersistentAnti” Expert Advisor in the Navigator window.

Note: This Expert Advisor was developed by a third party. AtoZ Markets does not carry any copyrights over this trading tool.

Share Your Opinion, Write a Comment