As a study, I've developed a simple algorithm to detect market discrepancies for triangular arbitrage opportunities through the OANDA REST API. To my surprise, it actually discovered a few of said discrepancies due to the recent fall of the Turkish Lira. However, I do not know how to execute orders in such a way as to capitalize on these opportunities.
Since every trade is closed by entering into a trade that takes the opposite position, how is it possible to trade triangularly?
For example, if there was a discrepancy that allowed me to profit by trading USD > EUR > TRY > USD, how would I actually close this trade triangle?
Logically, I would buy EUR/USD, sell EUR/TRY, and buy USD/TRY. I would be buying EUR with USD, selling those EUR for TRY, and then buying back my USD with that TRY.
However, if none of these trades are opposite to one another, then none of the trades actually close, and the profit is never realized.
How exactly, then, can one capitalize on a triangular arbitrage opportunity? Does it require a particular broker or account that allows for triangular closing of trades?