Heiken Ashi Naïve EA (Reverse Heiken Ashi strategy) | FREE Forex Trading EA
Heiken Ashi Nave is a MetaTrader expert advisor that uses the platform’s standard indicator of the same name to implement the Heiken Ashi charting method. The used trading technique is unsophisticated in that it merely analyses the most recent two Heiken Ashi candles and does not perform any complex pattern analysis. The only catch is that the expert advisor trades against the present Heiken Ashi setup, which confirms the projected trend direction. Its main benefit is that there are no input parameters to tune or curve-fit to previous data. For better money management, ATR-based position size is an option. There are two versions of the EA: one without Z-Score optimization and one with it. The expert advisor (with and without Z-Score optimization) is available for both MT4 and MT5 versions of the platform.
Heiken Ashi (or Heikin Ashi, from Japanese 平均足) is an alternative technique of representing the usual candlestick charts for the purpose of trading. Unlike with traditional Japanese candles, it is impossible to read the actual price levels (Open, High, Low and Close) on Heiken Ashi chart, but it is easier to spot trend developments and reversals. Rising Heiken Ashi candles are usually plotted as white ones, and the falling — as red ones. Similarly to the standard candles, Heiken Ashi show wicks. Neither direction of a candle, nor the length of its wicks point to actual price levels, but rather should be considered in relation to other Heiken Ashi candles in the close proximity.
The switch of colors means a change of trend: red to white — a bearish trend reversal, white to red — a bullish trend reversal. Increasing candle body length signals strengthening of trend. Decreasing — signals weakening. Lower wicks on white candles and upper wicks on red candles signal volatility and trend instability. Lack of such wicks indicates a definite and clear trend.
The following rules are used to calculate Heiken Ashi candle levels:
- HA_Open = (previous HA_Open + previous HA_Close) / 2
- HA_Low = minimum(Low, HA_Open, HA_Close)
- HA_High = maximum(High, HA_Open, HA_Close)
- HA_Close = (Open + High + Low + Close) / 4
- HA_Open, HA_High, HA_Low and HA_Close — Heiken Ashi candle levels.
- Open, High, Low and Close — normal candle levels.
- The levels of the initial HA candle are equal to respective levels of the original candle.
Heiken Ashi Chart
The chart that you see below demonstrates the Heiken Ashi candle technique, showing both trending and ranging periods. The initial uptrend (white) becomes weak with Heiken Ashi doji and turns red for four candles. Only one candle (second) in this downtrend qualifies for a strong bearish trend according to Heiken Ashi rules outlined above. The renewed bullish trend shows a period of weakness (short-bodied candles with downside wicks) but then returns to its strength. A small red correction goes rather deep and is signaled as such by the long-bodied candles without upper wicks. Without a clear reversal signal, a new upward trend ensues. It was followed by a plateau with a chaos of red/white colors, which ended in a long downward trend. A small correction consisting of five white with one red candle in a middle did not stop the whole trend going south till the end of the chart.
- - - - - - - -
⭐The Best Cent Account To Test Your Forex Trading EA.⭐
- - - - - - - -
⭐Great Forex Broker With High Affiliate Commission For Your Forex Trading EA.⭐
Naturally, such an indicator looks rather promising to traders who wish to trade on trends and their reversals.
Heiken Ashi Naïve expert advisor uses a rather simple, yet not very obvious method to trade with Heiken Ashi candles.
The following entry signals are used:
- Sell if the latest completed HA candle is bullish, its body is longer than previous candle’s body, previous candle is also bullish, and latest candle has no lower wick.
- Buy if the latest completed HA candle is bearish, its body is longer than previous candle’s body, previous candle is also bearish, and latest candle has no upper wick.
If there exists an open position in an opposite direction when a signal arrives, the position is closed. If the existing position is in the same direction as the signal, the latter is ignored.
The following exit signals are used to close trades before a new entry signal arrives:
- Exit short position if the latest completed HA candle is bearish, previous candle is also bearish, and the latest candle has no upper wick.
- Exit long position if the latest completed HA candle is bullish, previous candle is also bullish, and the latest candle has no lower wick.
As you can see, the expert advisor uses the inverted logic in its trading strategy. It goes long when the Heiken Ashi system points at a rather strong bearish trend, and it goes short when it is a bullish rally according to Heiken Ashi. The trick here is that it tries to catch reversals as early as possible.
The chart screenshot from the strategy backtest on EUR/JPY is shown below. There are six completed trades:
- The first position is bearish (shown with a red arrow) and lasts for 8 candles until the new position is entered following bullish entry signal generation.
- The second position is bullish (shown with a blue arrow) and is a big loser. The downtrend signaled by Heiken Ashi turns out to be a lasting one, so the advisor’s system fails here.
- The third position is a short-term bearish one (second red arrow). It lasts only 3 days and is quite profitable.
- The fourth position is a short-term bullish one (second blue arrow) and is even more profitable.
- The fifth position is another short-term sell (third red arrow). It is the most profitable trade of the six shown in these examples.
- The sixth position is long (third blue arrow). It is very profitable and last for long enough to live through several white candles, which fail to trigger exit conditions for the bullish trade.
Heiken Ashi Naïve expert advisor uses the same advanced position sizing system as the Ichimoku Chikou Cross expert advisor. It is capable of both fixed position size and ATR-based fixed fractional position size.
The second version of this expert advisor has Z-Score optimization implemented in its algorithm. Z-Score optimization is based on the intrinsic parameter of some Forex strategies. Basically, Z-Score value tells us if there is any correlation between the trade outcomes of the given strategy. Large positive Z-score (like the one of Heiken Ashi Naïve on EUR/JPY @ D1) means that the winning trade is likely to be followed by a losing one, and that the losing trade will probably be followed by a winning one. Large negative Z-score would mean that winning trades are often followed by more winning trades, while losing trades frequently follow the same losing trades. Obviously, such metric can be used to optimize a trading strategy or an expert advisor.
Heiken Ashi Naïve with Z-score optimization stops trading following a profitable trade. It then switches to a virtual trading mode, where it calculates the trades, but does not actually send any orders to MetaTrader sever. Once a losing virtual trade is encountered, the EA switches back to real trading mode and continues normal operation. This expert advisor is also capable of saving and loading all the virtual trading data from file, preventing Z-score optimization malfunction due to software or hardware failures.
The backtest of the Heiken Ashi Naïve expert advisor was performed on the period from 1 January, 2001 through 6 December, 2013 (almost 13 years) on the EUR/JPY D1 chart.
When fixed position volume of 0.1 standard lot has been used, the resulting net profit was $11,112 on $10,000 starting account balance with the maximum relative drawdown of 15.8%.
With ATR-based position sizing enabled (ATR period = 20; ATR multiplier = 1; 2% risk tolerance), the resulting net profit increased to $29,903 on the same $10,000 starting account balance, while the maximum relative drawdown increased to 39%.
Backtesting Z-Score Optimized EA
Z-Score optimized version of Heiken Ashi Naïve expert advisor was backtested on the same data as the original version. The performance resulted in $8,119 profit and 9.11% relative drawdown for a fixed position size (0.1 standard lot). When using ATR-based position sizing, the EA has shown $15,002 with 20.9% drawdown.
As you can see, there is little point in using a Z-Score optimized version of this expert advisor unless you really need to obtain a lower drawdown value. Z-Score version makes only 109 trades compared to 349 trades of the original version. Another advantage of Z-Score version is the expected payoff of $74.49 vs. $31.84 per trade and the doubled Sharp ratio (0.31 vs. 0.14).
- Lots (default = 0.1) — basic lot size for fixed position sizing. Used when MM = false.
- MM (default = false) — if true, ATR-based position sizing is enabled.
- ATR_Period (default = 20) — the period of the ATR indicator, which is used for position size calculation. Works only if MM = true.
- ATR_Multiplier (default = 1) — a value, by which the ATR indicator value will be multiplied. Works only if MM = true.
- Risk (default = 2) — risk tolerance in percentage of account balance/equity. Works only if MM = true. This input parameter is ignored if UseMoneyInsteadOfPercentage is set to true.
- FixedBalance (default = 0) — if set to non-zero value, it is used instead of account balance/equity for position size calculation. Works only if MM = true.
- MoneyRisk (default = 0) — risk tolerance in account currency. Works only if MM = true. Requires UseMoneyInsteadOfPercentage to be set to true.
- UseMoneyInsteadOfPercentage (default = false) — if true, position size is calculated based on risk amount given in account currency (MoneyRisk) instead of balance/equity percentage risk (Risk). Works only if MM = true.
- UseEquityInsteadOfBalance (default = false) — if true, position size is calculated based on account equity instead of balance. Works only if MM = true. Ignored if UseMoneyInsteadOfPercentage = true.
- LotDigits (default = 2) — number of decimal places allowed by your broker in order volume. For example, if your broker allows micro lots (0.01), then this parameter should be set to 2. If your broker allows only mini lots (0.1) this parameter should be set to 1. Required only if MM = true.
- OrderComment (default = “HAN”) — the commentary for positions opened by this EA.
- Slippage (default = 100) — the acceptable price slippage in pips.
- Magic (default = 152207122013) — the order magic number to filter positions opened by this EA. Used only in MT4.
- Mute (default = false) — if true, EA will produce no output regarding virtual trading events. This input parameter is present only in Z-Score optimized version.
- FileName (default = “HAN_vt.dat”) — the name of the file used by the EA to store virtual trading data. This input parameter is present only in Z-Score optimized version.
What is the average win/loss size generated by this EA?
Its backtest on EUR/JPY @ D1 showed an average losing trade of 287 pips and an average winning trade of 183 pips. The version with Z-Score optimization has shown 241 pips average loss and 156 pips for average profitable position.
How often does this EA trade?
On daily EUR/JPY chart (default setting), this EA will trade about 2 times a month on average. Z-Score version of Heiken Ashi Naïve will trade about 8 times a year.
What is the difference between the versions for MT4 and for MT5?
MT5 version will interfere with positions of other expert advisors on the same currency pair. MT4 will use Magic number to avoid that.
Did it show profitable results on any other currency pairs?
Some other currency pairs show insignificant profit, which are spoiled by big drawdowns. It looks like only EUR/JPY has some trading characteristics that are captured by this expert advisor.
Did you optimize the input parameters of this expert advisor?
There are no inputs to optimize unless you consider currency pair and timeframe as inputs.
This EA is ECN-safe. You can freely use this expert advisor with ECN (market execution) brokers as it either does not apply any stop-loss and take-profit levels in its trading orders or sends only pending orders.
Z-Score Optimized Version
You May Also Like ❤ :
The extreme spike indicator is a Metatrader indicator that detects market trend extreme high and extreme low spikes. It is...
Heiken Ashi Nave is a MetaTrader expert advisor that uses the platform’s standard indicator of the same name to implement...
PersistentAnti EA (Measures persistence of price movements; trades against it) | FREE Forex Trading EA
PersistentAnti is a Forex expert adviser that takes advantage of the concept of trend persistence. The Forex market charts are...
Ichimoku Chikou Cross EA (Uses Ichimoku Kinko Hyo for signals, ATR for position sizing) | FREE Forex Trading EA
Ichimoku Chikou Cross is a MetaTrader expert advisor based on standard Ichimoku Kinko Hyo indicator with default settings. Specifically, it...