Hello,
We want to create an EA for back-testing purposes only.
We are trying to make a simple code with the following criteria: It should send a buy order when there have been three consecutive bars with ascending closing prices in all three of them, altogether.
The code we have is:
When we back-testing this EA, it doesn't buy anything at all. We don't get any errors as well, and the compilation is successful.
Can you please help us - what are we doing wrong here?
Thanks in advance.
Your approach is completely wrong and outdated as well. Listing and explaining what is wrong would be a very lengthy discussion, so I suggest that you first do some research, by reading the following and looking at example code:
- Read the online Book which is a kind of tutorial and which has some examples of code. However, this is an old tutorial which uses the old style of code, so you should also have a look at the newer style which is explained in the section Updated MQL4 of the documentation.
- Consult the main Documentation for reference, especially the sections Program Running and Client Terminal Events.
- You should also look at example EA code, such as the samples provided by MetaQuotes (such as "MACD Sample.mq4" and "Moving Average.mq4"), but also the many, many examples in the Code Base.
- There are also many Articles that explain particular aspects of developing an EA.
Hello,
We want to create an EA for back-testing purposes only.
We are trying to make a simple code with the following criteria: It should send a buy order when there have been three consecutive bars with ascending closing prices in all three of them, altogether.
The code we have is:
When we back-testing this EA, it doesn't buy anything at all. We don't get any errors as well, and the compilation is successful.
Can you please help us - what are we doing wrong here?
Thanks in advance.