[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 962

 
Stellarspace:
Help "revive" the indicator. According to the historical data it works, but not according to the new ones. I am not sure what to do with it.


I would rather you put the idea in words.

And it's not good to spam. It is enough to ask the question in one place and not many

 
Techno:
The problem is not in the processor but in the EA code, there are bottlenecks somewhere, but you cannot diagnose and fix them by word of mouth, you need the code

Here is a piece of code responsible for each tick.

//***********************************************************************     
    BarTime=Time[0];
    }else                                                                  // На каждый тик
      {
        Количество = OrdersTotal();                                        // Количество ордеров на данный момент      
        for(i=Количество-1; i>=0;i--)                                      // Цикл перебора ордер
        {
          if (OrderSelect(i,SELECT_BY_POS)==true)                          // Если есть следующий
            {
              Tip=OrderType();                                             // Определения типа ордера
              Alert("Tip ордера=",Tip,", количество по счёту = ",i);
//--------------------------------------------------------------------                
              switch(Tip)                                                  // Переключатель на типы ордеров
                {
                   case 0:  Alert("Ордер BUY",", i = ",i);                 // Если ордер BUY
                            A=OrderMagicNumber();
                            Alert("ТЛ_ТP вверх =",ТЛ_ТPвверх[A],", Bid = ",Bid,", МодифBuy = ",МодифBuy[A],", A = ",A);
                           string Номер_ордера = OrderTicket();            // Имя для создания надписи ордера на терминале
                           string текст = Номер_ордера + Пусто + С1;       // Прибавление к надписи С1
                            Alert("Номер_ордера вверх = ",Номер_ордера);   // Сообщение
                           ObjectFind(Номер_ордера);
                           ObjectCreate(Номер_ордера,OBJ_TEXT,0,Время1 Син_вверх[A],O1C[A]); // Создание надписи номера ордера
                           ObjectSetText(Номер_ордера,текст,13,"Arial",вверх);// Задание свойств надписи
                           double Выше = O1C[A]+4*Point;                   // Координата стрелки вверх
                           string Значок = Время1 Син_вверх[A]+1;           // Имя для создания рисунка стрелки
                           ObjectFind(Значок);
                           ObjectCreate(Значок,OBJ_ARROW,0,Время1 Син_вверх[A],Выше);// Создание обьекта стрелки
                           ObjectSet(Значок,OBJPROP_ARROWCODE,241);        // Создание стрелки
                           ObjectSet(Значок,OBJPROP_COLOR,вверх);          // Создание цвета стрелки
                            Alert ("Значок = ",ObjectSet(Значок,OBJPROP_ARROWCODE,241));
                           Error=GetLastError();                           // Назначение имени функции проверки ошибок
                           switch(Error)                                   // Указатель ошибки
                             {   
                               case 4200 : Alert("Объект уже существует");
                           break;                                          // Выход из switch
                               default: Alert("Другая ошибка ",Error);     //Другие варианты   
                             }
                           
 if (NormalizeDouble(Bid,Digits)>=NormalizeDouble(ТЛ_ТPвверх[A],Digits) && МодифBuy[A]==false && ТЛ_ТPвверх[A] != 0) // Если цена = или > туннельной линии
    {
      МодифBuy[A]=OrderModify(OrderTicket(),NormalizeDouble(OrderOpenPrice(),Digits),OrderOpenPrice()+1*Point,OrderTakeProfit(),0);//Модифи
                               Alert("МодифBuy=",МодифBuy);
                               if (МодифBuy[A]==true)                      // Получилось :)
                                 {
                                   Alert ("Ордер ",OrderTicket()," модифицирован:)");
                                    break;                                 // Из цикла модифи.
                                 }
                               //--------------------------------------------------- 7 --
                               Error=GetLastError();                       // Не получилось :(
                               switch(Error)                               // Преодолимые ошибки
                                 {
                                   case 130:Alert("Неправильные стопы");
                                   break; 
                                                    
                               // Критические ошибки
                                 case 2 : Alert("Общая ошибка.");
                                   break;                                  // Выход из switch
                                 case 133:Alert("Торговля запрещена");
                                   break;                                  // Выход из switch
                                 default: Alert("Возникла ошибка ",Error);//Др. ошибки
                                 }
                                break;                                     // Из цикла модифи.
                             }                                    
                break;                                                     // Выход из switch
                   case 1:  Alert("Ордер Sell , i = ",i);                  // Если ордер Sell
                           B=OrderMagicNumber();
                           Номер_ордера = OrderTicket();                   // Имя для создания надписи ордера на терминале
                           текст = Номер_ордера + Пусто + С1;              // Прибавление к надписи С1
                            Alert("Номер_ордера вниз =  ",Номер_ордера);   // Сообщение
                           ObjectFind(Номер_ордера); 
                           ObjectCreate(Номер_ордера,OBJ_TEXT,0,Время1 Син_вниз[B],O1C[B]); // Создание надписи номера ордера
                           ObjectSetText(Номер_ордера,текст,13,"Arial",вниз); // Задание свойств надписи
                           double Ниже = O1C[B]-4*Point;                   // Координата стрелки вверх
                           Значок = Время1 Син_вниз[B]+1;                   // Имя для создания рисунка стрелки
                           ObjectFind(Значок);
                           ObjectCreate(Значок,OBJ_ARROW,0,Время1 Син_вниз[B],Ниже); // Создание обьекта стрелки
                           ObjectSet(Значок,OBJPROP_ARROWCODE,242);        // Создание стрелки
                           ObjectSet(Значок,OBJPROP_COLOR,вниз);           // Создание цвета стрелки
                            Alert ("Значок = ",ObjectSet(Значок,OBJPROP_ARROWCODE,242));
                           Error=GetLastError();                           // Назначение имени функции проверки ошибок
                           switch(Error)                                   // Указатель ошибки
                             {   
                               case 4200 : Alert("Объект уже существует");
                           break;                                          // Выход из switch
                               default: Alert("Другая ошибка ",Error);     //Другие варианты   
                             }     
                            Alert("ТЛ_ТP вниз =",ТЛ_ТPвниз[B],", Bid = ",Bid,", МодифSell = ",МодифSell[B], ", B = ",B);
 
  if (NormalizeDouble(Bid,Digits)<=NormalizeDouble(ТЛ_ТPвниз[B],Digits) && МодифSell[B]==false && ТЛ_ТPвниз[B] != 0) // Если цена = или > туннельной линии
    {
      МодифSell[B]=OrderModify(OrderTicket(),NormalizeDouble(OrderOpenPrice(),Digits),OrderOpenPrice()-1*Point,OrderTakeProfit(),0);//Модифи
                               Alert("МодифSell=",МодифSell[B]);
                               if (МодифSell[B]==true)                     // Получилось :)
                                 {
                                   Alert ("Ордер ",OrderTicket()," модифицирован:)");
                                   
                                   break;                                  // Из цикла модифи.
                                 }
                               //--------------------------------------------------- 7 --
                               Error=GetLastError();                       // Не получилось :(
                               switch(Error)                               // Преодолимые ошибки
                                 {
                                   case 130:Alert("Неправильные стопы");
                                   break; 
                                                    
                               // Критические ошибки
                                 case 2 : Alert("Общая ошибка.");
                                   break;                                  // Выход из switch
                                 case 133:Alert("Торговля запрещена");
                                   break;                                  // Выход из switch
                                 default: Alert("Возникла ошибка ",Error); //Др. ошибки
                                 }
                                break;                                     // Из цикла модифи.
                             }                                    
                break;                                                     // Выход из switch
                   default: Alert("Другие ордера",", i = ",i);    
                }
            }
        }                                                                  //Конец перебора орд.
      }                                                                    // Конец условия есть новая свеча или нет 
       Alert("ТЛ_ТP вниз[",B,"] = ",ТЛ_ТPвниз[B],", ТЛ_ТP вверх[",A,"] = ",ТЛ_ТPвверх[A]);
           
return(0);                                                                 // Выход из start()
  }
//+------------------------------------------------------------------+

Sorry for the two posts - can't fit in one.

Maybe you can see that the tester's scoring speed is slowing down?

 
volshebnik:

Sorry for the two posts - can't fit in one.

Maybe you can see that the tester's scoring speed is slowing down?

Well it's safe to say that all error handling, and text functions (finding, creating) are redundant, as well as the Alerts. Without them all will work faster. That's all about this piece of code.
 
volshebnik:

Sorry for two messages - it won't fit into one.

Maybe you can see that it slows down the counting speed in the tester ?


The graphics are definitely slowing down.

And do not forget that in mql4 there is a full calculation of conditions in if(), i.e. if you have several && then all values will be calculated and compared, although one false is enough to make construction with && be false

if (NormalizeDouble(Bid,Digits)<=NormalizeDouble(ТЛ_ТPвниз[B],Digits) && МодифSell[B]==false && ТЛ_ТPвниз[B] != 0) // Если цена = или > туннельной линии
    

it is possible to split it into several if()

if (МодифSell[B]==false) // Если цена = или > туннельной линии
    { if(NormalizeDouble(Bid,Digits)<=NormalizeDouble(ТЛ_ТPвниз[B],Digits) && ТЛ_ТPвниз[B] != 0)
          {
...........

in this case, after the first if() is not taken into account, the whole construct below will not be considered

 
In essence, this code only performs 2 order modifications, everything else is clearly unnecessary...
 
Techno:
in fact this code only performs 2 order modifications, everything else is obviously superfluous...
Nikolay, thank you. I have removed alerts and error handling. I cannot notice any visual speed improvement. Yes, the orders are modified here and the number of market order and place of its opening condition are shown graphically. I left the text functions as they mark on the chart which order was opened (it is necessary for further analysis).
 
volshebnik:
Nikolai, thank you. I've removed all the alerts and error handling. There is no visible increase in speed. Yes, orders are modified here and order number and place of opening conditions are shown graphically. I have left the text functions as they mark on the chart which order has been opened (we need it for further analysis).
We have to find another way of analysis, graphical functions are very slow
 
Techno:
you have to find another way to analyse, graphical functions are very slow
You could pull all the graphics into a separate function and call it with a condition. Although I thought that graphical functions and alerts don't work when optimising, and don't reduce the testing speed.
 
granit77:
You could pull all the graphics into a separate function and call it with a condition. Although I thought that graphical functions and alerts don't work when optimising, and don't reduce the testing speed.

I'm not talking about optimization, I'm talking about simple testing. A month test lasts 7 minutes.