Okay, I have already corrected a few things and as you can see, we don’t have any errors or warnings. But I changed the type of the variable for TrendFrame to int. So now the function CheckTrend in the MQ4 file will receive a TrendFrame as an integer.


We will pick up the value here and name it timeframe. I did that because it’s also called timeframe in the iMA function and I replaced the name here and here. If you accidentally should click the Compile button in the MQ4 file, you will see that it says, “event handling function not found.”


This is because this MQ4 module will not run as a standalone version. You can simply ignore that for now. You only have to save this one and you compile the main expert advisor. I would like to have the TrendFrame value show up in the comment line, so I will modify it here.
Now, it will show the line, the trend for the TrendFrame and the value of the TrendFrame and the other information we already had on the chart. Let’s compile it again and everything is okay. Like always, hit the F4 key and start the back test. And here you can see that we have chosen 10080 minutes for the TrendFrame.eo.