This colorful indicator here below the chart window is called the awesome Oscillator. We want to create an entry signal to calculate the values for our entry signals that are traded here. So let’s find out how we can do that with MQL5.
Since the Awesome indicator is an oscillator, it will be shown in a separate window below the candle chart.
To use it, we make a separate MQ5 file and put it in the same directory as the other Platin System files.
CheckEntry IAO.mq5 is the name of the file, and it only has one function called CheckEntry.
The buy and sell signals for our system are worked out by this function.
We start with a string variable called signal, but we don’t give it a value right away because we’ll figure that out later.
The next thing we do is make an array. We use the “double” data type because it can also be used with “floating point” numbers.
Then, we use the function iAO that comes with MQL5 to create a definition for the Awesome Oscillator signal.
And we want to do that for the current symbol on the chart and the period that is currently selected on that chart.
No further parameters are required.
Now we use Array Set as Series for our IAO Array to sort it from the current candle downwards.
Afterwards we can fill our IAO Array according to the definition that we have done above.
We do it for buffer 0, starting from candle 0 for 3 candles and store the values in our price array.
That makes it possible to calculate the current IAO Value by looking at candle 0 in our array.
With normalize double, we make sure to format the output with 6 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 current value is above 0 we want to buy, so we assign the word buy to our signal.
And when the current value is below 0, we want to sell so we assign the word sell to the signal.
The last part is to give back the calculated value by using the return function and we also need to save the file.
Compiling will be done in the main file, so please open it and look for the include statements that are already contained in the source code.
There we will use two slashes to outcomment the other entry signals and add another line to include the new file called CheckEntry_ IAO.mq5.
Afterwards we can click the compile button or simply press the F7 key to get both files compiled.
A few warnings are expected, but you should not see any further error codes.
Okay, by now, you should have a compiled version for this little oscillator here. You see that it’s creating lots of trades. And I would like to say thank you for watching this video, and I will see you in the next one.