quantifying gap between two correlated currencies?

 

I want to code an EA for my two-correlated-currency arbitrage strategy that I am developing, I'm calling it my gap strategy. I think you can see what I'm doing from the attached chart.

What I'm trying to wrap my ahead around is how to quantify the gap distance between the two currencies, and the change in that gap - see Entry and Exit on the chart. And then to code for that using MQL4.

It seems some statistical calc method is needed that is not jumping out at me.

Does anyone know how to do that? I'd sure appreciate any help or tips.

 
Take a look at the MACD indicator. Rather than using two moving averages of different lengths, you could draw the difference between the two currencies.
 
dabbler:
Take a look at the MACD indicator. Rather than using two moving averages of different lengths, you could draw the difference between the two currencies.


Please elaborate.

Would I have to write it all from scratch or could I use the iMA functions somehow?

 
ibotscott:


Please elaborate.

Would I have to write it all from scratch or could I use the iMA functions somehow?

Well you would have to try it to see what it looked like. From your chart it looks as if subtracting the two currencies in itself will give an interesting chart. You might then decide to average the difference. You could of course average the currencies first and then subtract them; I'm not sure which would look best.

You might want to consider scaling the currencies according to lotsize. In other words putting say 0.10 lots on one pair and 0.11 lots on the other pair to get a better chart. This is an experimental subject with no exact answer.

The difference between using iMA functions and "writing it all from scratch" is not the issue. The skill level involved in either is the same. You can either figure out how to write indicator code or you can't. Once you get going, indicator code is easier than EA code as there are less activities to perform.

And if you do figure out a good indicator, DO NOT SHARE IT ON A WEBSITE! Shared workable strategies very quickly become unworkable!