In this new video we shall create an Expert Advisor with the use of the Indicator called: Fractal Adaptive Moving Average. We have a buy signal whenever the blue line is below the candles, like here, and we have a sell signal when the line is above the candles, like this one here. So, how can we code an Expert Advisor in Metatrader 5 which is able to print (display) the buy or sell signals directly on the Forex chart? Let’s begin by clicking on the little button here or you can also press F4 on your keyboard. You should see the Metaeditor window now. Next you click on file “File /New /Expert Advisor” from template (template), Continue (Next). Give it a name like: “Simple Fractal Adaptive MA” (SimpleFractalAdaptiveMA). Continue, continue and finish. In the Metaeditor window delete everything above the “OnTick” function including the two comment lines. First of all, we are creating a string variable for the signal – we also name it signal – and we are going to assign the values later. Next you need to create a price array. For this we use “MqlRates”. “MqlRates” is a function in MQL5 which stores information about prices, volumes and the spread. Therefore, whenever you need to get the values for an open, high, low or a close price just use “MqlRates” to build a price array. Then the array needs to be sorted. We do that by the command: “ArraySetAsSeries”. Next, we are sorting the price array from the current candle in descending order. We need data for 3 candles only and we use “CopyRates” to fill the price array with the data. For “CopyRates” you need to define a few parameters. First comes the parameter for the symbol which is for the currency pair on the chart. Second is the currently selected period on the chart. For example: a 1-minute chart or an hourly chart. The zero here stands for the current candle. The current candle is always named candle zero and it is on the right side of your chart. This one here called candle 1, and this one is candle 2, and so on. We only need data for 3 candles, then we store the result in our price array (PriceArray). For the Expert Advisor let’s create another array. Let’s name it: “FramaArray” for the Fractal Adaptive Moving Average and we do that with the use of the built-in function “iFrAMA” which comes with MQL5. Let’s use the current symbol on the chart and the current period on the chart. The calculation of Frama (Fractal Adaptive Moving Average) is based on 14 candles, which is the default settings for the indicator. This you can see also when you right click on the indicator and select properties. Here it is: 14 candles and the calculation is based on the close price. The next parameter here is for the shift and we leave it zero – that’s also 0 in the default settings. The last parameter to be set here is “PRICE_CLOSE”. We have only used the default parameters here. This array needs to be sorted as well. Once again, we use “ArraySetAsSeries” to do that. Next we fill our Frama array with data by using CopyBuffer” based on the definition we have created here. Frama has only one line here; that’s buffer 0. We calculate values from the current candle; that’s candle 0. We only take data for 3 candles, the number 3 here stands for that. Then we store the data in the Frama array. Afterwards we need to calculate the value for the last candle – which is candle 1 in the Frama array – to get the signal. If the Frama value is above the last candle high we would like to sell. (Sell signal) In this case here for example. If the Frama value is below the last candle low we would like to buy. (Buy signal). In MQL5 we define this conditions by using an “if” statement. For example, if the Frama value is above the high of candle one in our price array we want to assign the word: “sell” to the signal and if the Frama value is below the last candle low, that is; if Frama value (FramaValue) is below the low price of candle one (PriceArray[1].low) in our price array we want to assign the word: “buy” to our...