I would find a free REST api (like twitter or something) and then set a timer in the primary to POST the timestamp (heartbeat) every minute or so. Then, on the backup EA I'd GET the most recent timestamp and if the delta is greater than the allowable downtime then it assume the primary role and send an email alerting you of the potential outage.
Nicholi, thanks for your response. I taught myself MQL4 to develop the EA and run within the MT4 terminal but my coding knowledge outside of that is limited. I have been doing some reading but am still unclear on how it works.
1) Would you mind elaborating more on how to use a REST API with the MT4 terminal or send me a link to learn more about it.
2) Do I need to use WebRequest() function?
3) Is it also possible to send/receive information such as up to approx. 30 variables to enable the second EA to start from the same position as the first EA?
4) Also, can the data transfer be achieved on every tick so the second EA starts with the most accurate data?
1) Would you mind elaborating more on how to use a REST API with the MT4 terminal or send me a link to learn more about it.
2) Do I need to use WebRequest() function?
3) Is it also possible to send/receive information such as up to approx. 30 variables to enable the second EA to start from the same position as the first EA?
Yes, you would need to serialize your message to JSON before posting/after getting over WebRequest.
4) Also, can the data transfer be achieved on every tick so the second EA starts with the most accurate data?
This is a tough one since almost all REST api have strict limits on number of calls for minute. You could create a simple micro-service (with python for example) and deploy it as an AWS lambda function and pair it with the aws api gateway. ...OR... you'd need to figure out how to directly connect the terminals via encrypted websockets ...OR... create a VPN between endpoints and use regular sockets.
Yes, you would need to serialize your message to JSON before posting/after getting over WebRequest.
This is a tough one since almost all REST api have strict limits on number of calls for minute. You could create a simple micro-service (with python for example) and deploy it as an AWS lambda function and pair it with the aws api gateway. ...OR... you'd need to figure out how to directly connect the terminals via encrypted websockets ...OR... create a VPN between endpoints and use regular sockets.
Yes so you can make a file and write the time to it, like every second or so called heartbeat.
Then you server this file over a small webserver for example HFS.
The receiving Terminal reads the file and compares the time.
When there is a problem with the Master transmitting Terminal the file with the time won't get updated.
This will be noticed by the receiver and you can set it to any time out length.
For example ten seconds, if the difference in receiver time and file time is larger then ten seconds, raise an alert or take over trading.
This mechanism is called watchdog timer.
If OP doesn't want to go the simple API route then I'd suggest instead of complicating matters with files and servers and fun networking hacks to simply use the platform itself as a watchdog timer. EA#1 sets/modifies a limit order with a unique magic id, at a designated interval, at minimum volume, and so far off market prices it will never get filled. EA#2 checks the order conditions against its set of rules.
It's not complicated.
Drag & Drop
It's not complicated.
Drag & Drop
Are you suggesting that OP should expose a port on his private network to run this unencrypted file-server? No offence, but it seems both complicated and wildly insecure, but what do I know...
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi All. I'm trying to setup a backup redundancy for when my EA stops functioning on my PC. I want to do this by having a second PC in a different location with an EA running and monitoring the primary EA in the first location. The secondary EA will then kick-in when the primary EA stops transmitting a signal. To do this I need the client terminals on both PCs to be able to transmit data between them so the EAs know which EA is in command and the current status of the trade strategy. I have done some research and read through the forums but have not been able to find a solution to this. Note, I have tried VPS solutions but also found these to be unreliable. Your help is much appreciated.