Data exchange between two MT4 terminals?

 

Hello!


I want to implement the following strategy: "Forks on the difference in quotes from different brokerage companies:

The strategy is very simple, is that you can put the opposite rates on the same tool in two brokerage companies and wait for the quotes divergence in the right direction, then you can close both bets and make a profit in total (the value of the discrepancy quotes must be greater than the total commission of the two brokerage companies).


This strategy is not new for a long time, but I have not seen it yet. I want to use it.


The main problem is the necessity to know at any time the quotes value for both brokerage companies simultaneously, and the Expert Advisor works with only one terminal (one brokerage company).

I.e. in each of MT4 terminals an Expert Advisor is running and this Expert Advisor knows only its quotes and quotes of its neighbour, and we do not know its quotes!

We have to make both EAs know each other's quotes, i.e. they can exchange data with each other.


I want them to share what they know about it. I also want to get some feedbacks.


I came up with 2 ways to exchange data:


1) the most trivial: writing data to a file and reading this file by another Expert Advisor. Basically, it is very easy to do. The only problem is that the Expert Advisor can only read and write files from "its directory". But everything can be solved with dll.

There is another good disadvantage: low exchange speed. Can't compare with speed of writing and reading from memory(((.


2) I'm not sure what you can do (since I'm not a very good programmer), but, here, I would like to learn from programmers such:

Allocate a place in memory and write quotes there, the address to this place is known to both EAs, so they can both read and write to this place.

Of course, this entire technology is implemented through a dll.

3) I have also found GlobalAddAtom, but how to write a dll with it?


If anyone is interested in the strategy and also wants to implement it, then please contact me, I will gladly share my work!

 
A sad ending to such a strategy could happen http://www.kroufr.ru/forum/index.php/topic,6265.0.html
 
And how do you envisage this kind of work through a DLL?
 
geopoint:
A sad ending to such a strategy could happen http://www.kroufr.ru/forum/index.php/topic,6265.0.html
I don't really get it, do I? It's probably about the fact that the DC can just fuck off if he finds out, isn't it?
 
D500_Rised:
And how do you imagine this kind of work through DLL?

I don't think the standard means of MQL4 will be able to make the exchange. But if you know how to do it, please share!

And through dll, you could, for example, connect a function that could read files from any directory, not just from one!

 

dlls from each terminal will still refer to the same common file. It seems to me that this will cause a number of bugs resulting in an unstable operation of such a scheme. IMHO.

Have you looked at multiterminal? Is it possible to connect to different servers at the same time?

A thought occurred to me: if multiterminal has the ability to work with several accounts, then it probably can work with the real and demo servers simultaneously. What if we replace the demo server address with the real server address of another brokerage company?

 
D500_Rised:

dlls from each terminal will still refer to the same common file. It seems to me that this will cause a number of bugs resulting in an unstable operation of such a scheme. IMHO.

Have you looked at multiterminal? Is it possible to connect to different servers at the same time?

A thought occurred to me: if multiterminal has the ability to handle more than one account, then perhaps it is possible to work with the real and demo servers simultaneously. What if we replace the demo server address with the real server address of another brokerage company?

No errors, because I already made this way through the file. The files are 2, i.e. each EA has its own file in which it saves the quotes and the EAs read each other's files. The main thing is to make correct reading and writing (the Expert Advisor reads the same file all the time and writes to the same file all the time). I agree that the stability will be worse than referring to memory.


The Multiterminal does not have such an option, and even if it did, you cannot run EAs there. Do you want to implement such a scheme manually? (I don't)

 
D500_Rised:

Have you looked at the multiterminal? Is it possible to connect to different servers at the same time?


no
 

I'm questioning whether it's possible to time-order write_1---read_2, write_2---read_1.

How is the process ordered so that EAs don't meet on the same file, can they distinguish previously read data from new data(requires additional time identification)

And in general, is the game worth the effort? If there is going to be a difference in quotes, there are several things against this game at once:

1- 2 spreads (2*2-4 pips)

2- Slippage.

3- Low real speed of execution of orders(during the processing of the dealer's order, the price may change and negate the positive difference) + requotes

etc.

 
D500_Rised:

I'm questioning whether it's possible to time-order write_1---read_2, write_2---read_1.

How is the process ordered so that EAs don't meet on the same file, can they distinguish previously read data from new data(requires additional time identification)

And in general, is the game worth the effort? If there is going to be a difference in quotes, there are several things against this game at once:

1- 2 spreads (2*2-4 pips)

2- Slippage.

3- Low real speed of execution of orders (during the processing of the dealer's order, the price may change and negate the positive difference) + requotes

etc.

This is not a problem as one EA is writing all the time to a file and the other EA is reading all the time from this file and it doesn't matter in what order it happens. To check data relevance I used local time, ie quotes are written every 100 milliseconds and then checked for relevance by local time.


About "candlesticks": I don't know the exact answer, that's why I want to check it. I am more convinced by quantitative data. If the total spread is 4 pips and the divergence is 10 pips, then even in bad conditions we may get at least a half of 6 profitable pips, what do you think?

 
D500_Rised:

I question the possibility of a timed correct order of write_1---read_2, write_2---read_1.

Maybe you can suggest your own method, because we are discussing only one way: through file, but there are more advanced ones: through memory, can you say something about them?