Error in Simple EA

 
Hello! I am new to developing on MQL5 and basically coding in general. I watched a step by step tutorial in order to learn how to code a simple MA crossover. The problem is that I am getting several errors in lines 23,25 and 41 and despite the fact that I have been trying to resolve them for a few hours, I just can't do it. I don't yet understand what is the exact issue. I was hoping maybe someone would be able to help me solve it or just explain to me what is it that I'm doing wrong. This is my code:
#include <Trade/Trade.mqh>

CTrade trade;

int OnInit() {
   Print("Automatron 1000 ON");
   return(INIT_SUCCEEDED);
  }

void OnDeinit(const int reason) {
   Print("Automatron 1000 OFF");

  }

void OnTick() {


   static datetime timestamp;
   datetime time = iTime(_Symbol,PERIOD_CURRENT,0);
   if(timestamp != time){
      timestamp = time

      static int SlowSMA = iMA(_Symbol,PERIOD_CURRENT,100,0,MODE_SMA,PRICE_CLOSE);
      double SlowSMA_Array[];
      CopyBuffer(SlowSMA, 0, 1, 2, SlowSMA_Array);
      ArraySetAsSeries(SlowSMA_Array, true);

      static int FastSMA = iMA(_Symbol,PERIOD_CURRENT,50,0,MODE_SMA,PRICE_CLOSE);
      double FastSMA_Array[];
      CopyBuffer(FastSMA, 0, 1, 2, FastSMA_Array);
      ArraySetAsSeries(FastSMA_Array, true);

      if(FastSMA_Array[0] > SlowSMA_Array[0] && FastSMA_Array[1] < SlowSMA_Array[1]){
         Print("Buy signal received");
         double ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
         double Stop_Loss = ask - 100 * SymbolInfoDouble(_Symbol,SYMBOL_POINT);
         double Take_Profit = ask + 200 * SymbolInfoDouble(_Symbol,SYMBOL_POINT);
         trade.Buy(1.00,_Symbol,ask,Stop_Loss,Take_Profit,"LONG entry executed");
      }

      if (FastSMA_Array[0] < SlowSMA_Array[0] && FastSMA_Array[1] > SlowSMA_Array){
         Print("Sell signal received");
         double bid = SymbolInfoDouble(_Symbol,SYMBOL_BID);
         double Stop_Loss = bid + 100 * SymbolInfoDouble(_Symbol,SYMBOL_POINT);
         double Take_Profit = bid - 200 * SymbolInfoDouble(_Symbol,SYMBOL_POINT);
         trade.Sell(1.00,_Symbol,bid,Stop_Loss,Take_Profit,"SHORT entry executed");
      }

      Comment("\nSlowSMA_Array[0]: ", SlowSMA_Array[0],
              "\nSlowSMA_Array[1]: ", SlowSMA_Array[1],
              "\nFastSMA_Array[0]: ", FastSMA_Array[0],
              "\nFastSMA_Array[1]: ", FastSMA_Array[1]);
   
     }
  
  }

   
 
MatiasSol:
Hello! I am new to developing on MQL5 and basically coding in general. I watched a step by step tutorial in order to learn how to code a simple MA crossover. The problem is that I am getting several errors in lines 23,25 and 41 and despite the fact that I have been trying to resolve them for a few hours, I just can't do it. I don't yet understand what is the exact issue. I was hoping maybe someone would be able to help me solve it or just explain to me what is it that I'm doing wrong. This is my code:

Example: a simple Expert Advisor at the intersection of two iMA (Moving Average, MA) indicators.

How to start with MQL5
How to start with MQL5
  • 2020.09.17
  • www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...
 
Does this look correct to you?
   datetime time = iTime(_Symbol,PERIOD_CURRENT,0);
   if(timestamp != time){
      timestamp = time static int SlowSMA = iMA(_Symbol,PERIOD_CURRENT,100,0,MODE_SMA,PRICE_CLOSE);
Reason: