In this video, I wanted to show you how we can create an Expert Advisor Entry that is trading the RSI, like I’m doing here in the framework.
As you can see this EA is trading like crazy! Most people would get out right here when the pain is very high and the loss is the biggest! That’s why 80% of all the traders lose their money!
You see the Expert Advisor is picking up its course and it’s still rising but I bet you couldn’t stand this!
Let’s slow it down a little bit, because this is the entry signal we are using – it’s the RSI indicator. Most of you might have heard of it or maybe you have traded it yourself.
Now we want to find out how we can create an Expert Advisor that is able to trade the RSI indicator.
We are trading the Golden Goose Framework from October 2017. This is an advanced Expert Advisor; the framework is able to handle all the open positions.
If you want to learn how to code your own framework you can take the course and if you are interested in automated trading and just want to try it you can get the 1 Dollar trial on:
forextradingframework.com.
I can’t explain everything here in a 5 minutes video but I can explain how we calculate the entry.
To do that please click on the little button here in your Metatrader or press F4 on your keyboard.
Now you should see the Metaeditor and here you want to click on “File/ New/ Expert Advisor (template)” from template. Continue. I will call this one: CheckEntry_RSI.mq5 (Check Entry RSI) because that’s the name of the imported entry in the framework.
Now you can click on continue, continue and finish.
Now you can delete everything within the file because we are going to create a function that is called: CheckEntry_RSI.
In the first step we create a string for the signal, that will be also called “signal” – right now it has no value, because we are going to calculate the value later.
Right now, we need to create an array for the price data. That will be called: myRSIArray, and after we have done that, we define the properties for the RSI.
That can be done with the built-in function “iRSI”. It takes some parameters. The first one is the current symbol on the chart.
The second one is the period on the chart. The RSI calculation is based on the last 14 candles – that’s also what you see here, and it will be calculated based on the close price.
Now we want to use “ArraySetAsSeries” to sort the price data from the current candle downwards and with “CopyBuffer” we fill the defined EA with (data) called: “myRSIDefinition” that we have defined here for the first buffer – that’s buffer zero (buffer 0) from the current candle – that’s also index 0, for three candles – that’s the three here – and save the result in our RSI array (myRSIArray) that we have created here.
Now that we have done that, we can calculate the current RSI value by getting the value of candle zero in our RSI array and we use “NormalizeDouble” and this two, because the RSI indicator also only has two digits behind the dote and “NormalizeDouble” will round the floating-point number to the specified number of digits after the decimal point.
If the RSI value is greater than 70 – that’s when the value is above the dotted line here – we consider that to be a sell signal. In the other case; if the RSI value is below 30 – that would be the case when it’s below the dotted line here – we consider it to be oversold and now we have a buy signal.
That’s almost it!
Finally, we need to return the signal to the main module.
Now I need to save all the files here, reompile my framework – that worked without any errors.
So, now I can click here or press F4 to go back to Metatrader.
Oh! If you don’t know what a framework is; basically, it’s a collection of code here that handles all the other staff. The only thing you have to define in a framework is the entry.
This is the German version, but you could also find the English version on forextradingframework.com.
Okay. Now I am back in Metatrader and I need to click on View/ Strategy Tester or press CTRL and R on my keyboard. In the Strategy Tester I am going to use the Golden Goose Framework from October 15th 2017, enable the visualization and start a test.
This is the automated framework in the back-test.
Let’s speed it up here and you can see the balance and the equity are going up.
Now you know how to quote an Entry Expert Advisor for the RSI indicator and you have coded it yourself with a few lines of MQL5 code.
Download “MQL5 Tutorial - Advanced RSI Expert Advisor” AdvancedRSI.txt – Downloaded 664 times – 765.00 B