Everyone has questions, especially when it comes to programming/MQL5. Don't be ashamed of asking.
Take a look at the documentation. When you create an EA and select the 'Signals of indicator X', for example, you're actually choosing all signals that come from that defined indicator. For the moving average, there're 4 signals: failed breakout, moving average crossover and formed breakout. The 4th signal is that the price is on the correct side of the MA (for long, the price is above the MA). The documentation doesn't actually call this a signal, but a 'no objection to buying'. However, even if no other signal occurs, if this 4th condition happens, it will probably open a long position due to its high significance.
Each of these signals have a significance. Take a look at the CSignalMA code, that is used for the moving average signals:
Now, take a look at their default values:
the int m_pattern_X are the significance of each moving average signal. If your EA detects any of these signals, it returns its significance - otherwise, it always returns 0. If the significance of the combined selected signals is higher than the Signal_ThresholdOpen (input variable defined by the generator), the EA will open a position considering that signal.
Now, from your example, we can see that the pattern you're looking for is the Pattern 2. In this case, however, Pattern 2 needs the price to be crossing above the moving average (close > MA and open < MA) and also the moving average must be going upwards to open long positions (the inverse are the conditions to open short positions). Since we do not care about other signals, we can set their significance to 0 using the functions Pattern_0, Pattern_1 and Pattern_3 from the Pattern_0 CSignalMA class. Also, since we want to always open a position when the Pattern 2 occurs, we can set its significance to 100 using the function Pattern_2 from the CSignalMA class.
Everything is pretty much unchanged, except for these few lines of code added to the OnInit function:
int OnInit() { //--- Initializing expert if(!ExtExpert.Init(Symbol(), Period(), Expert_EveryTick, Expert_MagicNumber)) { //--- failed printf(__FUNCTION__+": error initializing expert"); ExtExpert.Deinit(); return(INIT_FAILED); } //--- Creating signal CExpertSignal *signal=new CExpertSignal; if(signal==NULL) { //--- failed printf(__FUNCTION__+": error creating signal"); ExtExpert.Deinit(); return(INIT_FAILED); } //--- ExtExpert.InitSignal(signal); signal.ThresholdOpen(Signal_ThresholdOpen); signal.ThresholdClose(Signal_ThresholdClose); signal.PriceLevel(Signal_PriceLevel); signal.StopLevel(Signal_StopLevel); signal.TakeLevel(Signal_TakeLevel); signal.Expiration(Signal_Expiration); //--- Creating filter CSignalMA CSignalMA *filter0=new CSignalMA; if(filter0==NULL) { //--- failed printf(__FUNCTION__+": error creating filter0"); ExtExpert.Deinit(); return(INIT_FAILED); } signal.AddFilter(filter0); //--- Set filter parameters filter0.PeriodMA(Signal_MA_PeriodMA); filter0.Shift(Signal_MA_Shift); filter0.Method(Signal_MA_Method); filter0.Applied(Signal_MA_Applied); filter0.Weight(Signal_MA_Weight); filter0.Pattern_0(0); filter0.Pattern_1(0); filter0.Pattern_2(100); filter0.Pattern_3(0); (...)
Some math is done behind the scenes to determine the significance of multiple signals (i.e., if you add the signals of a moving average and the signals of a stochastic oscillator). I don't know much about it, though, as I've never study much about these classes.
It may be quite interesting to use an EA generated by this tool, but be aware that it doesn't fully remove the user responsability for coding (i.e, you still need to add some time checking and evaluate if you wanna trade in that period or not; hours close to the end of the day may have a lower trading volume and thus a higher spread. If you trade at this time, you need to know what you're doing and not just let a robot trade for you).

- www.mql5.com
Thanks a lot for the detailed answer.
Can I ask where did you pull these pieces of code?
I'm just confused as to what the wizard is actually doing.
From what I'm reading it should be "easy" to build an EA for a simple EMA crossover, but I just don't see how to do it without writing the code myself.
Right click the signal MA class and click "Go to Definition" or simply place the text cursor on the class and press Alt+G and you'll be sent to the file containing that class.
Honestly, I've never worked with it - it's better to create your own template to develop your EAs, so you have more control around the code and more flexibility to change stuff. But I believe you should create a class that inherits from "CExpertSignal" (just like CSignalMA is) and make that class reproduce the signals you want, like a two MA crossing each other. I don't believe this is something you can do with the current available signals.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
Sorry for the very noob question but I was trying to code with the wizard a VERY easy strategy => if price opens below and closes above EMA200 then take a Long.
I'm able to set up the paramters with the wizard, but the only thing I don't see is where to actually tell the wizard/code that the EMA is used as a point of reference for PRICE.
We can optimize and test the EMA lenght, take profit, stop loss etc but how does the optimizer know when to actually take a trade if we don't have anywhere to input that info?
I don't even know what the wizard is testing without that to be honest.
Sorry in advance if that's a stupid question but I've been dong research for hours without luck.
Thanks a lot!