how does triangular arbitrage work on MT4?

 

heres what i have so far...im confused however how this can generate revenue.

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
      double Direct = MarketInfo("GBPJPY",MODE_BID);
      
         double Middle1 = MarketInfo("USDJPY",MODE_ASK);
         double Middle2 = MarketInfo("GBPUSD",MODE_ASK);
      
      double Indirect = (Middle1)*(Middle2);
      
      double Spread = MarketInfo("GBPJPY",MODE_SPREAD);
   
   if((Direct-Indirect)<Spread)
      {
      string Stars = "*****";
      Alert("Arbitrage Opportunity!");
      
      //Direct
     int DirectTicket = OrderSend("GBPJPY",OP_SELL,0.1,Direct,0,0,0,0,0,0,Red);
   
      
      //Indirect
      if(DirectTicket<0)
         Alert("Direct Order Failed. Thus, Indirect Orders Unexecuted");
      else
         {
           OrderSend("USDJPY",OP_BUY,0.1,Middle1,0,0,0,0,0,0,Yellow);
           OrderSend("GBPUSD",OP_BUY,0.1,Middle2,0,0,0,0,0,0,Green);
         }
      }
         
      
      
      Alert(Stars," Direct Price: ",Direct,"    ","Indirect Price: ", Indirect,"    ", "Spread: ", Spread,"    ","Price Misalignment: ",(Direct - Indirect)*100," pips ",Stars);
    
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
 

Hi,

though old post thought to reply

check here..

http://kreslik.com/forums/viewtopic.php?t=307

If you still doing, hope it helps you.

Reason: