• Overview
  • Reviews (8)
  • Comments (172)
  • What's new

TriArb Trader

The Expert Advisor implements the classic "triangular arbitrage", which is successfully used by hedge funds.

"Triangular" arbitrage refers to a class of neutral-market strategies, in which the profit or loss of open positions does not depend on the direction of the market movement as a whole.

In order to take profit, the EA exploits a weak spot of market makers - it utilizes the difficulty of balancing cross rates of all currency pairs.


The advantages of the strategy are the following:

  • no risk that market reverses against your position;
  • no risk of 'stops' taking by a broker or market maker;
  • the strategy is neutral to news swings and gaps.


Basic principles

Quotes of the main Forex currencies to the USD (EURUSD, GBPUSD, USDJPY, USDCAD, etc) are called the major currency pairs (majors). Quotes currencies (except USD) to each other are called cross rates or cross pairs. The cross rate of two currencies is calculated through their rates to the USD (for example, cross rate of EURJPY is calculated as product of EURUSD rate and GBPUSD rate). At the same time, the cross pairs are actively traded in the market as separate instruments.

Further, the cross pair is defined as the currency pair, which is an independent trading instrument in the MT5 platform, and the synthetic cross rate (synthetic) is defined as a synthetic position formed from two major currency pairs. For example, the EURJPY cross pair can be fount in the MT5 platform under Forex/Crosses. At the same time, the synthetic EURJPY cross rate can be obtained by simultaneously opening positions on EURUSD and USDJPY.

It is important to understand, that in a free market, rates of a cross pair may not match the value of the synthetic cross rate, as the rates of the cross pair depend on the supply and demand for these currencies against the USD.

As a result of such deviations, the arbitrage opportunity arises, which is called "triangular" because this strategy involves buying and selling currencies in the triangle (buy EUR against USD, buy USD against GDP, buy GBP against EUR - a closed triangle).

Although market makers try to eliminate any deviations of rates, however, in times of strong market movements the market maker might not have the time to "level" the rates. As a result such "triangular" arbitrage opportunities arise more or less regularly (confirmed by numerous empirical studies).


Risk of arbitrage strategies

  • arbitrage strategies use hedging, the cost of which can sometimes be substantial (spread, trading commissions, swaps);
  • arbitrage positions may be substantially "illiquid" - open position can long remain in minus;
  • "triangular" arbitrage is sensitive to price slippages, delays may cause the trades to be executed at the moment when the arbitrage opportunity disappears, which may lead to losses.

