High Frequency Expert Advisor - a profitable high-frequency for contests and not only
The development of the retail market makes the old developments relevant again. If in the past a dealer could easily ban a trader for a large flow of orders by ceasing to accept orders, the modern market scheme is directly dependent on the traded volume. In this article we will consider one of such Expert Advisors, though not directly related to HFT, but with a fairly high frequency of trades.
Description of the strategy of the High Frequency Expert Advisor
High Frequency Expert Advisor trades in the direction of price momentum. When there is a sharp up or down movement in the market, the Expert Advisor sets a pending order in the direction of this movement. Those who have traded on the news know that trying to enter the market on impulse can end up failing, especially if one enters on the market or with stop orders. The main problem here is slip. On the other hand, if the momentum is big enough, then even if you open with a slippage, you will still make a profit.
But there is a question of fixing profits. It is important to take profit before the price reverses. The HF Expert Advisor uses a primitive method for closing positions based on total profits. When the total profit for all positions reaches a certain value, all orders are closed, and the pending ones are deleted. The advantage of this method is its simplicity and predictability of profitability. The disadvantage is that the Expert Advisor does not manage individual orders, which is why the loss on a single order will pull the account down and positions may stay open for a very long time.
How is the momentum to open a position determined?
The period N (say, 10 seconds) in the parameters of the Expert Advisor determines the period of recalculation of indicators. Roughly speaking, this is the internal timeframe of the Expert Advisor. Every 10 seconds, the Expert Advisor calculates the direction in which the price moved relative to the previous value and by how much. If the size of the movement turned out to be larger than the average and at the same time larger than the value of the minimum shift min_range, then opens a Buy Stop or Sell Stop order, depending on the direction of the shift. The position of ROC indicator relative to zero is also taken into account. Buy only when its value is greater than zero and sell only when ROC is less than zero.
There is no limit on the number of orders in High Frequency Expert Advisor, so you should carefully monitor the amount of free margin. If too many orders have accumulated, it is better to manually close all current positions, even if there is a small loss on them.
Expert Advisor Settings
- ROC_Period - ROC indicator calculation period.
- IND_TF - indicator timeframe.
- lot - a fixed lot for a pending order.
- profit - profit takeprofit.
- N - period in seconds for internal calculations.
- K - averaging period.
- min_range - minimum price pulse.
- range_stop - distance in points for placing an order from the current price.
- magic - the unique number of the advisor.
Testing High Frequency Expert Advisor
When testing high-performance EAs, you should take into account that the MetaTrader 4 tester does not take into account slippages, requotes and floating spreads. Therefore, any test can only give a rough idea of how the Expert Advisor behaves on a real account.
What can testing in the tester be good for?
In any case, before putting such a robot on a real account, it is necessary to determine the approximate settings and currency pairs for trading. That is, you should first find out the potential of trading instruments. For testing, you can limit yourself to major currency pairs. Cross-course gives little information for the test, because it is easily calculated from the same majors.
We will optimize the Expert Advisor on two parameters: ROC period and distance for setting an order. Trading timeframe M1. The test will be conducted for June 2016. Let's look at the optimization results for the major currencies. In this case, saturated green color on the optimizer charts means the largest profit (but not necessarily the smallest drawdown).
EURUSD
The result with ROC(20) and range_stop equal to 4 points turned out to be the undoubted leader. Apparently, it is the relatively low volatility of EURUSD, due to which the absolute value of the impulse is also quite small.
The test with the specified parameters showed a fairly stable growth in profitability, with a small drawdown.
GBPUSD
It is not for nothing that these currencies are called twin brothers. As with the euro, we see a clearly drawn boundary above the most optimal 4 pips for the pound. Accordingly, the values of 8 and 2 points for the range_stop will be most unsuitable. The best periods for the ROC indicator in descending order are 15, 10 and 20.
Test on the optimal values of return to risk.
USDCHF
Unfortunately, just like with the USDJPY, the franc did not get good results.
Nevertheless, the best pass with ROC(20) and range_stop equal to 4 pips, which provided a sufficiently high frequency of transactions.
USDCAD
The Canadian shows a clear advantage of long distances. But there were no positive results with the range_stop parameter below 6 points at all.
So, the optimal parameters for a Canadian are a period of 20 pips and a distance to the order of 10 pips.
AUDUSD
There were much more profitable results for the Aussie. What is interesting, the best profit result is almost similar to EURUSD.
Nevertheless, the optimal result with the lowest relative drawdown was obtained with range_stop equal to 10 points and 20-period ROC.
NZDUSD
Rare but more noticeable impulses are typical for the New Zealander. Apparently, in connection with this, the best result and the optimal value of the return to risk was obtained with ROC(25) and range_stop equal to 10 points.
The test showed one of the smallest drawdowns of the tested pairs.
Results of the study
Before using a High Frequency Expert Advisor on a real account, there are several factors to consider:
- First, a large number of orders are sent to the server. If you trade in a dealing center (DC), you are likely to be frequently requotes. In extreme cases, you may even be blocked for such trading. If you noticed the problems with the execution, try to increase the parameter N. The higher the value, the lower the frequency of orders.
- Secondly, the Expert Advisor is very sensitive to slippage. It is worth bearing in mind that it uses stop orders, which means that even on market execution there can be large slippages. There is no obvious solution. Alternatively, you could try another broker.
- Third, given the small goals, trading costs (spread and commission) should be minimal. Summarizing these data, we come to the conclusion that the best solution for the Expert Advisor is ECN-broker. Ideally, it is necessary to test the work of the Expert Advisor in several offices at once, because brokers do not always use the same quote providers, and here LMAX with its almost guaranteed execution comes in handy.
>> Download High Frequency Advisor
Other Advisors
- Profit Pacman Expert Advisor - Martingale for Beginners
- Aeron JJN Scalper EA - intraday scalping
- Expert Advisor Robot - stochastic + artificial intelligence
- Ilan 1.6 Dynamic Expert Advisor - Expert Advisor for Bonus Acceleration
Why when I run it, I have only one pending order in the window, and in the history of the account constantly appear closed pending orders with no profit (no numbers) and so no deals. What is wrong?
Did you set all the indicators?