Building an EA for all as tutorial
36 replies
Conmariin
7 years ago #116417
Hello,
I’m not a programmer and I thought buying the EA Wizard would be much easier to build an EA with. But after some building practice I see you need to be a mql-Programmer to understand even EA Wizard.
So I come up with a question to you: Is it possible to build in this forum at least one EA step-by-step for better understanding for all non-programmers the EA Wizard?
I have already a strategy which is discribed here: https://www.mql5.com/en/articles/1734
In this strategy there are code snippets. Actually I don’t know how to integrate them. But more than this I want to understand and leran how am I building such an EA in EA Wizard. So that I can build other EAs in future.
The code snippets from the article are in the mq4.
Hopefully greetings from
Conmariin 🙂
Automatisches Handeln mit Expert Advisor
https://www.rabenesche.de
Conmariin
6 years ago #197213
There was something missing. Sorry. I corrected it in this version. 🙂
Automatisches Handeln mit Expert Advisor
https://www.rabenesche.de
Conmariin
6 years ago #197239
I have a problem with the condition to buy orders.
I want that the EA is opening an order when following conditions are met:
(GoLongSandR=true and(Pattern1=true or Pattern2=true or Pattern3=true)
But it is opening orders when any of theses Patterns are met. It opens when GoLongSandR=true. It opens when Pattern1=true and Pattern3=true (but not GoLongSandR). It opens when only Pattern2=true…etc. For example sometimes it opens correct with GoLongSandR=true and Pattern1=true.
I attached a picture of my conditionssetting in EAWizard for Long. Where is the error? Can anyone help?
This is the code from the EA:
//--------------------------------------
// Open Long
if(sqIsBarOpen == true) {
if (((sqGetMarketPosition() == 0)
&& ((GoLongSandR == true)
&& ((Pattern1Long == true)
|| ((Pattern2Long == true)
|| (Pattern3Long == true))))))
{
// Action #1
sqOpenOrder("NULL", OP_BUY, getOrderSize(MagicLong, OP_BUY ), getOrderPrice(MagicLong), Comment1, MagicLong, "Open Long");
// Action #2
sqDrawUpArrow(1);
}
}
//--------------------------------------
// Open Short
if(sqIsBarOpen == true) {
if (((sqGetMarketPosition() == 0)
&& ((GoShortSandR == true)
&& ((Pattern1Short == true)
|| ((Pattern2Short == true)
|| (Pattern3Short == true))))))
{
// Action #1
sqOpenOrder("NULL", OP_SELL, getOrderSize(MagicShort, OP_SELL ), getOrderPrice(MagicShort), Comment2, MagicShort, "Open Short");
// Action #2
sqDrawDownArrow(1);
}
}
Automatisches Handeln mit Expert Advisor
https://www.rabenesche.de
tomas262
6 years ago #197256
Hello,
I see in the original file attached you omitted parentheses but on the screenshot you provided they are present (correctly). Attached modified file
tomas262
6 years ago #197258
One problem could be you set “pattern” to TRUE but you never set it back to FALSE so the condition will remain always valid.
I think you should set pattern = FALSE with order entry
Conmariin
6 years ago #197259
Yes I added the parentheses when I searched the error for this behaviour. And I thought it might be with something is not resettet. But I was unsure. Okay you had the same thought. Now I’m trying to find out how to set the pattern after order entry. Thank you Tomas262! 🙂
Automatisches Handeln mit Expert Advisor
https://www.rabenesche.de
Conmariin
6 years ago #197277
Hi,
unfortunately I didn’t find out how I can solve this in EAWizard, but I took the code and solved there manually. It was just a 1 Liner in every Pattern condition to set pattern = FALSE. Now it works 🙂
Automatisches Handeln mit Expert Advisor
https://www.rabenesche.de