Download MetaTrader 5

External Trigger for EA

To add comments, please log in or register
What is a social trading? Read the article to find that out!
Marcelo Coutinho
1151
Marcelo Coutinho 2014.05.10 01:29 

Hi there!

Question please ...

If I have 3 instances of MT5 installed on a PC and I need to trigger something on 3 @ same time what is the best option?

I am considering having a MySQL database and on every OnTick(), each EA running on each instance runs a query and check for some parameter. This way, I will have all Instances/ EA changing its behavior simultaneously.

Is MySQL a good option? A regular text file?

Regards

MRC

Rodrigo Malacarne
Moderator
9904
Rodrigo Malacarne 2014.05.10 02:07  
YouTrade:

Hi there!

Question please ...

If I have 3 instances of MT5 installed on a PC and I need to trigger something on 3 @ same time what is the best option?

I am considering having a MySQL database and on every OnTick(), each EA running on each instance runs a query and check for some parameter. This way, I will have all Instances/ EA changing its behavior simultaneously.

Is MySQL a good option? A regular text file?

Regards

MRC

Did you take a look at the File Funtions of MQL5? You can read a single file from 3 different MT5 instances at the same time.
Marcelo Coutinho
1151
Marcelo Coutinho 2014.05.10 02:27  
Malacarne:
Did you take a look at the File Funtions of MQL5? You can read a single file from 3 different MT5 instances at the same time.
I will. I was just wondering from where to start it. If a regular text file is the best approach, we will take it. Thank you !
Rogerio Figurelli
Moderator
39681
Rogerio Figurelli 2014.05.10 14:24  
YouTrade:
I will. I was just wondering from where to start it. If a regular text file is the best approach, we will take it. Thank you !

Hi Marcelo, technically we call this 'mutual dependency', and it depends on what you need to trigger ('the something'), and maybe you don't need any external exchange to do this. 

If you can share who and how 'the something' is, the answer can be more precise, since to use just an internal EA algorithm, if possible, probably is the best option for you. 

Anyway, if not possible share this, and your option is use files to do that, the main point is don't forget flag FILE_COMMON, since your file will be used for all MT5 client terminals. This flag is used in FileOpen(), FileCopy(), FileMove(), and in FileIsExist() functions.

Use of a database to do this looks like 'kill a fly with a cannon shoot', as we are used to say on Brazil, since your intention is just synchronize the EAs. In the last case, if it's really necessary, I would use just HTTP to do this.

Marcelo Coutinho
1151
Marcelo Coutinho 2014.05.10 16:21  
figurelli:

Hi Marcelo, technically we call this 'mutual dependency', and it depends on what you need to trigger ('the something'), and maybe you don't need any external exchange to do this. 

If you can share who and how 'the something' is, the answer can be more precise, since to use just an internal EA algorithm, if possible, probably is the best option for you. 

Anyway, if not possible share this, and your option is use files to do that, the main point is don't forget flag FILE_COMMON, since your file will be used for all MT5 client terminals. This flag is used in FileOpen(), FileCopy(), FileMove(), and in FileIsExist() functions.

Use of a database to do this looks like 'kill a fly with a cannon shoot', as we are used to say on Brazil, since your intention is just synchronize the EAs. In the last case, if it's really necessary, I would use just HTTP to do this.

Hi there ... I am working on the MA inversion and I am planning to use an external trigger to inform all EA that the MA are inverted. ;)
Rodrigo Malacarne
Moderator
9904
Rodrigo Malacarne 2014.05.10 16:24  
YouTrade:
Hi there ... I am working on the MA inversion and I am planning to use an external trigger to inform all EA that the MA are inverted. ;)
From the programming point of view, this is an interesting exercise. However, from the trading point of view, could you explain what would be logic / advantages of the inversion of moving averages? I really don't get the point...
Alain Verleyen
Moderator
30752
Alain Verleyen 2014.05.10 16:55  
YouTrade:
Hi there ... I am working on the MA inversion and I am planning to use an external trigger to inform all EA that the MA are inverted. ;)
Why can't you run this code in the 3 platforms ? I can't see any advantages to run a code in a platform and then have to inform other platform of the results.
Marcelo Coutinho
1151
Marcelo Coutinho 2014.05.10 17:01  
Malacarne:
From the programming point of view, this is an interesting exercise. However, from the trading point of view, could you explain what would be logic / advantages of the inversion of moving averages? I really don't get the point...
my ea is based on two ma. depending on the periods and type, the ma get inverted so when the fast cross slow up the system sells because the position of the ma's are inverted.
Rodrigo Malacarne
Moderator
9904
Rodrigo Malacarne 2014.05.10 17:08  
YouTrade:
my ea is based on two ma. depending on the periods and type, the ma get inverted so when the fast cross slow up the system sells because the position of the ma's are inverted.
I still don't understand. It would be much easier if you could invert the sign (">" instead of "<") inside your code... You don't have to "invert" any moving average to do that...
To add comments, please log in or register