Okay this time we are talking about the Force Index Indicator. It is a very simple indicator. It’s easy to read and also easy to code. If the indicator crosses the line in the middle from below and stays above the line, that could mean that we are bullish. And when it crosses the line from above and stays below the line like in this case, we have a bearish trend and we would like to sell. According to the website www.traderhq.com, this is also an indicator that was developed by Dr Alexander Elder, the author of the book: Trading for a Living. Okay now that we know how it works how can we create an Expert Advisor to use the indicator? The first step is to click the little button over here or hit the F4 key on your keyboard. That will start the Meter Editor and we want to click on File, New, Expert Advisor from template, Continue. We will call it Simple Force Index Robot. Now click on Continue, Continue, Finish, and delete everything above the Ontick function. These two comment lines are also no longer needed, because here we want to create an array, it shall holds several prices so it’s a double array and I will call it my price array. And now it’s time to define the Force Index definition by using the iForce function that is built-in into MQL 5. It takes some parameters, the first one is the current symbol on the chart, the second one is the period you have selected on your chart. The Force Index is calculated based on the last thirteen candles. You will also see it here in this little brackets. It is using the MODE_SMA that stands for Simple Moving Average and we want to use Tick volume. If you insert the indicator by clicking on Insert indicators, Oscillators, Force Index, you will see the exact same values here: thirteen candles, simple moving average based on the tick volume. Okay, let’s use the array set as series function that will sort the price array from the current candle downwards and now we use Copy Buffer for the Force Index definition we have created here. We need one line for the indicator that’s a zero here and we want to fill our array from the current candle that’s candle zero, for three candles that’s the three and store the result in our price array. And from our price array we are now going to extract the Force Index value for the current candle zero and we will use normalize double for six digits to get the six digits behind the point. And now we want to create a chart outputs depending on the value and if our Force Index value is above zero, we want to output the comment “trending upwards” directly on our chart and in the other case if the Force Index value is below zero, we want to have the text “trending downwards” on our chart. Okay, now please click on the little Compile button here or press the F7 key on your keyboard. That should compile your Expert Advisor without any errors or warnings here. And if that was going well please click on the button here or press F4 to go back to MetaTrader. Now in MetaTrader you want to click on View, Strategy Tester or press control and R. And in the Strategy Tester you want to select the Simple Force Index Robot.ex5 file. Let’s pick a currency pair here, enable the visualisation mode and click on Start and here we go. Now the indicator is below the line so it says trending downwards and as soon as the little indicator crosses the line from below, that changes to trending upwards. Okay, now you know how to create an Expert Advisor for Meta Trader5 that is using the Force Index Indicator and you have created it yourself in five minutes with a few lines of MQL5 code. Not sure what to do? Click on the automated trading assistant below How to create a force Index EA with MQL5 How to create a Bulls Power EA with MQL5 How to create a Demarker Expert Advisor with MQL5 How to create a MacD EA with MQL5 MQL5 TUTORIAL - PLATIN SYSTEM - VARIABLE INDEX… The post MQL5 Tutorial – Simple Force Index Trading Robot appeared first on MQL5 Tutorial.
Okay this time we are talking about the Force Index Indicator. It is a very simple indicator. It’s easy to read and also easy to code. If the indicator crosses the line in the middle from below and stays above the line, that could mean that we are bullish. And when it crosses the line from above and stays below the line like in this case, we have a bearish trend and we would like to sell. According to the website www.traderhq.com, this is also an indicator that was developed by Dr Alexander Elder, the author of the book: Trading for a Living. Okay now that we know how it works how can we create an Expert Advisor to use the indicator? The first step is to click the little button over here or hit the F4 key on your keyboard. That will start the Meter Editor and we want to click on File, New, Expert Advisor from template, Continue. We will call it Simple Force Index Robot. Now click on Continue, Continue, Finish, and delete everything above the Ontick function. These two comment lines are also no longer needed, because here we want to create an array, it shall holds several prices so it’s a double array and I will call it my price array. And now it’s time to define the Force Index definition by using the iForce function that is built-in into MQL 5. It takes some parameters, the first one is the current symbol on the chart, the second one is the period you have selected on your chart. The Force Index is calculated based on the last thirteen candles. You will also see it here in this little brackets. It is using the MODE_SMA that stands for Simple Moving Average and we want to use Tick volume. If you insert the indicator by clicking on Insert indicators, Oscillators, Force Index, you will see the exact same values here: thirteen candles, simple moving average based on the tick volume. Okay, let’s use the array set as series function that will sort the price array from the current candle downwards and now we use Copy Buffer for the Force Index definition we have created here. We need one line for the indicator that’s a zero here and we want to fill our array from the current candle that’s candle zero, for three candles that’s the three and store the result in our price array. And from our price array we are now going to extract the Force Index value for the current candle zero and we will use normalize double for six digits to get the six digits behind the point. And now we want to create a chart outputs depending on the value and if our Force Index value is above zero, we want to output the comment “trending upwards” directly on our chart and in the other case if the Force Index value is below zero, we want to have the text “trending downwards” on our chart. Okay, now please click on the little Compile button here or press the F7 key on your keyboard. That should compile your Expert Advisor without any errors or warnings here. And if that was going well please click on the button here or press F4 to go back to MetaTrader. Now in MetaTrader you want to click on View, Strategy Tester or press control and R. And in the Strategy Tester you want to select the Simple Force Index Robot.ex5 file. Let’s pick a currency pair here, enable the visualisation mode and click on Start and here we go. Now the indicator is below the line so it says trending downwards and as soon as the little indicator crosses the line from below, that changes to trending upwards. Okay, now you know how to create an Expert Advisor for Meta Trader5 that is using the Force Index Indicator and you have created it yourself in five minutes with a few lines of MQL5 code.
Okay this time we are talking about the Force Index Indicator.
It is a very simple indicator. It’s easy to read and also easy to code.
If the indicator crosses the line in the middle from below and stays above the line, that could mean that we are bullish.
And when it crosses the line from above and stays below the line like in this case, we have a bearish trend and we would like to sell.
According to the website www.traderhq.com, this is also an indicator that was developed by Dr Alexander Elder, the author of the book: Trading for a Living.
Okay now that we know how it works how can we create an Expert Advisor to use the indicator?
The first step is to click the little button over here or hit the F4 key on your keyboard.
That will start the Meter Editor and we want to click on File, New, Expert Advisor from template, Continue.
We will call it Simple Force Index Robot. Now click on Continue, Continue, Finish, and delete everything above the Ontick function.
These two comment lines are also no longer needed, because here we want to create an array, it shall holds several prices so it’s a double array and I will call it my price array.
And now it’s time to define the Force Index definition by using the iForce function that is built-in into MQL 5.
It takes some parameters, the first one is the current symbol on the chart, the second one is the period you have selected on your chart.
The Force Index is calculated based on the last thirteen candles. You will also see it here in this little brackets.
It is using the MODE_SMA that stands for Simple Moving Average and we want to use Tick volume.
If you insert the indicator by clicking on Insert indicators, Oscillators, Force Index, you will see the exact same values here: thirteen candles, simple moving average based on the tick volume.
Okay, let’s use the array set as series function that will sort the price array from the current candle downwards and now we use Copy Buffer for the Force Index definition we have created here.
We need one line for the indicator that’s a zero here and we want to fill our array from the current candle that’s candle zero, for three candles that’s the three and store the result in our price array.
And from our price array we are now going to extract the Force Index value for the current candle zero and we will use normalize double for six digits to get the six digits behind the point.
And now we want to create a chart outputs depending on the value and if our Force Index value is above zero, we want to output the comment “trending upwards” directly on our chart and in the other case if the Force Index value is below zero, we want to have the text “trending downwards” on our chart.
Okay, now please click on the little Compile button here or press the F7 key on your keyboard.
That should compile your Expert Advisor without any errors or warnings here.
And if that was going well please click on the button here or press F4 to go back to MetaTrader. Now in MetaTrader you want to click on View, Strategy Tester or press control and R.
And in the Strategy Tester you want to select the Simple Force Index Robot.ex5 file.
Let’s pick a currency pair here, enable the visualisation mode and click on Start and here we go.
Now the indicator is below the line so it says trending downwards and as soon as the little indicator crosses the line from below, that changes to trending upwards.
Okay, now you know how to create an Expert Advisor for Meta Trader5 that is using the Force Index Indicator and you have created it yourself in five minutes with a few lines of MQL5 code.
Download “MQL5 - Simple Force Index Trading Robot from MQL5 Tutorial”
SimpleForceIndexRobot.txt – Downloaded 380 times – 807.00 B Not sure what to do? Click on the automated trading assistant belowThe post MQL5 Tutorial – Simple Force Index Trading Robot appeared first on MQL5 Tutorial.