In this video, we are going to create an entry signal for the bolts Power Oscillator. It looks very similar to the Bears Power Oscillator that we have created before. And it’s similar to do. So let’s find out how to do it with MQL5.
This time, we’re going to figure out the Bulls power oscillator and use it to make a trading system entry signal.
The Bulls Power is shown below the candle chart, and it shows numbers that are either above or below 0.
To start, we make a new file called CheckEntry BullsPower and put it in the same directory as the other system files.
The new file will use a function called CheckEntry, and we’ll make a variable called signal that will be used to return our calculated signal at the end of the function.
We’ll also need an array to store price information for a few candles.
Now, let’s keep going and define what our oscillating function is. For this, MQL5 has a built-in function called iBullsPower.
There must be three parameters. The first two are for the current symbol and period on the chart, and the third is for the calculation period. It is 13 in our case.
Then, we use Array set as Series to sort our array starting with the current candle and going down.
Now we can use CopyBuffer to add data to our array.
We do it for the definition we just made and for buffer 0!
We want to start with the current candle 0 and copy the price data for the next three candles.
Our price array holds the result.
And because of that, you can now find the value for the current candle by looking at that price array and, in particular, the value for candle 0.
We can now figure out the buy signal.
When the Bulls power value is greater than 0, we want to use that as a sign to buy.
So let’s give our signal the word “buy.”
In the other case, we want to sell whenever the value is less than 0.
At that point, we want to give the signal variable the value “sell.”
At the end of the function, please use the return function to send the calculated value back to our main module.
The entry module is done, now. Save it right away.
Then you need to open the main file and look for the part where you need to add the entry signal.
You can do that by putting the file name for our entry signal after the include statement.
Please remove any other entry signal by putting two slashes in front of it.
When you’re done, you can compile the main module and the entry module you just made by pressing F7 or clicking the compile button.
If everything went well, you shouldn’t get any errors, just some warnings!!
Okay, that’s it for the Bulls Power Oscillator. Smart idea to do two Oscillators that look almost exactly the same. Thank you for watching this video. I will see you in the next one.