Experts: Triangular Arbitrage

 

Triangular Arbitrage:

This Expert Advisor (EA) implements a triangular arbitrage strategy between three currency pairs: EURUSD, USDJPY and EURJPY

Author: Джованни Орсани

 
hola qusiera saber en que simbolo se coloca el EA para que trabaje o toca colocarlo en los tres simbolos que mencionas
 
Edward Garnica placed to work or it is necessary to place it in the three symbols that you mention.
Any symbol can be used, even a symbol other than the three mentioned, as they are all defined in the code.
 
Works well on historical data (target profit set at 0.1$). I set the delay (ping) at the level of 60 ms.

I also tried it on real data on a demo account:
It opens and closes trades, but at a disadvantage. Probably because of the long ping time (I had about 60 ms).
I want to try via VPS.
 
sfhomebiz #:
Works well on historical data(target profit set at 0.1$). I set the delay (ping) at 60 ms.
The reason is this.
void CloseArbitragePositions()
{
   double totalProfit = 0;
  
   // Calcola il profitto cumulativo delle posizioni col Magic Number
   for(int i = 0; i < PositionsTotal(); i++)
   {
      ulong ticket = PositionGetTicket(i);
      if(PositionSelectByTicket(ticket))
      {
         if(PositionGetInteger(POSITION_MAGIC) == MagicNumber)
            totalProfit += PositionGetDouble(POSITION_PROFIT);
      }
   }
  
   if(totalProfit >= ProfitTarget)
   {
      Print("Profit target raggiunto: ", totalProfit, ". Procedo alla chiusura delle posizioni.");
      
      // Chiude le posizioni iterando all'indietro per sicurezza
      for(int i = PositionsTotal() - 1; i >= 0; i--)
      {
         ulong ticket = PositionGetTicket(i);
         if(PositionSelectByTicket(ticket))
         {
            if(PositionGetInteger(POSITION_MAGIC) == MagicNumber)
            {
               string sym = PositionGetString(POSITION_SYMBOL);
               if(!trade.PositionClose(sym))
                  Print("Errore nella chiusura della posizione su ", sym, " - ", GetLastError());
               else
                  Print("Posizione su ", sym, " chiusa con successo.");
            }
         }
      }
   }
}
All EAs with this condition will show something good.
 
fxsaber #:
The reason is this. All EAs with this condition will show something good.
So it doesn't print results that were negative?
 
xery #:
So it doesn't display results that were negative?

Only when the Tester pass is stopped.

 
// This is more powerfull, higher trashold usable int CheckArbitrageOpportunity(double &diff, double &impliedPrice, double &directPrice) { double price1 = SymbolInfoDouble(symbol1, SYMBOL_BID); double price2 = SymbolInfoDouble(symbol2, SYMBOL_BID); directPrice = SymbolInfoDouble(symbol3, SYMBOL_ASK); impliedPrice = price1 * price2; diff = (impliedPrice - directPrice) / directPrice; if(diff > Threshold) return 1; price1 = SymbolInfoDouble(symbol1, SYMBOL_ASK); price2 = SymbolInfoDouble(symbol2, SYMBOL_ASK); directPrice = SymbolInfoDouble(symbol3, SYMBOL_BID); impliedPrice = price1 * price2; diff = (impliedPrice - directPrice) / directPrice; if(diff < -Threshold) return -1; return 0; }
 
michal_ #:
// This is more powerfull, higher trashold usable int CheckArbitrageOpportunity(double &diff, double &impliedPrice, double &directPrice) { double price1 = SymbolInfoDouble(symbol1, SYMBOL_BID); double price2 = SymbolInfoDouble(symbol2, SYMBOL_BID); directPrice = SymbolInfoDouble(symbol3, SYMBOL_ASK); impliedPrice = price1 * price2; diff = (impliedPrice - directPrice) / directPrice; if(diff > Threshold) return 1; price1 = SymbolInfoDouble(symbol1, SYMBOL_ASK); price2 = SymbolInfoDouble(symbol2, SYMBOL_ASK); directPrice = SymbolInfoDouble(symbol3, SYMBOL_BID); impliedPrice = price1 * price2; diff = (impliedPrice - directPrice) / directPrice; if(diff < -Threshold) return -1; return 0; }
Why do have you decided to use the bid of the first two symbols to calculate the ask of the directprice and viceversa ..?