I have been using an indicator to take trades. I didn't develop the indicator, so I only have access to the .ex4
file. How can I extract the take profit, open trade and stop loss values in the alerts or email signals to open trades? Please see a sample of the email and alert signals below.
相关问题
- Cannot open file on Ubuntu
- simple moving average of “live” stream - fast impl
- ValueError: Length of passed values is 7, index im
- Indicator for current price in Pine Script
- MT4 Trade Panel Lot Step
相关文章
- Converting XGBoost tree structure dump file to MQL
- How to pass argument by reference from MQL4 to C++
- How can I convert Metatrader 4 alert or email indi
- How to read a JSON from a URL in MQL5?
- Troubles with zmq_bind() in ZeroMQ binding for MQL
- How to keep a 10 pip profit gap between stop loss
- What is the equivalent of console.log in pine-scri
- How can I write mql4 code (EA) that marks the list
Here is a working example
script
of a native MQL solution which useskernel32.dll
to copy the log file from./MQL4/Logs
to./MQL4/Files
. TheLogSignalParser
abstract base class needs to be subclassed and requires implementation of thevirtual bool parse()
method.Edit: @TenOutOfTen would like a practical example of how to parse the following row format in a log file:
0 02:20:00.874 SuperIndicator USDCAD,M5: Alert: USDCAD, M5: Super Indicator SELL @ 1.29136, TP 1.28836, SL 1.29286
Step 1: Save the
LogParser.mqh
somewhere meaningful.Step 2: Subclass the
LogSignalParser
class and overrideparse
Step 3: Use in MQL program (example script)
There's no need to pull the data from your email since the indicator is also sending the data via the
Alert
function. Alerts are logged to the.\MQL4\Logs
directory in a*.log
text file. You could write some MQL which useswin32
to read the log, and then make your own parser in MQL.Another option is to write a watchdog script to scan and parse the log file and write the results to a csv where the EA can access it. The benefit of this method is how easy it is to develop compared to an MQL solution and since it works for all symbols it avoids a potential race condition where multiple EAs are trying to read log write csv at the same time.
Here is an example written in Python.
MT4 cannot read your emails. You need to employ some other tools or a more universal language to read your emails, Java.Mail.API or Pyhton, or something else. Read the email, make sure the the format is correct and it is from the sender you are expecting, then put down the message into a file that is available to MT4 - either own folder (C:\Users\UserName\AppData\Roaming\MetaQuotes\Terminal\12345678E7E35342DB4776F5AE09D64B\MQL4\Files) or Common folder (C:\Users\User1\AppData\Roaming\MetaQuotes\Terminal\Common\Files). Then read the file from the MT4 application using
FileSearchNext()
function and example in MQL4 docs. After reading the file, you need to parse it with the String functions, and create a OrderSend() request (probably check the input and that your logic allows your robot to send a trade, e.g. you do not have reached maximum of allowed open trades, trading time, other logic).