In this video, we want to create an Expert Advisor entry signal for this little Oscillator here. This is the volumes percent range oscillator. So let’s see how we we can create an entry module for our Platin System with MQL4. The Williams Percent Range Indicator is actually an oscillator signal, therefore it will be shown in a separate oscillator window below the candle chart. To create an entry signal for our Platin System we need to create a file called CheckEntry_WPR.mq4 in the same directory as our other files.
Actually you can use this entry signal file also for your own, self coded system or for the RobotTradingSystem. The file has one function called CheckEntry and we use it to calculate the signal for our main module. To do that, we create a string variable called signal but we are not going to assign a value right away, because that will be calculated in the following steps. MQL4 comes with an included function for that calculation and the name of the function is iWPR. It needs a few parameters that we have to pass. The first parameter is for the current symbol on the chart.
The second one is for the currently selected period on that chart. The third parameter is used for the number of candles that we are using to calculate our result. And the last parameter is for a shift value. We don’t need that, so we set it to 0. If you open an empty chart in Metatrader and click on Insert, Indicators, Oscillators and pick the Williams Percent Range oscillator, you will see that the default value for the period is also 14. Please confirm that setting with Okay, right click into the chart and save the template as tester.tpl. Tester.tpl is the template that is used in the strategy tester to actually see the entry signal. But back to the entry signal module.
Now that we have calculated the WPR value, we can check if the value is below -80. If this is the case, we consider that to be a buy signal, so we assign the word buy to our signal. In the other case, if the signal is below -20, that would mean we have a sell signal and then we assign the word sell to our signal. Finally we use the return statement to return the signal to our main module. Please save the file for the entry signal, but you don’t need to compile it. It will be compiled with the main module when you have changed the entry signal there. To do that, please open the main module, and modify the include statement for your entry signal below the import section.
You can outcomment your current module with two slashes. It will then become gray. Please enable the toolbar and click on the compile button to compile the main module and your entry signal at once. You shouldn’t get any errors. If you have errors, please go to our website and check the shop for precompiled source codes. Okay. By now, you should have a working Williams Percent Range indicator entry file that you can use in the Platinum system.
Or you can use it in your own system. If you have any problems, please check out our website. Maybe even the premium course might be interesting for you. For now, I say thank you for listening, and I will see you in the next video.