In this video we are going to create an Expert Advisor entry for the PlatIn System. But you can use it in your own system. And there’s also a demo version available for download. This is the the Oscillator that we are going to use. It’s called the Williams Percent Range. So let’s find out how to do that with MQL5.
The Williams percent range indicator is actually an Oscillator therefore it will be shown in a separate window below the candle chart. To use it. We create a separate MQ five file inside of the directory where the other files of the platinum system are located. The name of the file is checkentry WPR MQ five and it contains a single function that is called checkentry. This function calculates the buy and sell signals for our system. We start with a string variable called signal. But we don’t assign a value right away as we are going to calculate that later on in the next step we create an array we use the data type double as this data type can also be used with floating point values. Afterwards we create a definition for WPR signal by using the function IWPR that comes with MQL five. And we want to do that for the current symbol on the chart and the currently selected period on that chart. The last parameter is the number of candles that we want the calculation to be based on. When you open a MetaTrader chart and click on insert indicators oscillators Williams percent range. This is the value that you will also see as a standard value for the period.
But let’s continue with the entry module. Here we array set as series for our WPR array to sort it from the current candle downwards. Afterwards we can fill our WPR according to the definition that we have done above. We do it for buffer zero starting from candle zero for three candles and store the values in our price array that makes it possible to calculate the current WPR value by looking at candle zero in our array with normalized double. We make sure to format the output with two digits behind the dot as this is how the value also looks like when you add the oscillator manually to your chart now let’s continue with the calculation for the signal if the WPR value is below -80 and bigger than -100 we consider that to be a buying signal so we assign the word by to our signal variable in the other case if the WPR value is above -20 and below zero we would consider that to be a cell signal so that is when we want to assign the word cell to our signal. Finally, we return the signal to our main module by using the return function now please save the file.
You don’t need to compile the entry module as it will be compiled automatically when you include it in your main file. Changing an entry signal is easy to do with the Platinum system. Actually, you can also use the entry modules you create in your own system. All you need to do is to use the Include function in your main module. Entry signals are enabled or disabled with two slashes that will outcome at the entry signals that you don’t want to use and they will appear in gray color. To include an entry signal, you can use the Include command for the MQ five entry signal file. It is not required to compile the entry files as they will be compiled with the main module you use to include them. To compile the main file of your trading system and the entry file, just enable the toolbar and click on the compile button. You can also press the f seven key on your keyboard. The compilation process should work without any errors. If you have errors, or if you don’t want to type everything yourself, please visit our website and look for the shop as most of our source code files are available there.
There you will also find the premium course and other useful resources for automated trading.
Okay, so far so good. We have changed our entry signal for the Platin System, and if you don’t know how to start a strategy test, or if all that was too much, you might want to watch one of the other videos. Or maybe even the premium course on our website might be interesting for you. But in this little video, you have learned how to create a WPR entry signal and you have done it with a few lines of MQL5 code.