[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 1021

 
Reshetov:
The OrderMagicNumber() function always returns 0 for manually opened positions. That is, the MAGICMA variable in the EA is not equal to 0.

Thank you. What is your advice? I am not a high-level programmer, I am just learning ;)

 

I have such a code in my EA:

//=================================================================    
  
   if(Hour()==0)
      { Print("ok");
       for (i=1; i<=OrdersTotal(); i++)                    //Цикл по всем ордерам,..     
      {                                                  //отражённым в терминале      
      if(OrderSelect(i-1,SELECT_BY_POS)==true)           //Если есть следующий        
         {                                               // Здесь должен выполняться анализ характеристик ордеров   
          //--------------------
         order_type=OrderType();
         order_magic=OrderMagicNumber();
         order_symbol = OrderSymbol();
            if(order_type==OP_BUYSTOP && order_magic==magic && order_symbol==Symbol())             // выбран ордер buy stop
               {OrderDelete(OrderTicket());}
            if(order_type==OP_SELLSTOP && order_magic==magic && order_symbol==Symbol())             // выбран ордер sell stop
               {OrderDelete(OrderTicket());}
          //--------------------
         }     
       }
      }
   //=================================================================

When I run the EA in the tester, there is no "ok" record in the log. Why, what is not written correctly.

 

how do i find the place in the EA where these errors are?...please explain it once so i can find it later...those numbers in brackets must be the place where they are?

'(' - function definition unexpected E:\MetaTrader - Alpari\experts\PRIOR.mq4 (496, 16)

'count' - variable not defined E:MetaTrader - Alpari/experts/PRIOR.mq4 (502, 63)

'count' - variable not defined E:MetaTrader - Alpari/experts/PRIOR.mq4 (504, 12)
 
dmmikl86:

I have such a code in my EA:

When I run the EA in the tester, there is no "ok" record in the log. Why, what is not written correctly.

Does the hour 00:00 exist on the chart optically?

(I have in my tester log 2010.12.10 19:20:09 2010.11.05 00:45 optima__TEMP EURUSD,M5: ok )

 
ilmur:

how do i find the place in my EA where these errors are?...please explain it once and then i will find it by myself....these numbers in brackets must be the place where they are?

'(' - function definition unexpected E:/MetaTrader - Alpari/experts/PRIOR.mq4 (496, 16)

'count' - variable not defined E:MetaTrader - Alpari/experts/PRIOR.mq4 (502, 63)

'count' - variable not defined E:\MetaTrader - Alpari\experts\PRIOR.mq4 (504, 12)

Missing '(', learn to write code so that you don't get confused, variable count is not defined(int count...)

void init(){  
  SymbolName = ...;
  FileName = SymbolName + Period() + ".hst";
  handle = FileOpenHistory(...);
  if(...<0){         //файла нет
    ...;     //создаем заголовок
    ...;  //смещаем от начала на 148байт
    ...;    //пишем все бары
  }else{                //файл есть
    ...;  //закрываем  
    ...; // откроем для редактирования
    ...;  //смещаем на 2бара назад
    ...; //читаем дату
    ...;  //смещаем на 4 прочитанных байта назад от текущего положения
    ...;
    ...;
  }
}
 
costy_:

Does 00:00 hour exist on the chart optically?

(I have the tester log 2010.12.10 19:20:09 2010.11.05 00:45 optima__TEMP EURUSD,M5: ok )

I looked through the help, the value is "0", I changed it to 1 just in case, no reaction.
 
dmmikl86:
I looked up the help, there is a value of "0", changed it to 1 just in case, still no reaction.

So it's time to call in the psychic team. Reshetov is the best.
 

I am interested in the place where the error is...how do I find it?

Alpari\experts\PRIOR.mq4 (496, 16) in brackets numbers what do they mean?
 
ilmur:

I'm interested in where the error is...how do I find it?

Alpari\experts\PRIOR.mq4 (496, 16) in brackets numbers what do they mean?

Just double-click on the error and you will be fine.
 
Vinin:

So it's time to call in the psychic team. Reshetov's the best.
Meaning where the code is, attach it to the messages.