Triangular arbitration

 

Arbitrage on three currency pairs as a continuation of the already mentioned topics: https://www.mql5.com/ru/forum/111484/page5 and https://www.mql5.com/ru/forum/128859/page98

Algorithm:

We enter the market on the arbitrage condition (we open three positions simultaneously on three pairs): EURUSD (Ask) * USDJPY (Ask) < EURJPY (Bid), i.e. we buy EURUSD and USDJPY, we sell EURJPY. Volumes of EURUSD and EURJPY positions must be equal. The volume of open positions for USDJPY, according to the theory of games, must be greater than or equal to the product of the volume of open positions on EURUSD and Ask price on EURUSD, i.e. USDJPY (lots) >= EURUSD (lots) * EURUSD (Ask).

We exit the market according to another arbitrage (close three previously opened positions): EURUSD (Bid) * USDJPY (Bid) > EURJPY (Ask).

If all goes well, i.e. without significant slippage not in our favour, we will get profit after closing the positions.


The Expert Advisor in the attached file is based on the above algorithm, but with slippage taken into account - the input parameter is slp (I haven't tested it yet, so it is quite possible that it contains errors).

Files:
 
And if it gives an error, change broker. What then?
 
If arbitrage is to be used, it should only be used to create a stable channel .Triangular arbitrage is a road to the graveyard. If we take all pairs with dollar and euro for example, we may almost always find 2 pairs for eurodollar (one of dollar pairs and one of euro pairs), which have higher equity than eurodollar.
 
nikelodeon:
And if it gives an error, change broker. What then?

Theoretically it is possible to recalculate the lots of all pairs for any contract size, but it is easier to change broker.
 
trol222:
If arbitrage is to be used, it should only be used to create a stable channel .Triangular arbitrage is a road to the graveyard. If we take all pairs with dollar and euro for example, we may almost always find 2 pairs for eurodollar (one of dollar pairs and one of euro pairs) whose equity is higher than that of eurodollar.

Everyone is very good at this. I will put the EA on the demo, and then we will see where the road lies.
 

Which broker would you suggest? Or rather, the question is which broker does the advisor work with.... Can you run it in a test?

 
nikelodeon:

Which broker would you suggest?


None. It is forbidden on this forum to discuss them, advertise them, etc.

Theoretically, any broker that meets the conditions would be suitable for this EA:

1. Size of contracts for all three pairs is equal

2. Minimum lot does not exceed 0.01

3. There is no prohibition on arbitrage transactions in the contract

 

Already found one inaccuracy in the code and added an extra check.

The latest version is in the attached file:

Files:
 
I still can't test it.... I can't find the right broker. If you don't mind telling me in person which broker he works for. At least starts making trades. I just liked the idea in general...
 

I have the same request to change broker

Garynych Triangle Expert Advisor works on audusdjpy

Files:
 
Reshetov:


Arbitrage on three currency pairs as a continuation of the already mentioned topics: https://www.mql5.com/ru/forum/111484/page5 and https://www.mql5.com/ru/forum/128859/page98

Algorithm:

We enter the market on the arbitrage condition (we open three positions on three pairs simultaneously): EURUSD (Ask) * USDJPY (Ask) < EURJPY (Bid), i.e. we buy EURUSD and USDJPY, we sell EURJPY. Volumes of EURUSD and EURJPY positions must be equal. The volume of open positions for USDJPY, according to the theory of games, must be greater than or equal to the product of the volume of open positions on EURUSD and Ask price on EURUSD, i.e. USDJPY (lots) >= EURUSD (lots) * EURUSD (Ask).

We exit the market according to another arbitrage (close three previously opened positions): EURUSD (Bid) * USDJPY (Bid) > EURJPY (Ask).

If everything goes well, i.e. without significant slippages not in our favour, we will receive a profit after closing the positions.


The Expert Advisor in the attached file is based on the above algorithm, but with slippage taken into account - the input parameter is slp (I haven't tested it yet, so it is quite possible that it contains errors).


The contract sizes should not be equal, otherwise we will get a large equity swap of all positions.

My result is approximately buy eurusd 8000 buy usdjpy 13000 sell eurjpy 10000

You don't even need an EA to check it, just an indicator with lot selection by instrument

Reason: