Getting error in mt5

 

Hi I have no knowledge of code however I manage to get the first part of building an EA via comparing input from another EA. The last part i have some difficulty, can some one assist me to fix the errors please.

I have attached the file 

***

Files:
100SMA.mq5  8 kb
 

Some of your code looks more like MQL4 than 5.


Please edit your post and use the code button (Alt+S) when pasting code.

EDIT your original post, please do not just post the code correctly in a new post.

 
  1. Donley Pope: I have no knowledge of code

    MT4: Learn to code it.
    MT5: Begin learning to code it.

    If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.


  2. Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
              General rules and best pratices of the Forum. - General - MQL5 programming forum?
    Next time post in the correct place. The moderators will likely move this thread there soon.

  3. datetime Candle_Time = TimeGMT     
    DoubleToString (StopLoss = 0, upper_stoplevel = 0, Lower_stoplevel = 0);
    int OnInit() …

    That is not an assignment; it's initialization of a common (globally declared), or static variable with a constant. They work exactly the same way in MT4/MT5/C/C++.

    1. They are initialized once on program load.

    2. They don't update unless you assign to them.

    3. In C/C++ you can only initialize them with constants, and they default to zero. In MTx you should only initialize them with constants. There is no default in MT5, or MT4 with strict (which you should always use).

      MT4/MT5 actually compiles with non-constants, but the order that they are initialized is unspecified and

      Don't try to use any price or server related functions in OnInit (or on load), as there may be no connection/chart yet:

      1. Terminal starts.
      2. Indicators/EAs are loaded. Static and globally declared variables are initialized. (Do not depend on a specific order.)
      3. OnInit is called.
      4. For indicators OnCalculate is called with any existing history.
      5. Human may have to enter password, connection to server begins.
      6. New history is received, OnCalculate called again.
      7. New tick is received, OnCalculate/OnTick is called. Now TickValue, TimeCurrent, account information and prices are valid.
  4. Incomplete function call.
  5. No terminating semicolon.

  6. DoubleToString (StopLoss = 0, upper_stoplevel = 0, Lower_stoplevel = 0);
    int OnInit() …
    Function call outside of an event handler. Returned value isn't used, call has no effect. Wrong number of arguments. Assignments to non-existant variables and then used as parameters.
 
Comments that do not relate to this topic, have been moved to "Off Topic Posts".
Reason: