I think there are many people who use EA in MT4 to automate transactions.
However, in the event of a disaster or sudden Lehman shock, you may want to stop automatic trading in a hurry, or you may want to change the EA settings while you are away from home.
so, this page, we would like to introduce to such a person how to control the EA even when there is no PC on the go.
Contents
1. How to control the EA remotely
Here, we would like to introduce two ways to control the EA remotely.
- How to use remote desktop
- How to use cloud storage
We think the above two methods are easy to get started by controlling the EA remotely.
On this site, we will mainly explain the second “How to use cloud storage”.
1-1. How to use remote desktop
On this site, we will mainly explain “How to use cloud storage”, but we will also talk a little about “How to use remote desktop” here.
1-1-1. Conditions for using Remote Desktop
To use remote control using Remote Desktop, the following conditions must be met.
- Running EA on a Windows PC
- Remote access to the PC running the EA
(There is an assignment such as global IP) - Own a tablet or smartphone
If the above conditions are met, there is an app called “RD Client” from your Tablet or smartphone, and you can remotely access your PC from that app.
If you have a Windows laptop, you can connect remotely by selecting “Windows”-> “Windows Accessories”-> “Remote Desktop Connection”.
↓↓Click here for the app link↓↓
Android App : RD Client
iOS App : RD Client
You can operate MT4 remotely by accessing the PC running MT4 with the above remote connection app.(Being able to operate MT4 means being able to operate EA settings)
1-1-2. Disadvantages of using Remote Desktop
If you use the remote desktop app, you can operate it with the usual setting interface, so you may think that there is no better way, but there are many people who can use only tablets or smartphones on the go.
When such a person opens the EA setting screen of MT4 using this app, it is very small…
Therefore, We think it is difficult to change settings flexibly.
maybey If you want to make an emergency change, such as in the event of a disaster, you want to change it flexibly.
In such a case, the solution is another “method using cloud storage”.
1-2. How to use cloud storage
Next, we will introduce “How to use cloud storage”.
The conditions for this are as follows.
- Being able to create an EA
- Or you can request the creation of EA
- You are using cloud storage (One Drive, Dropbox, Google Drive, etc.)
- PC running EA does not need to be assigned a global IP etc.
This is the condition.
1-2-1. About EA creation
It may be a little difficult because it includes things that EA can be created, but the method of using cloud storage is the minimum necessary condition because it is necessary to implement the function in EA.
If you can’t create an EA but want to request it but don’t know where to request it, you can request it by using Gogojungle below or the site called Coconala.
Gogojungle :
It is possible to request EA creation from the fact that it is an “investment cloud” in Japanese site.
coconala :
In the search window of the following site, if you search for “ea 作成” etc., a creation agent will appear.
1-2-2. EA specifications
By now, I think that the conditions up to EA creation have been cleared, so next is the specifications.
The next point is how to control the EA by “using cloud storage”.
1-2-2-1. specification
- Set the setting information to the EA, instead of setting on the “parameters” screen of the EA, change the Mode and setting value according to the file contents, and set ON / OFF of automatic trading.
- Create a file in a CSV file format, and separate them with commas to create a format that takes readability into consideration, such as “setting value name”, “setting value”, “setting value name”, and “setting value”.
- Store the file of 2.) in cloud storage.
- Install the cloud storage application used in 3.) on the PC running MT4, the tablet or smartphone that you take with you wherever you go.
- On the PC running MT4, create a symbolic link for the 2.) setting file in the directory synchronized with the cloud storage under “MQL4” → “Files” in the directory where MT4 is installed.
- By setting 5.), the files in the cloud storage are updated, and at the same time, the files under MT4 are also updated.
- On the MT4 side, you can read the setting value by going to read the file 5.) periodically, so you can control the EA setting just by updating the file in the cloud storage.
(If the file is read frequently, it may cause a processing delay in the EA’s transaction logic, so a 1-minute interval may be good.)
1-2-2-2. Detail
For each, I will explain the details of the parts that I think are necessary.
1-2-2-2-1. Configuration file format
I think that the CSV file format is easy to see as the setting file format.
However, in MT4, it seems that the CSV file can only read the first line(?), so you need to describe all the parameters on the first line.
It should be noted here that the file name should be “.txt” instead of “.csv”.This is a cloud storage application, and you may not be able to edit the csv file, so if you save the extension as a text file, there are many ways to deal with it.
example:
EnableEA,0,Lots,1,ParameterX,0.01
// EnableEA: 0:EA OFF, 1:EA ON
// Lots: Num of Lots
// ParamterX : xxxx
The above is just an example, so you can create it as you like when it is implemented.
1-2-2-2-2. Cloud storage
As mentioned above, I think that cloud storage may be One Drive, Dropbox, Google Drive, etc.Please use services that can be operated in common on smartphones, tablets, and PCs running MT4.
Files will be shared if you are logged in with the same account on all devices.
Depending on the OS version, the service may not work, so please use the service that is most suitable for you.
However, depending on the application, you may not be able to edit the text file, so you may install a free application that can edit the text and edit it in cooperation with it.
(I use One Drive and an app called QuickEdit in combination to make it work.)
1-2-2-2-3. Symbolic link settings
this is about how to create a symbolic link to the folder under MT4 from the setting file stored in the cloud storage.
It seems that MT4 can only control files under MT4, so this procedure is necessary.
The folders under MT4 can be opened by starting MT4 and clicking “File”-> “Open Data Folder”.
Create a symbolic link under “MQL4”-> “Files”.
You can create a symbolic link by opening the command line on the PC running MT4 and executing the following command.
mklink XXX\MQL4\Files\setting_file.txt YYY\setting_file.txt
//XXX : Path to MT4 subordinate starting with C: \ etc.
//YYY : Path to cloud storage subordinate starting with C: \ etc.
1-2-2-2-4. Read configuration file
Finally, read the configuration file.
If you can create an EA, you can call this by yourself, but it will happen with the sample code below.
You can load it by calling the loadSettingFile () function below from the process of the timing you want to load.
//gloval variable
bool g_EnableEa = false; // Since the setting value of whether to operate EA is entered here, it is OK if you use it as a condition of whether or not automatic trading is possible
double g_Lots = 0.0;
double g_ParameterX= 0;
void loadSettingFile()
{
int fHandle = 0;
int readCnt = 0;
double tmpData = 0;
fHandle = FileOpen("setting_file.txt", FILE_CSV|FILE_READ, ','); }
if(fHandle >= 1)
{
// Read by comma delimiter
for(readCnt = 0; readCnt < 100; readCnt++)
{
tmpData = 0;
if (FileIsLineEnding(fHandle) == 1) { break; }
tmpData = FileReadNumber(fHandle);
//↓↓Read setting value↓↓(This time, since the data is set to the odd number with 0 origin, only the odd number is read.)
//EnableEA 0:disable, 1:enable
if(readCnt == 1) { g_EnableEa = tmpData; }
//Lots
else if(readCnt == 3) { g_Lots = tmpData; }
//ParameterX
else if(readCnt == 5) { g_ParameterX = tmpData; }
}
FileClose(fHandle);
}
return;
}
2. Finally
That’s all there is to controlling the EA from outside your home without the need for a PC.
Also, as a reference, if you are worried about fire if you always run MT4 at home, I think it is good to rent a VPS and operate it on the network.
You don’t have to worry about ignition, and you can operate it for around 10,000 yen a year, so why not think about it?(I am using VPS with 1GB memory plan, but I am not so dissatisfied if only EA is running)