MQL5 TUTORIAL – ADVANCED IVIDYA EA

ARE YOU STILL BROKER FOOD?
EASY AUTOMATED TRADING! 
PRECODED MODULES AND STRATEGIES!
FASTER, BETTER, AUTOMATED RESULTS YOU WILL GET NOWHERE ELSE
CLICK HERE  TO START  NOW

In this video we are talking about the Variable Index Dynamic Average Indicator and how to automate it. It’s the red line here and we use the function “iVIDyA” to create it. It takes a few parameters here, so let’s go through everything.

Let’s create an Expert Advisor that returns the handle of the Variable Index Dynamic Average Indicator.

If you click on “Insert /Indicators /Trend /Variable Index Dynamic Average” you will see that we have a CMO period of 9 and an EMA period of 12 and we are going to use that later on, and you will also see the values when you place your mouse above the Indicator here or click properties. Here is also a shift value of zero and we are going to apply the close price to calculate the value.

Okay. To create it please click on the little button here or press F4 on your keyboard and now you should see the Metaeditor window and here you want to click on “File /New /Expert Advisor” from template (template), Continue (Next). I will use the name: “CheckEntry_ IVIDYA” here, now let’s click on continue, continue and finish.

Now you can delete everything above the “OnTick” function and the two comment lines here. This time we will also delete the “OnTick” function because we need one that is named “CHECK_ENTRY” and here we are going to create a variable called signal; that’s a string variable that does not have any value now because we are going to calculate that later.

We use “MqlRates” to create an array for the price data and we need to sort the array from the current candle downwards, that can be done by using “ArraySetAsSeries” for our “PriceArray” we have created here. Now we want to fill the “PriceArray” with data for 3 candles. That can be done by using “CopyRates” for the current symbol and the currently selected period on the chart. We will start with candle 0, copy the value for 3 candles and store them in the “PriceArray”. Now we need to create another array for the Expert Advisor and once again we use “ArraySetAsSeries” to sort it from the current candle downwards. Let’s define the actual Expert Advisor by using the “iVIDyA” function for the current symbol on the chart and the currently selected period, and here is a 9 and a 12. These are the values that we have seen here when we click on properties from the CMO period and the EMA period and here is a zero for the shift value and we use “PRICE_CLOSE” because we want to calculate the Expert Advisor based on the close prices.

The “iVIDyA” function is described in the help, press F1 to see the description of any function you like and now we use “CopyBuffer” and the Expert Adviser definition to copy for buffer 0 from the current candle 0 for 3 candles and store the data in the “EAArray”.

Now we can calculate the current value just by getting candle 0 from our Expert Advisor array we have created here and if the calculated value is above the close price for candle 1 in our “PriceArray” that’s a buy signal so we assign the word “buy” and if the calculated value is below the close price for candle 1 in the “PriceArray” that would be a sell signal.

Now we can return the signal to our main module by using the “Return” function. In my case I’m using the Forex Trading Framework basically a framework is a collection of predefined functions and you can trade any entry you like with it.

After the compilation please click here to go back to Metatrader, and here you want to click on “View /Strategy Tester” or press CTRL + R and in the strategy tester you want to select the Forex Trading Framework, a currency pair, or the main module that you use. Now mark the visualization and start your test, let’s enable the graphical overlay and go for full speed.

Okay. Now you know how to create the IVIDYA Expert Advisor entry with a few lines of MQL5 code.

Download “MQL5 Tutorial - Advanced IVIDYA Expert Advisor” AdvancedIVIDYA.txt – Downloaded 16 times – 1 KB

Learn how to create your own MQL5 trading robot for $1
Sign Up Now