Because of these risks, it is hard to implement arbitrage strategies in practice. However, (maybe that's why), such strategies are widely used by talented hedge fund managers.


The TriArb Trader EA

  • Implements high-frequency trading algorithms.
  • The EA code is optimized as much as possible to reduce the execution time of trade operations.
  • As a result, the EA is resistant to slippage and delays up to 300 ms.
  • Automatically adjusts the "triangle" in case one of positions is not opened or closed by accident.
  • Trades any cross rates and major pairs both in direct and inverse quotes.
  • Automatically detects the order execution policy that is used by the broker on the account.
  • Automatically detects accounts with hedging.
  • Able to "pick up" a position previously opened by an EA running on a different platform.
  • Allows for presence of other experts and manual trading.


Description of the EA parameters and recommendations on configuration

  • Cross pair symbol - symbol of the cross pair (for example, EURJPY)
  • First cross pair symbol - the first symbol of the cross pair (in case of EUR - EURUSD)
  • Second cross pair symbol - the second symbol of the cross pair (in case of JPY - USDJPY)
  • Second symbol is in direct quotation - set to true, if the second symbol is in the direct quote; set to false if the second symbol is in reverse quote (in the example with EURJPY, the second symbol is in reverse quote, so set to false)
  • Expert Advisor ID (Magic Number) - ID of the Expert Advisor, any integer value less than 2,147,483,647, unique for each EA on the account.
  • Max deviation (slipage) - as it is important to ensure the trades are opened, select a sufficiently large value for this parameter (100-200).
  • Arb. period (ms) - period for checking the arbitrage conditions (the EA works optimally when the checking period is set to 100-500 ms).
  • Max. number of trade retries - the maximum number of attempts to place a trade order (3-4 are enough, but setting 30-40 is more reliable).
  • Minimum deviation for in-trade (points) - the minimum deviation of the triangle prices for opening position (works well with 5-15 points for five-digit account, however, when increasing the Take Profit parameter, it is better to increase the value to 20-40. Decreasing the parameter to 2 while reducing the Take Profit defines the mode of risky scalping).
  • Minimum deviation for out-trade (points) - the minimum deviation of the triangle prices for closing position once the total loss of triangle position exceeds the value of the Max. Loss parameter (it is better to set it 1.5-2 times less than the Minimum Deviation for in-trade).
  • Take Profit (USD) - the total profit (in the deposit currency) of three positions in the triangle, at which the EA generates a signal to close the position (optimally exits the position when set to 2-4 at lot size of 0.1; for other lot sizes, change the parameter value proportionally, i.e. the optimum Take Profit for 1 lot is 20-40).
  • Max. Loss (USD) - maximum total loss (in the deposit currency) of all three positions, at which the EA generates an exit signal if the inverse deviation of the triangle prices is greater than the value of the 'Minimum deviation for out-trade' parameter (it is better to leave the value 4-5 times greater than 'Take Profit', but not greater than USD200-300, otherwise it will close with significant losses during strong impulses).
  • Trading volume - all recommended values were derived from 0.1 lot (for other lots, the Take Profit and Stop Loss parameters should be changed proportionally).

Before running the EA on a real account, make sure you understand the operation mechanism as well as the purpose of the EA parameters!!!

The detailed description of the EA operation principles and configuration of the parameters is provided in Russian (https://www.mql5.com/ru/blogs/post/683146) and English (https://www.mql5.com/en/blogs/post/684655).

Yury Gavrilov
69
2017.03.17 13:29 
 

Это единственный робот, который может делать 100 % в месяц. при депозите 300-500 долларов и мин.лоте.

Мне удалось подобрать параметры, при которых робот зарабатывает.

Нужен брокер с хорошим исполнением и VPS.

За две недели заработано (и выведено) лотом 0.05 $541.75.

Обычно при таком лоте в течение недели он зарабатывает немного, долларов 10, но раз-два в неделю, на новостях, проявляет себя в полной красе.

Особенно хорошо показал себя на последнем NFP (10 марта 2017), ~170 долл. за 5 минут

Это отличная штука, но нужно подбирать параметры для каждого брокера.

avtal
9593
2017.02.14 02:29 
 

Evaluation after 4 weeks of testing with version 8.5 in real account and demo account simultaneously, with 5 ms latency.

The result in demo account is very good and resembles the backtest. However, the actual account result is totally different. While the demo closes profitably on the actual account almost always closes at a loss. Even altering the parameters, the actual account result is always negative.

Before buying EA i suggest renting and testing on real account.

If EA becomes profitable in the future I will review the comment.

Stef Smeers
27
2017.01.27 19:49 
 

Very good results in the backtest. Also had great assistance from Oleg (the author of the script).

I'm going to test it on a demo account now and afterwards on my real account. Will keep you guys updated with the results.

Mahmoudibarmas Mehdi
606
2017.01.27 18:30 
 

this works very good on backtest and demo account. but in real account, all trades close with loss and can eat all your deposit during 1-2 weeks.

THIS IS BEACAUSE THE SLIPAGE OF BROKERS IN ARBITRAGE TIMES INCREESE FROM 10~500 ms to 1~5 Seconds and THUS ALL POSITIONS OPEN WITH WRONG PRICES.

Tommaso Santarelli
201
2017.01.18 19:28 
 

I'm testing this EA, both in test mode and in real account. The first results are good. Great assistance from the developer, in finding best input parameters and in resolving some my mistakes. Keep going like this!

alexk151
41
2017.01.17 14:08 
 

Don´t buy this EA it will destroy your Tradingaccount,maybe not immediately but definitely.

It doesn´t matter if it looks good in the tester.

Airat Zainetdinov
284
2017.01.15 10:48 
 

Работает хорошо , но не зарабатывает!(((( жалко потраченных денег((( еще один вывод: Реал всегда отличается от демо или тестера. Может быть вмешательство брокера???!!!!

Nikolay Mikhnev
66
2017.01.03 13:36 
 

Моё мнение. СУПЕР.

Version 8.5 - 2017.01.13
Minor changes in the algorithm of parallel operation of multiple experts.
Reduced and optimized the amount of entries in the experts log.
Version 8.4 - 2016.12.30
The following changes have been made to the new version (8.4) of the Expert Advisor:
- Significantly increased the execution speed of trading orders by the use of high-frequency trading (HFT) algorithms.

- Implementation of a more efficient algorithm for checking the triangle integrity allowed to eliminate the pauses between placing trading orders and checks.
Accordingly, the "Pause before integrity check (ms)" parameter has been excluded from the inputs.

- Significant optimization of the code allowed to additionally increase the execution time of trading operations, which allows the EA to cope with a delay of 300 ms.

Parameters of the EA and their recommended values
-----------------------------------------------------------------------------
- Cross pair symbol - enter the symbol of the cross pair (for example, EURJPY)
- First cross pair symbol - enter the first symbol of the cross pair (in case of EUR - EURUSD)
- Second cross pair symbol - enter the second symbol of the cross pair (in case of JPY - USDJPY)
- Second symbol is in direct quotation - set to true, if the second symbol in the direct quote; set to false if in indirect (in the example with EURJPY, the second symbol is in indirect quote, so set to false)
- Expert Advisor ID (Magic Number) - any integer value less than 2,147,483,647, unique for each EA on the account.
- Max deviation (slipage) - as it is important to ensure the trades are opened, select a sufficiently large value for this parameter (100-200).
- Arb. period (ms) - period for checking the arbitrage conditions (the EA works optimally when the checking period is set to 100-500 ms).
- Max. number of trade retries - the maximum number of attempts to place a trade order (3-4 are enough, but setting 30-40 is more reliable).
- Minimum deviation for in-trade (points) - the minimum deviation of the triangle prices for opening position (works well with 5-15 points for five-digit account, however, when increasing the Take Profit parameter, it is better to increase the value to 20-40. Decreasing the parameter to 2 while reducing the Take Profit defines the mode of risky scalping).
- Minimum deviation for out-trade (points)- the minimum deviation of the triangle prices for closing position once the total loss of triangle position exceeds the value of the Max. Loss parameter (it is better to set it 1.5-2 times less than the Minimum Deviation for in-trade).
- Take Profit (USD) - the total profit (in the deposit currency) of three positions in the triangle, at which the EA generates a signal to close the position (optimally exits the position when set to 2-4 at lot size of 0.1; for other lot sizes, change the parameter value proportionally, i.e. the optimum Take Profit for 1 lot is 20-40).
- Max. Loss (USD) - maximum total loss (in the deposit currency) of all three positions, at which the EA uses exit if the inverse deviation of the triangle prices is greater than the value of the 'Minimum deviation for out-trade' parameter (it is better to leave the value 4-5 times greater than 'Take Profit', but not greater than USD200, otherwise it will close with significant losses during strong impulses).
- Trading volume - all recommended values were derived from 0.1 lot (for other lots, the Take Profit and Stop Loss parameters should be changed proportionally).
Before running on a real account, make sure you understand the operation mechanism as well as the purpose of the EA parameters!!!
Version 7.2 - 2016.12.14
What's new in v.7.2:

- Added check of zero ticks. This check solves the problem of missing ticks that occurred in tester (ONLY in tester) when testing on real ticks.

- Added the ability to re-send a trade request in case of failure. The number of attempts is defined in "Max. number of trade retries". This option increases the reliability of trading operations.

- Added a pause between the time when a message about the acceptance of a trade order for execution is received from the trade server and start of check of the "triangle" integrity. The duration of the pause is configured in "Pause before integrity check (msc)". This pause is necessary if reports about position opening are delivered from the server with a delay. If the EA started integrity check before the report about position opening or closure is received, it saw the missing/excessive position and immediately tried to solve the problem, which led to repeated opening/closing of the position.

- Position closing logic changed. IN a normal situation positions are closed upon reaching the total profit of all three positions of the triangle, which should exceed "Take-Profit (USD)" (set in deposit currency).

However, if the position does not move to profit, and the loss of a position (module) exceeds "Max. Loss (USD)" (also in deposit currency), the position is closed using the parameter "Minimum deviation for out-trade (points)". I.e. if loss is too large, the position will be closed in case of deviation of "triangle" prices.

Thus, the minimum price deviation (formerly arbitration threshold) is now set separately for position opening and closing. "Minimum deviation for IN-trade (points)" sets the minimum threshold for position opening. "Minimum deviation for OUT-trade (points)" sets the minimum threshold for position closing.

- Significantly improved the reliability of the EA on hedging accounts.

ATTENTION! The EA available on the Market has non-optimal parameters.
Recommended EA parameters are below:
Parameter | Recommended value
-----------------------------------------------------------------------------
- First major pair (vs USD) | EURUSD
- Second major pair (vs USD) | GBPUSD
- Cross pair (as First major vs Second major) | EURGBP
Both majors are in direct quotation | true
-----------------------------------------------------------------------------
- Expert Advisor ID (Magic Number) | 666
- Max deviation (slipage) | 30
- Arb. period (msec) | 500
- Pause before integrity check (msc) | 10
- Max. number of trade retries | 10
- Minimum deviation for in-trade (points) | 10 (5-digit)
- Minimum deviation for out-trade (points) | 20 (5-digit)
- Take Profit (points) | 20
- Msx. Loss (points) | 30
- Trading volume | 0.1

Specific values ​​of optimal parameters depend on the trading conditions of your broker.