All about MQL5 Wizard : create robots without programming. - page 2

 

Good evening.

I've read several times this https://www.metatrader5.com/en/metaeditor/help/mql5_wizard/wizard_ea_generate following the pages about Expert Advisors

But I was not able to understand how to try to tweak the EAs that come along with the application.

To run several tests, I need few EAs to behave in an opposite way, inverting the actions of buying and selling where all the other aspects remain the same.
In other words, how to make the EA ExpertMAPSAR buy when it's supposed to sell, and viceversa, leaving every other conditions that lead to the action intact?

The EA is mostly the ExpertMAPSAR (then, I hope I'll be able to understand how to the same to the others)

Thanks for your attention

Creating a ready-made Expert Advisor - MQL4/MQL5 Wizard - MetaEditor Help
Creating a ready-made Expert Advisor - MQL4/MQL5 Wizard - MetaEditor Help
  • www.metatrader5.com
MQL4/MQL5 Wizard allows creating fully operational EAs based on the standard library supplied together with the trading platform. To do this, select "Expert Advisor (generate)" on the first page of MQL4/MQL5 Wizard. General parameters – EA name. The same name is assigned to an EA file. Here you can also change the path to a destination file...
Files:
 
PinoArla :

Good evening.

I've read several times this https://www.metatrader5.com/en/metaeditor/help/mql5_wizard/wizard_ea_generate following the pages about Expert Advisors

But I was not able to understand how to try to tweak the EAs that come along with the application.

To run several tests, I need few EAs to behave in an opposite way, inverting the actions of buying and selling where all the other aspects remain the same.
In other words, how to make the EA ExpertMAPSAR buy when it's supposed to sell , and viceversa, leaving every other conditions that lead to the action intact?

The EA is mostly the ExpertMAPSAR (then, I hope I'll be able to understand how to the same to the others)

Thanks for your attention

Advisors that come as standard are not related to the MQL5 Wizard.

 

MQL5 Wizard techniques you should know (Part 01): Regression Analysis

MQL5 Wizard techniques you should know (Part 01): Regression Analysis

MQL5 Wizard allows the rapid construction and deployment of expert advisors by having most of the menial aspects of trading pre-coded in the MQL5 library. This allows traders to focus on their custom aspects of their trading such as special entry and exit conditions. Included in the library are some entry and exit signal classes like signals of 'Accelerator Oscillator' indicator, or signals of 'Adaptive Moving Average' indicator and many others. Besides being based on lagging indicators for most traders they may not be convertible to successful strategies. This is why the ability to create your own custom signal is essential. For this article we will explore how this can be done with regression analysis.

MQL5 Wizard techniques you should know (Part 01): Regression Analysis
MQL5 Wizard techniques you should know (Part 01): Regression Analysis
  • www.mql5.com
Todays trader is a philomath who is almost always (either consciously or not...) looking up new ideas, trying them out, choosing to modify them or discard them; an exploratory process that should cost a fair amount of diligence. This clearly places a premium on the trader's time and the need to avoid mistakes. These series of articles will proposition that the MQL5 wizard should be a mainstay for traders. Why? Because not only does the trader save time by assembling his new ideas with the MQL5 wizard, and greatly reduce mistakes from duplicate coding; he is ultimately set-up to channel his energy on the few critical areas of his trading philosophy.
 
MQL5 Wizard techniques you should know (Part 02): Kohonen Maps

MQL5 Wizard techniques you should know (Part 02): Kohonen Maps

Continuing with this series on the MQL5 wizard, we will delve into Kohonen-Maps for this one.

MQL5 Wizard techniques you should know (Part 02): Kohonen Maps
MQL5 Wizard techniques you should know (Part 02): Kohonen Maps
  • www.mql5.com
Todays trader is a philomath who is almost always (either consciously or not...) looking up new ideas, trying them out, choosing to modify them or discard them; an exploratory process that should cost a fair amount of diligence. This clearly places a premium on the trader's time and the need to avoid mistakes. These series of articles will proposition that the MQL5 Wizard should be a mainstay for traders. Why? Because not only does the trader save time by assembling his new ideas with the MQL5 Wizard, and greatly reduce mistakes from duplicate coding; he is ultimately set-up to channel his energy on the few critical areas of his trading philosophy.
 
MQL5 Wizard techniques you should know (Part 03): Shannon's Entropy

MQL5 Wizard techniques you should know (Part 03): Shannon's Entropy

Claude Shannon in 1948 introduced his paper “A mathematical theory of communication” that had the novel ideal of information entropy. Entropy is a concept from physics. It is a measure of the extent to which particles within an object are active. If we consider the 3 states of water namely ice, liquid and vapor for example; we can see that the particle kinetic energy is highest in vapor and least in ice. This same concept is applied in mathematics via probability.

Let’s see how this can be coded as an expert signal for the MQL5 wizard.

MQL5 Wizard techniques you should know (Part 03): Shannon's Entropy
MQL5 Wizard techniques you should know (Part 03): Shannon's Entropy
  • www.mql5.com
Todays trader is a philomath who is almost always looking up new ideas, trying them out, choosing to modify them or discard them; an exploratory process that should cost a fair amount of diligence. These series of articles will proposition that the MQL5 wizard should be a mainstay for traders.
 

MQL5 Wizard techniques you should know (Part 04): Linear Discriminant Analysis 

 Linear discriminant analysis (LDA) is a very common dimensionality reduction technique for classification problems. Like kohonen maps in prior article if you have high-dimensional data (i.e. with a large number of attributes or variables) from which you wish to classify observations, LDA will help you transform your data so as to make the classes as distinct as possible. LDA is very much like the techniques PCA, QDA, & ANOVA; and the fact that they are all usually abbreviated is not very helpful. This article isn’t going to introduce or explain these various techniques, but simply highlight their differences.

Linear discriminant analysis (LDA) is a very common dimensionality reduction technique for classification problems. Like kohonen maps in prior article if you have high-dimensional data (i.e. with a large number of attributes or variables) from which you wish to classify observations, LDA will help you transform your data so as to make the classes as distinct as possible.

LDA is very much like the techniques PCA, QDA, & ANOVA; and the fact that they are all usually abbreviated is not very helpful. This article isn’t going to introduce or explain these various techniques, but simply highlight their differences.
MQL5 Wizard techniques you should know (Part 04): Linear Discriminant Analysis
MQL5 Wizard techniques you should know (Part 04): Linear Discriminant Analysis
  • www.mql5.com
Todays trader is a philomath who is almost always looking up new ideas, trying them out, choosing to modify them or discard them; an exploratory process that should cost a fair amount of diligence. These series of articles will proposition that the MQL5 wizard should be a mainstay for traders in this effort.
 

MQL5 Wizard techniques you should know (Part 05): Markov Chains



MQL5 Wizard techniques you should know (Part 05): Markov Chains

Markov chains are a mathematical tool that can be used to model the behavior of financial markets. They are particularly useful because they allow traders to analyze the probability of future market states based on the current state of the market.
One of the key benefits of using Markov chains in financial markets is that they allow traders to analyze and predict the evolution of market trends over time.
Another benefit of Markov chains is that they can be used to analyze the risk associated with different trades.
MQL5 Wizard techniques you should know (Part 05): Markov Chains
MQL5 Wizard techniques you should know (Part 05): Markov Chains
  • www.mql5.com
Markov chains are a powerful mathematical tool that can be used to model and forecast time series data in various fields, including finance. In financial time series modelling and forecasting, Markov chains are often used to model the evolution of financial assets over time, such as stock prices or exchange rates. One of the main advantages of Markov chain models is their simplicity and ease of use.
 

Having spent several hundred hours at this point working with wizard EAs and backtesting, let me share a few tips you may find useful:

  1. Markets change. It's extraordinarily difficult to find strategies that truly work under all market conditions, and even then, it's not going to work on all symbols and timeframes. The exact same problems you're talking about happen with expensive premium EAs too — they just get pulled off the market, so you don't see the bad reviews. This is the nature of algo trading, not specific to the Wizard EAs.
  2. You have to have some kind of filter for market regime. You can run every indicator in the wizard, optimize it til you're blue in the face, and if they're all running on the current timeframe, you're never going to be able to create a Wizard EA on any timeframe shorter than Daily that will run long-term without re-optimization, and that will consistently work on out-of-sample data. If you want to run on shorter timeframes, plan on re-optimizing it probably weekly. To get a decent sense of current market conditions, optimize it on the past 3-4 months. Alternatively, try adding in a filter or two, e.g., an MA and RSI or CCI, on a higher timeframe — daily, weekly, even monthly — to help act as a regime filter. If you do that, though, you'll need to run your optimization over a much longer period, e.g., 3+ years, in order to get it to pick on that higher timeframe in various market regimes. To get really advanced with it, it's not that hard to modify the code to make the timeframe for each indicator an input, so it can be optimized. This significantly helps with finding more robust strategies.
  3. Don't include the inputs for tuning the individual indicators in your early genetic optimizations. That pretty much always leads to overtuning. Also, don't include stop loss / TP - that will lead to strategies that are dependent on those to be profitable, which means they're tuned to the specific trades, not the general market trend. Now, I have my timeframes for each signal as a user input, but I start off optimizing ONLY timeframes and signal thresholds. If that doesn't produce at least halfway decent results, I don't continue. Once you have that, then you can try tuning the individual inputs... a little. And then, finally, you can tune the weights and add a stop loss. This process helps prevent overfitting and gives you much higher probability of at least not totally failing in out-of-sample data.
  4. Don't optimize for Max Profit. Max profit produces unpredictable, anomalous results. That's literally the worst of the optimization options. If you're running a wide genetic optimization, use Complex Criterion — that will balance the various metrics, but also consider # of trades. Use that to narrow your value ranges down, and then on subsequent passes, optimize for Recovery Factor — that will give you more stable results. The real metric you want to optimize for, though, is LR Correlation — basically, how straight is the line. You want LRC values of 0.95+, preferably 0.98-0.99. It's being calculated in the optimizations, it just only shows in the individual backtest. It can pretty easily be added to the EA, though, as a custom optimization criteria (I have it in all my EAs). Then you can optimize on that.
  5. Use the forward testing function. This will save you much time in finding more robust strategies. I typically run 4 months total for "fresh" strategies, with 1 month forward. For longer-term stability I do either 15 months (1 year + 3 months forward) or like 3.5 years (like 3 calendar years + YTD forward). Export your results into Excel, add a couple of columns for the average of the backtest value and the forward test value, and the difference between them. Use filters to narrow down to either the setting that has the best balance of past and recent performance, or perhaps the one that has the best recent performance, without being totally broken historically.
  6. Did you try using the intraday time filter? Look at the results of your single backtest and look at profitability by day and by hours of the day. Filter those out. There are some other ways you can code day and time filters that make it possible to let the optimizer figure out the best options, but I'm just saying, you can use what's available in the wizard to improve results significantly. I've seen instances of nearly doubling the Recovery Factor just with time/day filtering.
  7. As a general design principle, you probably want 2-3 indicators that are telling you different things, e.g., trend, oscillator, volatility, volume, etc., and 1-2 on higher timeframes as a regime filter.
Hope that helps.
R-squared as an estimation of quality of the strategy balance curve
R-squared as an estimation of quality of the strategy balance curve
  • www.mql5.com
This article describes the construction of the custom optimization criterion R-squared. This criterion can be used to estimate the quality of a strategy's balance curve and to select the most smoothly growing and stable strategies. The work discusses the principles of its construction and statistical methods used in estimation of properties and quality of this metric.
 

Universal Signals & Universal Trailing Modules - expert for MetaTrader 5

Universal Signals & Universal Trailing Modules

MetaTrader 5 provides MQL Wizard for generating expert advisers based on trading, trailing and money management modules from standard library. The library affords a limited number of predefined signals untilizing some of the built-in indicators. This project allows you to generate EAs on arbitrary signals powered not only by standard, but also custom indicators and expressions.

Indicators and signals setup is based on the article:

- [1] Naive Bayes classifier for signals of a set of indicators.
Universal Signals & Universal Trailing Modules
Universal Signals & Universal Trailing Modules
  • www.mql5.com
This is a module for MQL5 Wizard and Standard Library, which allows you to generate expert adviser based on arbitrary set of indicators and conditions.
 

I made this 5-minute scalper EA with the EA wizard. It trades based on the intersection of two exp moving averages and with a psar trailing stop loss.

Test ran from a Tuesday - Thursday:


note this is a 3-day back test with a large equity gain seen after three days and no drawdown. It is not using one of the default signals, it's using a custom signal script (see attached called "ma_cross.mqh"). It's based on overriding the LongCondition and ShortCondition functions of the cExpertSignal class.


Before running the EA wizard, you have to place the "ma_cross" script at MQL5 data directory/Include/Expert/Signal


then you will be able to import "Signals of the intersection of two MAs"


but the inputs are crucial, and the bot shouldn't be run always.

I used these inputs in the strategy tester for the 5 minute timeframe:



"ma_cross.mqh" taken from the article "Create a trading robot in 6 steps!", although modified as they mixed up the long conditon and short condition code in the functions

Files:
ma_cross.mqh  12 kb