Next Video Okay. Now, we know how to calculate the closing price for a 1 or 2 candles, but this is not enough if we want to have a sophisticated program. On the chart that can be dozens or even hundreds of candles that we might want to calculate and in MQL4, we can do it with a moving average or an IMA. To calculate if it’s going up or down, we will need these 3 lines. The first line is going to calculate the current moving average. The second line calculates how it has been in the past. And the third line will tell us if the result is positive or negative. In this Comment line, we will print the result on the chart, So now, we hit the compile button and drag EA on the chart. It will show us a negative number. That means it’s going down. But it doesn’t seem to go down here. And the reason is we used 10,080 minutes to calculate it. That’s a whole week. If you change the view, you can see that it’s true. And if you change the time period, it is more obvious. So let’s drag another currency on the chart. This one is going down. This one is going down. But this one is positive and it’s going up. So now you know how to calculate a long time trend with 3 lines of code.