In this video, we are looking at the Bears Power Oscillator. That’s the little Oscillator here below the candle chart. So let’s find out how to create an expert advisor entry signal for this Oscillator.


This time we want to calculate the bears power oscillator and use it to create an entry signal for your trading system.


The Bears Power is shown below the candle chart and it creates values that are either above or below 0!


To get started, we create a new file called CheckEntry_BearsPower in our directory where the other system files are already stored.


The new file will use a function called CheckEntry and we create a variable called signal that will be used to return our calculated signal, at the end of the function.


And, of course, we also need an array to hold price data for a few candles.


Now let’s continue and create a definition for our oscillating function. MQL5 offers an integrated function for that called iBearsPower.


Three parameters are required. The first two are for the current symbol and period on the chart, the third one is for the calculation period. In our case it is 13.


Afterwards we use Array set as Series to sort our array from the current candle downwards.


And now we can fill our array with data by using CopyBuffer. 


We do it for the definition that we have created a minute ago and for buffer 0!


We want to start with the current candle 0 and copy price data for 3 candles.


The result is stored in our price array.


And that makes it possible to now get the value for the current candle by looking into that price array and especially at the value for candle 0!


Now we can calculate the buy signal.


Whenever the bears power value is above 0 we want to use it as a buy signal.


So let’s assign the word buy to our signal.


In the other case, we want to sell whenever the value is below 0!


That is when we want to assign the word sell to the signal variable.


And now please use the return function to return the calculated value to our main module at the end of the function.


That’s it for the entry module. Please save it now.


And afterwards you need to open the main file and look for the part where the entry signal now needs to be included.


You can do that by using the include statement followed by the file name for our entry signal.


Please outcomment any other entry signal by adding two slashes.


When you are finished, you can press F7 or click the compile button to compile the main module and the entry module you have just created!


If everything went well, you should not get any errors!


If you do, please check out the error messages and what they mean!


On there is a list of those error codes available!


Okay, by now, you should have a working version for the Bears Power Oscillator. I would like to say thank you for watching this video and I will see you in the next one.