We do not have time to learn something new, and this is a normal attitude of a normal human being.
What is a forex trading system?
Traders are people just like everyone else, they want to get maximum results for the minimum of effort. There are several articles describing how to create an automated trading system using the wizard, including a "light version" MQL5 Wizard for Dummies and a "version from developers " - MQL5 Wizard: New Version. It all seems good - a trading robot is created in 5 mouse clicks, you can test it in the Strategy Tester and optimize the parameters of a trading system, you can let the resulting robot trade on your account without the need to do anything else manually.
CExpert is the class for creating a trading robot; this is the class that trades. CExpertSignal is a class for creating a module of trading signals; the article is about this class. CExpertTrailing is a class for trailing a protecting Stop Loss. CExpertMoney is the money management class. Here is the whole force of the "great and terrible" approach that is called Object-oriented programming OOP. But don't be afraid, now almost everyone has a cell phone with lots of function, and almost no one knows how it works.
We do not need to study all this, we will only discuss some functions of the CExpertSignal class. In this article we will go through the stages of creating a module of trading signalsand you will see how to do this without having to learn OOP or the classes. But if you want, you can go a little further then.
Creating a Class from Scratch We will not alter any existing module of trading signals to our needs, because it's the way to get confused. Right-click on the folder we have created, select "New File" and create a new class for our module of trading signals.
- Photo by M.
- 5 Steps to Building an Automated FX Trading System | IG EN
- How to make good money on the Internet for a beginner
Fill in the fields: Class Name - the name of the class. Base Name is the class from which our class is derived. And we should derive it from the base class CExpertSignal. Click "Finish" and a draft of our module us ready. It's all east so far. We only need to add the include declaration to the resulting file so that the compiler knows where to find the base class CExpertSignal include ".
There are no errors and we can move on. We reach the step of selecting a module of trading signals and see Make money online templates how can it be there?
We do not add any indications for the MQL5 Wizard to understand that our class could be something useful. Let's fix this. If you look at the modules of the standard package, you'll see that each of them contains a header at the beginning of the file. This is the handle of the module compiled according to certain rules.
And the rules are very simple. Open, for example, the source code of the module of AMA based trading signals see the logic description in Signals of the Adaptive Moving Average. And run the MQL5 Wizard choosing this module.
Compare: The last block in the handle refers to the module parameters, the first line contains the name of the module to be displayed in the MQL5 Wizard.
Reality of Forex Robot - Forex auto Robot software real or fake
As you can see, there is nothing complicated. Type - the version of the module of signals. It must always be SignalAdvanced. Name - the name of the module after its is selected in the MQL5 Wizard and is used in comments for describing internal parameters of the generated Expert Advisor preferably specified. Class - the name of the, which is contained in the module. Page - a parameter to get Help for this module only for modules from the standard delivery.
The parameter type can be enumeration.
How to create an automated forex trading system How to create an automated forex trading system An automated forex trading system executes trades on your behalf using the exact parameters that you have set. Learn how to create, backtest and run an automated forex trading system for platforms, including MT4 and ProRealTime. A forex trading system is essentially a set of rules used to execute trades on one or more currency pairs. While these systems can be implemented manually, many traders use automated systems — based on computer code — to take emotion out of the equation and execute trades more efficiently.
The default value for the parameter, i. Now, knowing all this, let's create the handle of our trading robots how to make of trading signals. So, we are writing a module for getting trading signals at the intersection of two moving averages. We need to set at least four external parameters: FastPeriod - the period of the fast moving average FastMethod - the type of smoothing of the fast moving average SlowPeriod - the period of the slow moving average SlowMethod - the type of smoothing of the slow moving average You could also add a shift and the type of prices to calculate each of the moving averages, but it does not change anything fundamentally.
Four external parameter to configure the trading signals. FastPeriod - the period of the fast moving average with the default value of FastMethod - the type of smoothing of the fast moving average, simple smoothing by default. SlowPeriod - the period of the slow moving average with the default value of SlowMethod - the type of smoothing of the slow moving average, simple smoothing by default.
Save the changes and compile. There should not be any errors. Run the MQL5 Wizard to check. You see, our module is now available for selection, and it shows all of our parameters! Congratulations, our module of trading signal looks great now! Methods for Setting Parameters Now it is time to work with the external parameters.
Let's add four lines equal to the number of parameters to the class declaration. So here is a simple rule: The rule of parameter creation in the module - for each parameter that we have declared in the handle, we should create a private member in the class for storing its value and a public member for setting a value autoden internet earnings it.
The method name must match the name of the parameter. Each declared variable or class member must be initialized. This technique allows to avoid trading robots how to make of hard-to-find errors. For automatic initialization, the best suiting one is the class constructor; it is always the first one to be called when creating an object.
For default values, we will use those written in the module handle. As you can see, we haven't used moving average indicators yet. We found a simple rule - as many parameters are stated in the handle of the module, so many methods and members should be in the class that implements the module.
There is nothing complicated! However, don't forget to set default values of parameters on the constructor.
In our case, we must check the periods of moving averages and the type of smoothing for their calculation. For this purpose you should write your own ValidationSettings method in the class. This method is defined in the parent class CExpertBaseand in all its children it is obligatorily redefined. But if you do not know anything about object-oriented programming, just remember - in our class we should write the ValidationSettings function, which requires no parameters and returns true or false.
Do not forget that the name and type of parameters must match in the declaration and description of the class method. However, the compiler will warn you of such an error.
Note that first the base class method is called, and then input parameters are checked.
Where Are Our Indicators? It's time to work with the indicators, since all the preparatory work with the parameters for them have been completed. Each module of trading signals contains the InitIndicators method, which is automatically called when you run the generated Expert Advisor.
In this method, we must provide indicators of moving averages for our module. Above all, do not forget to insert the class name and the operator :: in the function definition. We have a draft, which we can insert into a code to create moving averages. Let's do this properly - for each indicator we create a separate function in the class, which returns true if successful. That trading robots how to make why a pointer to a variable of type CIndicators is passed as a parameter.
The following is written in Documentation about it: The CIndicators is a class for collecting instances of timeseries and technical indicators classes. The CIndicators class provides creation of instanced of technical indicator classes, their storage and management data synchronization, handle and memory management. This means that we must create our indicators and place them in this collection. Since only indicators of the CIndicator form and its children can be stored in the collection, we should use this fact.
We will use CiCustomwhich is the above mentioned child.
Coding Your Own Algo-Trading Robot
But in this case we want to show how you can use any custom indicator in the module of trading signals using CiCustom. Then declare the MqlParam structure, which is especially designed for storing parameters of custom indicators, and fill it with values.
Since Custom Trading robots how to make Average. And the last one is specifying the number of indicator buffers using the NumBuffers method. The CreateSlowMA method for creating the slow moving average is simple.
When using custom indicators in the module, do not forget that the Expert Advisor generated by the MQL5 Wizard will also run in the tester. So, we have added the indicators.