In this video we are going to create an entry module for this little indicator here. It is called the adaptive moving average and you can use this entry signal to get buy and sell signals for the Platin system. So let’s find out how to do that. To change the entry signal for your Platin system, please open the main file and search for this part where it says include. Here we have check entry modules and if I want to change the module for the entry signal, I just need to outcomment the old one, like this, and enable the new one which is the Check Entry Advanced Ma module.
Here is what’s inside of the Check Entry CCI module that comes with the system. Now I can say that I want to save it as… And save it as Checkentry Advanced MA.mq5 in the same folder as the Checkentry CCI module is located. I have done that before, so I don’t want to do it right now. And here is what is inside of the module. By the way, you can create your own system and use it in your system – or in the robot trading system it’s also possible to use this entry. We start by using MQL rates to create a price info array. Afterwards we use array set as series for the price array we just created to sort it from the current candle downwards. Now we want to fill our array by using copy rates for the current symbol on the chart and the currently selected period on that chart. Starting from candle zero for 30 candles. That’s probably a little bit too much.
So let’s say we do it for three candles. And I would like to use the more current notation here. The next step is to create a string variable for the signal. And we also need to create a second array for the prices. Now comes the interesting part. We create an adaptive moving average definition by using the IAMA function that comes with MQL5. For the current symbol on the chart and the currently selected period on that chart. Here we have three parameters. And if you point your mouse on the adaptive moving average signal line here, you will see the parameters 9,2 and 500.
And if you click on insert, indicators, trend, adaptive moving average, you will see that these are the standard parameters. The period is nine, the fast EMA is two. The slow EMA is 30. So let’s change that to 30 here, because when we cut the last part and hit the comma key on the keyboard, we will see that this parameter here is for the slow EMA period. And that’s actually 30. But you can use whatever you like. I prefer to go with the standard parameters.
Now let’s continue. By using array set as series we are going to sort our price array from the current candle downwards. And now we can use copy buffer for the adaptive moving average definition that we have created here to fill our array for the first buffer. That’s the indicator line. Starting from candle zero for three candles and store the result in our price array. And now we can calculate the current adaptive moving average value by using normalize double and six digits, because the value is shown with six digits behind the dot. And we want to look at the value for candle zero in our price array and assign the result to this variable here.
That makes it possible to now calculate if we have a buy or a sell signal. Because if the adaptive moving average value is bigger than the close price for candle zero in our price info array, that would mean we have a buy signal. And that’s when we assign buy to our signal. Otherwise, if the adaptive moving average value is below the close price for candle zero in our price info array, that’s a sell signal. And that’s when we assign the word sell to our signal. Finally, we want to return the signal to our main module. Now please save the module that we have created, enable it here in the main module. And now we need to recompile that.
So please click on Compile in the toolbar or press F7. That should work without any errors here. And if that is the case you can click the little button here or press F4 to go back to the Platin System. If you don’t see the Strategy tester panel here, you can click on View, Strategy Tester. Or press Control and R. In this case, I’m going to pick the free Platin Demo System which will only work with original MetaQuotes demo accounts.
We will trade the Euro US dollar on the one hour chart, let’s say for the whole year 2021. Now I click on Inputs and set all parameters to the default values here. You can mark the visible mode and click on Start. And now you should see this little red line here. It produces buy and sell signals which are filtered by the long term trend here.
But you can see that the system is working. Now let’s close that part. Disable the visible mode here, click on Start and on the graph tab you should see that the system is producing results. Here we have a drawdown. And it looks like we could get a second one here. But now it recovered. And this is the result with the standard settings. You can click on Backtest to see all the details. So in this case it worked. It’s probably not the best choice for the Platin system. I prefer the Commodity Channel Index. But you can check out yourself. A free demo version is available, because I only sell the system to long term customers who have what it takes.
But in this little video you have learned how to code the adaptive moving average entry. And you have coded it yourself with a few lines of MQL5 code.