MQL5 TUTORIAL – PLATIN SYSTEM – CHAIKIN OSCILLATOR

video
play-sharp-fill

 

 

In this video, we are going to create an entry module for this oscillator here. It is called the Chaiken oscillator. So let’s find out how we can code an entry module.

 

The chaikin oscillator is usually used to confirm other signals, because it is an oscillator.

 

But in this example we will use it to generate buy and sell signals!

 

Let’s create a new file called CheckEntry_Chaikin.mp5 in the same directory where the other files are stored.

 

Like we have done for other entry modules we need to create a function called CheckEntry.

 

The signal is later returned by this function.

 

And now we need a string variable and a price array!

 

MQL5 comes with a function called iChaikin that we can use to create our definition for the calculation.

 

Parameter 1 is for the current symbol and parameter 2 for the current period on our chart.

 

Afterwards we have two numbers!

 

If you open Metatrader5 and select insert, indicators, oscillators, you will learn that these values are for the fast moving average and for the slow moving average.

 

The standard values are 3 and 10!

 

The following parameter is used to define that we want to calculate the result based on Mode_EMA, that stands for exponential moving average.

 

And in the last parameter we have defined that the result should be calculated on the tick basis.

 

Now let’s continue and sort the array from the current candle downwards by using array set as series.

 

And then we use Copy Buffer to fill our array with data!

 

We do it for the formerly created definition and buffer zero, starting from the current candle 0.

 

We want to store the values for 3 candles in our array!

 

Now we can calculate the values for the current candle and the one before.

 

We do that by looking at the values of candle 0 and candle 1 in our array.

 

If the current chaikin value is above 0 and the previous value was below 0, we consider that to be a buy signal and assign the word buy to our signal.

 

Otherwise, if the current value is below 0 and the previous value was above 0, that will be a sell signal, so we assign the word sell to our signal.

 

And finally we use the return function to return the calculated value to our main module.

 

That is it for the entry, please do not forget to save it.

 

Compiling is not required as it is imported into the main module.

 

Now let’s open the main module and find the include section.

 

There you can outcomment the other entry modules with two slashes and add a new include statement for the new file that we have created.

 

And now we need to press F7 or click on the compile button to compile both modules.

 

You will see some warnings, but you should not get any errors.

 

Okay, so far, this is it for the Chaikin oscillator. I hope the compilation process worked for you. Thank you for watching, and thank you for watching, and I will see you in the next video.