Indicators: Arbitrage

 

Arbitrage:

The indicator draws two lines that represent the difference between two currencies derived from three pairs/currencies.

Difference between two currencies.

Author: pipPod

 

HI pipPod,


Is it possible to have an EA that alerts when the color changes from blue to green and viceversa ?!


Thank you so much.

 
gerardplatero:

HI pipPod,


Is it possible to have an EA that alerts when the color changes from blue to green and viceversa ?!


Thank you so much.

input bool AlertsOn=true;     //Alert when cross

      BaseBuffer[i] = baseIndex;
      QoteBuffer[i] = qoteIndex;
//---
      if(FillBuffers)
        {
         colorFill = (baseIndex>qoteIndex)?color1:color2;
         ObjectCreate((string)(uint)time[i],time[i],BaseBuffer[i],QoteBuffer[i]);
        }  
      if(AlertsOn && prev_calculated>0)
        {
         static datetime timePrev;
         if(BaseBuffer[i]>QoteBuffer[i] &&
            BaseBuffer[i+1]<QoteBuffer[i+1] &&
            timePrev!=time[0])
           {
            Alert("Buy "+_Symbol);
            timePrev = time[0];
           }
         if(BaseBuffer[i]<QoteBuffer[i] &&
            BaseBuffer[i+1]>QoteBuffer[i+1] &&
            timePrev!=time[0])
           {
            Alert("Sell "+_Symbol);
            timePrev = time[0];
           }
        }
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }

or

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   double baseCurr = iCustom(NULL,0,"Arbitrage",0,0);
   double basePrev = iCustom(NULL,0,"Arbitrage",0,1);
   double quoteCurr = iCustom(NULL,0,"Arbitrage",1,0);
   double quotePrev = iCustom(NULL,0,"Arbitrage",1,1);

   static datetime timePrev;
   if(baseCurr>quoteCurr &&
      basePrev<quotePrev &&
      timePrev!=Time[0])
     {
      Alert("Buy ",_Symbol);
      timePrev=Time[0];
     }
   if(baseCurr<quoteCurr &&
      basePrev>quotePrev &&
      timePrev!=Time[0])
     {
      Alert("Sell ",_Symbol);
      timePrev=Time[0];
     }
  }
//+------------------------------------------------------------------+
 

I think there is a mistake at OnInit() where you check the USDJPY pair

 

if(_Symbol==USDJPY)  
     {
      color1 = clrLimeGreen;
      color2 = clrYellow;
      quoteJPY = true;
      symbol1 = _Symbol;
      quoteJPY1 = true;
      symbol2 = "EURUSD";
      symbol3 = "EURJPY"; // was USDJPY
      quoteJPY3 = true;
     }

 then inverting the index3 value :

 

      case INDICATOR_DEMARK:
            index1 = iDeMarker(symbol1,TimeFrame,DeMarkerPeriod,shift)-.5;
            index2 = iDeMarker(symbol2,TimeFrame,DeMarkerPeriod,shift)-.5;
            index3 = iDeMarker(symbol3,TimeFrame,DeMarkerPeriod,shift)-.5;
        }
//--- Add this code
      if (_Symbol==USDJPY)
        index3=1/index3;
        
      if(quoteUSD)
        {
         baseIndex = (index1+index2)/2;
         index1 *= -1;
         qoteIndex = (index1+index3)/2;          
        }

 

 Maybe correct?

 

Anyway I find your indicator very useful. 

 
Enoch:

I think there is a mistake at OnInit() where you check the USDJPY pair

 

 then inverting the index3 value :

 

 

 Maybe correct?

 

Anyway I find your indicator very useful. 

Hi Enoch,

Thanks for pointing that out! I appreciate it. Only the symbol needs to change though, not the inverting. I've resubmitted with the correction.

 

hi,

I need an indicator to compare(the difference between them at this case) close of candle's value of two instruments in Future markets( e.g. Crude oil and Brent oil). The most important things is the missing candles in one or both charts which led me to wrong calculation. If one chart have minimum one missing candle the process go wrong way and all graph shown the wrong number from the missing candles to the first available candle in history. I believe that the solution is comparing candle's time at first and then go to next step for calculating  the difference for each pair of candles and if there is no matched candle at the same time use the earlier one for calculation. In some case this repeat for tow or more continuous missing candles .

note : Missing candles are occurred regularly in future markets charts because of server's errors or contract start time and so on.Also some low liquidity markets have many missing candles per day and it is very popular.

If any body could help me I'll be appreciated  in advance.

Best Regards,

I'm not native in English and I'm sorry for that.

 
Hello thank you for make this indicator pipPod, pipPod how to use this indicator properly? since i try to install it in my U/J E/J and E/U chart buy it's different from your picture, so i thought i messed up something, but dont know what i do wrong, pls pippod help me to answer this question, thank you



 
carero:
Hello thank you for make this indicator pipPod, pipPod how to use this indicator properly? since i try to install it in my U/J E/J and E/U chart buy it's different from your picture, so i thought i messed up something, but dont know what i do wrong, pls pippod help me to answer this question, thank you



Your symbols have suffixes e.g. USDJPY.ecn .The attached indicator should work.
Files:
Arbitrage.mq4  20 kb
 

it is really very useful indicator I use it with super smooth averages and Regularized  momentum (made by mladen)+ Hawkeye HeatMap and I got extremely outstanding very good results. 

However I wonder if NZDUSD, AUDNZD and XAUUSD pairs can be added.

Any way thanks for that one

 
I'm newbie of Arbitrage
Could you please explain how did I will know we should buy of sell EURUSD from your arbitrage macd?
 

Dear sir

this indicator is very useful, it determines the beginning and end of the move sharply, it give best timing to enter the trades , also direction of the trade, congratulation for finding such good idea, but the indicator is in need for a lot of work, I hope you have the sprite for it .

please keep the hard work , it will be rewarded, thank you for sharing, thank you again.

Reason: