MQL5 TUTORIAL – PLATIN SYSTEM – ACCELERATOR OSCILLATOR

video
play-sharp-fill

 

In this video, we are going to create an Expert Advisor to create an entry signal for this Oscillator here. It’s the Accelerator oscillator. So let’s find out how to do that with MQL5.

 

The Accelerator oszillator is drawn on a separate window below the candle chart.

 

It has a single line which we will use for our entry signal.

 

Oscillators are usually used to create filters, but it is also possible to create entry signals like we will do in this case.

 

To use it, we create a separate MQ5 file inside of the directory where the other files of the Platin System are located.

 

The name of the file is CheckEntry_IAC.mq5 and it contains a single function that is called CheckEntry.

 

It will calculate our entry signal and return it to the main module.

 

We want to create a string variable for the signal file and for now we will not assign any value as this is going to be calculated now.

 

Therefore we create an array of the type double to hold several prices.

 

In the next step we will use the function iAC that is included in the MQL5 language to create a definition for our oscillator.

 

We only have to pass two parameters here.

 

The first parameter is for the current symbol on the chart.

 

The second parameter is for the time period that we have selected on that chart.

 

In the next step we use ArraySetAsSeries to sort our array. We want to sort it from the current candle downwards.

 

And with CopyBuffer we can now fill the price array accordingly.

 

Parameter 1 is for the definition that we have created above.

 

Parameter 2 is for the first buffer, the signal line of our oscillator.

 

Parameter 3 is for the starting candle, here we use candle 0.

 

Parameter 4 is the number of candles that we want to use for the calculation.

 

And the last parameter is the price array where we want to store those values.

 

To get the value for the current candle, we simply have to look at the value for candle 0 in our price array.

 

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

 

Otherwise, if it is below zero, we assign the word sell to our signal.

 

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

 

Please don’t forget to save the file. 

 

Compilation is not necessary, just save it and go back to the main module which contains the OnTick function.

 

There you need to add the new file in the import section where you can do that by using the include statement.

 

Please outcomment any other antry signals and press F7 or click on the Compile button to compile the main module and the new entry file that you have just created.

 

Okay, by now, you should have a working version for the oscillator that is called the Accelerator.

 

You can use it in your own system, or you can import it into the Platin System or into the Robot Trading system, if you have one of those. By the way, by now we have a demo version available on Platinum System.org. For now that’s  it.

 

Thank you for watching and I will see you in the next video.