In this video, we want to calculate the entry signal for this little Oscillator here. It has actually two signal lines, and it is called the Relative Vigor Index. So let’s see how we can create the entry module by using MQL5. 


In this video, we’ll show you how to build an entry signal module for the oscillator that is called Relative Vigor Index.


Because oscillators provide values that are distinct from the price values on the candle chart, that indicator will once again be drawn on a separate chart window beneath the candle chart.


In the same directory as the main file and the other entry files, we first create a new file called CheckEntry RVI.mq5.


The function CheckEntry, which returns a string variable for the calculated signal, is contained in this file.


Let’s start by generating the signal. Since that is a string-type variable, it is capable of holding text data.


We currently keep it empty since we must determine the value as shown.


So let’s create two price arrays, one for the first and one for the second line that is shown in the RVI oscillator window.


Afterwards we define our oscillator and use the i RVI function that comes with MQL5.


That will use the current chart symbol, the chosen time period and the value 10 for the definition.


As you might have guessed, the value 10 is the number of candles for the calculation.


Both arrays need to be sorted from the current candle downwards by using array set as series.


Now we want to fill our two arrays with data and we can do that by using CopyBuffer.


In both cases we use the definition that we have created before.


The first parameter is for the buffer, either 0 or 1.


The second parameter is the starting candle 0.


Parameter 3 is for the number of candles that we want, in our case we want 3 candles.


And the last parameter is the target array for both signals.


In the next step we use Normalize double to get a formatted output with 3 digits behind the dot for the current candle 0. We do that for both arrays.


Now that we have the current values for both buffers, we can define a buy and a sell signal.


In our example we want to buy when value 0 is below value 1 and when both values are below 0.


If that is the case, we assign the word buy to our signal variable.


Otherwise, when value 0 is above value 1 and when both values are bigger than 0, we assign the word sell to the variable.


Now that we have calculated the signal, we want to return it by using the return statement.


Please save the file without compilation, the compilation process will be done in the main file.


Please open it and find the include section.


There you can outcomment all other entries by using two slashes.


Add a new line and include the new file called Check_Entry RVI.mq5.


Then you can compile both files at the same time by pressing F7 or clicking the compile button in the tool bar.


The compilation process should work without any error messages, some warnings are expected.


Okay, I hope you have a successfully compiled version by now. For now, I want to say thank you for watching the video, and I will see you in the next one.