In this video, we are going to use shifted exponential moving averages that are drawn into the future to find out if we have a buy or sell signal, so let’s find out how to do that with mql5. To get started please click on the little icon here or press F4 on your keyboard, now you should see the Metaeditor window and here you want to click on file, new file, expert advisor from template, continue, I will call this file simple shifted ema, click on continue, continue and finish. Now you can delete everything above the ontick function and the two comment lines here, we start with an include statement to include the file trade dot mqh. Afterwards, we create an instance of the class ctrade that will be called trade and we are going to use it to open and close positions. Let’s create three user-defined input variables, one for the number of candles that we are going to use to calculate the moving averages and two shift values, those shift values here are used to draw the exponential moving average on the right side of the current price, it looks as if they can predict the future but actually they are just moved to the right side. Inside of the ontick function we want to calculate the ask price and the bid price by using symbol info double for the current symbol on the chart, we use symbol underscore ask or symbol underscore bid and with normalize double and underscore digits we make sure that we calculate the right number of digits behind the dot. Afterwards, we create a string variable called signal for our signal, please don’t assign a value here because we are going to calculate that now. Let’s create two arrays, one for the first moving average and another one for the second moving average, afterwards, we are going to use array set as series for both moving averages to sort them from the current candle downwards. Let’s define the properties that is done by using the ima function for the current symbol on the chart and the currently selected period on that chart. We are going to calculate the number of candles that we have defined here, in our case twenty candles, the result for the moving average will be shifted by twenty candles, we use mode underscore ema for an exponential moving average that is calculated based on the close price and here we repeat the same thing for the second moving average, that’s the exact same number of candles but this time we are going to use another shift value, in our case one hundred candles. And now we are going to fill the array with data according to the moving average definition that we have created here, we do that for the first buffer starting with candle zero for three candles and store the result in the moving average array. Let’s repeat that for the second moving average except for those two variable names everything is the same and now we want to check if the price is above both moving averages, so if the ask price is bigger than the value for candle zero in the first moving average array and if the ask price is also above the value for candle zero in the second moving average array that’s when we have a buy signal so we assign the word buy to our signal. If the bid price is below candle zero for the first moving average array and if the bid price is also below candle zero for the second moving average array that’s when we have a sell signal and now we assign sell to our signal and when our signal equals sell and positions total delivers a value that is below one that would mean we have a sell signal and no open positions and in that case, we use trade dot sell to sell ten micro lot. In the other case if the signal equals buy and we have no open positions we use trade dot buy to buy ten micro lot. Finally, we want to create a chart output that is done by using the comment statement, this will output the text, the signal is now followed by the calculated signal. Okay! That’s about it! If you don’t understand what all the code here does or if this was too fast for you maybe you want to w...