Beta version of the online book on MQL4 programming - by Sergey Kovalev (SK.) - page 8

 
Climber:
What's wrong here? What's screaming about errors?

The compiler gives one error: Start function not found and cannot be run, which means: start() function not found and cannot be executed.

This is quite natural. If there is no special function in the program, it cannot be run in the MT client terminal.

 
Here is one error Function "GetExtremumZZZBar" is not referenced and will be removed from exp-file (well, it's clear, the function is not used anywhere). I wrote a comment in the code that I added, after which the errors disappeared.

//+------------------------------------------------------------------+
//|                                                         1111.mq4 |
//|                      Copyright © 2008, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
 
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
}    // Добавил вот эту скобку, точнее переместил с конца, в результате 1 ошибка
int GetExtremumZZBar(string sym="", int tf=0, int ne=0, int dp=12, int dv=5, int bc=3) {
  if (sym=="") sym=Symbol();
  double zz;
  int    i, k=iBars(sym, tf), ke=0;
 
  for (i=1; i<k; i++) {
    zz=iCustom(sym, tf, "ZigZag", dp, dv, bc, 0, i);
    if (zz!=0) {
      ke++;
      if (ke>ne) return(i);
    }
  }
  Print("GetExtremumZZBar(): Экстремум ЗигЗага номер ",ne," не найден");
  return(0);
}   
//----
   
//+------------------------------------------------------------------+
As I was writing this message, I seemed to have understood my problem. The function should not be in the body of the start function. Only the call of this function should be in the body of the start. Right?
 
Climber:
 
As I'm writing this post, I think I've figured out my problem. The function should not be in the body of the start function. Only the call of this function should be in the body of the start. Right?

Yes
 
Climber:
As I'm writing this post, I think I figured out my problem. The function should not be in the body of the start function. Only the call of this function should be in the body of the start. Right?

Correct. No function can be described in the body of another function.
 
Climber:
As I'm writing this post, I think I figured out my problem. The function should not be in the body of the start function. Only the call of this function should be in the body of the start. Right?
Yes. Take a look here: MQL4 Tutorial MQL4 Program Structure .
 
A new question has arisen))
Is it necessary for a multi-currency EA to open the charts of all symbols used?
If a tick comes for the symbol to whose chart the EA is attached, the same trade criteria for other symbols will be checked. In this case, I want to use the multicurrency to increase the number of orders opened during the day. We will not open many orders because we work with hourly charts, we manually received not more than two orders of one symbol a day.

And my next frightening task is writing a block of orders accounting for the multicurrency Expert Advisor. I am glad that pending orders are not used in my Expert Advisor (at least it reduces the accounting block :)). Can you suggest me to read something related to multicurrency accounting on this subject.
 
Climber:
I have a new question))
Is it compulsory for a multi-currency EA to open the charts of all symbols used?

No. But all the symbols used are d.b. in the Market Watch window.

 

Can you tell me how to stop an EA? I want it to stop working when a stop loss is triggered. If anyone can give me a hint, please write to mininp@list.ru. Thanks in advance!

 
Mister_X:

Can you tell me how to stop an EA? I want it to stop working when a stop loss is triggered. If anyone can give me a hint, please write to mininp@list.ru. Thanks in advance!


Maybe it is easier not to stop, but just check if there is a stop order and if there is, do nothing
 
Found a great article on complex order bookkeeping by SK'Book Orders in a Large Program'.
I am currently working manually on my demo account. I've been working manually on this last system for about a month now.

I started with a 1,000 dollar deposit and 1:100 leverage. Always minimum lot size is $100. I work with 3-4 currency pairs. During the first two weeks I managed to increase my deposit by 2 times, i.e. my deposit has become =$2,000. Now it is about 3000.

During this time maximum profit was 118 points by one instrument (from one order, of course). On average I close orders with profit of 40-50 points. For one such order we obtain a pair of orders closed at stops with total loss near 10 points. 100 points a day in total by several instruments. And this is no less than a 2-fold increase of deposit in a month. And if calculate with reinvestments taken into account, then after 10 months the deposit will be 1 million 24 thousand U.S. dollars.

Everything would be good, we should rejoice, but there is a reasonable question: what brokerage company gives so brazenly become popular in 10 months with 1000 dollars???? .

I'm trying to write an Expert Advisor, I should trade by myself.

I have to be honest with you, I am thinking about this whole event, is it not a scam?