New MetaTrader 4 Client Terminal 387 and MetaTrader 4 Data Center build 387 - page 4

 
AlexSTAL:

I deleted the correspondence, but I understand perfectly well what optimisation is without it...

Clearly state with a minimum of code what you are afraid of, but have not reproduced in reality...

This is a completely inane conversation... None of my indicators ask me to reinitialize buffers on every tick...

That's why I'm trying to understand what we're talking about....


to Zhunko: I will try to understand it later


How much clearer, I wrote, that at me there is a calculation only:

1) when a new bar appears.

2) when the price leaves the boundaries of already calculated part of a bar (for high or low)

3) three or four last beams are calculated.

This was discussed in our correspondence. You said it was clear.... Or did I write in vain?

If there will be re-initialisation on every tick, i.e. filling the buffer with zeros, it will have to recalculate on every tick. This will cause the following. Now Putnika has up to 100 instances of ZUP in one terminal on several charts. Even in a fast market the terminal slows down not very much. And if we have to recalculate on each tick, the number of simultaneously activated indicators will decrease tenfold. And if the calculation is performed on the entire available history, the computer will be able to handle only one instance of the indicator.

Is it not enough?

 
nen:

If there will be reinitialisation on every tick, i.e. filling the buffer with zeros, it will have to be re-calculated on every tick. This will entail the following. Now Putnika has up to 100 instances of ZUP in one terminal on several charts. Even in a fast market the terminal slows down not very much. And if we have to recalculate on each tick, the number of simultaneously activated indicators will decrease tenfold. And if the calculation is performed on the entire available history, the computer will be able to handle only one instance of the indicator.

Where is it written? You can check it first and only then get scared.
 
nen:


How much clearer, I wrote that I only had the calculation:

1) when a new bar appears

2) when the price moves beyond the already calculated part of the bar (over the high or low)

3) the last three or four bars are calculated.

This was discussed in our correspondence. You said it was clear.... Or did I write in vain?

If there will be re-initialisation on every tick, i.e. filling the buffer with zeros, it will have to recalculate on every tick. This will cause the following. Now Putnika has up to 100 instances of ZUP in one terminal on several charts. Even in a fast market the terminal slows down not very much. And if we have to recalculate on each tick, the number of simultaneously activated indicators will decrease tenfold. And if the calculation is performed on the entire available history, the computer will be able to handle only one instance of the indicator.

Isn't it enough?

If only, but if only... There is no such problem! Zhunko has a completely different problem. Before you raise a panic you need to check it yourself. I checked a few posts above and even posted the code
 
Rosh:
Where does it say that? You can check it first and only then get scared.

+10000

In every case there should be a professional approach....

 
start()
 {
  if(glowBar<=iLow(NULL, gtf, 0) && ghighBar>=iHigh(NULL, gtf, 0) && gtimelast==iTime(NULL, gtf, 0)) return (0);

  glowBar=iLow(NULL, gtf, 0); ghighBar=iHigh(NULL, gtf, 0);                  // обновляем сразу, а не после длительного расчета
...// здесь код основного расчета.

  gcurrentBars=iBars(NULL, gtf);       // обновляем в конце, чтобы не накапливались непосчитанные бары за время расчета
                                        // и не срабатывал полный пересчет на следующем тике в случае длительного расчета
 }

Полный код секции старт


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i, j;

   gtf=Period();
   gRecalculation=1;

   while(gRecalculation>0)
     {
      if(gcurrentBars<iBars(NULL, gtf)-1)
        {
         Print("Время полного пересчета = ",TimeToStr(Time[0],TIME_DATE|TIME_MINUTES));
         glowBar=0; ghighBar=0; gtimelast=0; gsave_wr0=0;
         ArrayInitialize(gsave_tLast,0);ArrayInitialize(gsave_hl,0);ArrayInitialize(gsave_lastlow,0);ArrayInitialize(gsave_lasthigh,0);
         ArrayInitialize(gt_hi,0);ArrayInitialize(gt_li,0);ArrayInitialize(gt_end,0);

         gTheExternalBar=false; 
         history=true;
//      if(_PrimarySelectionOfExtremums==2 || _PrimarySelectionOfExtremums==3) delete_objects();
         delete_objects();
         g_addnewextremum=true;
         gbar=iBars(NULL, gtf);

         ArrayInitialize(gtime_gbar,0); ArrayInitialize(gL2LTime,0); ArrayInitialize(gL2HTime,0); 

         ArrayInitialize(LowestBuffer1,0);ArrayInitialize(HighestBuffer1,0);
         ArrayInitialize(LowestBuffer2,0);ArrayInitialize(HighestBuffer2,0); 
         ArrayInitialize(LowestBuffer3,0);ArrayInitialize(HighestBuffer3,0); 
         ArrayInitialize(LowestBuffer4,0);ArrayInitialize(HighestBuffer4,0); 

         ArrayInitialize(last_h,0);ArrayInitialize(last_l,0);ArrayInitialize(last_t,0);

         ArrayInitialize(tL1,0);ArrayInitialize(tL2,0);ArrayInitialize(tL3,0);ArrayInitialize(tL4,0);ArrayInitialize(tL5,0);
         ArrayInitialize(tL6,0);ArrayInitialize(tL7,0);ArrayInitialize(tL8,0);ArrayInitialize(tL9,0);ArrayInitialize(tL10,0);
         ArrayInitialize(tL11,0);

         ArrayInitialize(cL1,0);ArrayInitialize(cL2,0);ArrayInitialize(cL3,0);ArrayInitialize(cL4,0);ArrayInitialize(cL5,0);
         ArrayInitialize(cL6,0);ArrayInitialize(cL7,0);ArrayInitialize(cL8,0);ArrayInitialize(cL9,0);ArrayInitialize(cL10,0);
         ArrayInitialize(cL11,0);
         ArrayInitialize(cH1,0);ArrayInitialize(cH2,0);ArrayInitialize(cH3,0);ArrayInitialize(cH4,0);ArrayInitialize(cH5,0);
         ArrayInitialize(cH6,0);ArrayInitialize(cH7,0);ArrayInitialize(cH8,0);ArrayInitialize(cH9,0);ArrayInitialize(cH10,0);
         ArrayInitialize(cH11,0);
         if(filterZigZag==1)
           {
            ArrayResize(cLz1,gbar);ArrayResize(cHz1,gbar);ArrayResize(tLz1,gbar);

            ArrayInitialize(tLz1,0);ArrayInitialize(tLz2,0);ArrayInitialize(tLz3,0);ArrayInitialize(tLz4,0);ArrayInitialize(tLz5,0);
            ArrayInitialize(tLz6,0);ArrayInitialize(tLz7,0);ArrayInitialize(tLz8,0);ArrayInitialize(tLz9,0);ArrayInitialize(tLz10,0);
            ArrayInitialize(tLz11,0);

            ArrayInitialize(cLz1,0);ArrayInitialize(cLz2,0);ArrayInitialize(cLz3,0);ArrayInitialize(cLz4,0);ArrayInitialize(cLz5,0);
            ArrayInitialize(cLz6,0);ArrayInitialize(cLz7,0);ArrayInitialize(cLz8,0);ArrayInitialize(cLz9,0);ArrayInitialize(cLz10,0);
            ArrayInitialize(cLz11,0);
            ArrayInitialize(cHz1,0);ArrayInitialize(cHz2,0);ArrayInitialize(cHz3,0);ArrayInitialize(cHz4,0);ArrayInitialize(cHz5,0);
            ArrayInitialize(cHz6,0);ArrayInitialize(cHz7,0);ArrayInitialize(cHz8,0);ArrayInitialize(cHz9,0);ArrayInitialize(cHz10,0);
            ArrayInitialize(cHz11,0);
           }
Print("");
        }
      else
        {
         if(_PrimarySelectionOfExtremums<2)
           {
            gbar=iBarShift(NULL, gtf, gtime_gbar[0], true)+2;
           }
        }

      if(_PrimarySelectionOfExtremums==4 && gtimelast==iTime(NULL, gtf, 0)) return(0);
      if(tL1[0]>0)
        {
         if(glowBar<=iLow(NULL, gtf, 0) && ghighBar>=iHigh(NULL, gtf, 0) && gtimelast==iTime(NULL, gtf, 0)) return (0);
         if(gtimelast<iTime(NULL, gtf, 0) &&(_PrimarySelectionOfExtremums==2 || _PrimarySelectionOfExtremums==3))
           {
            gTheExternalBar=false; delete_objects();
           }
        }
      glowBar=iLow(NULL, gtf, 0); ghighBar=iHigh(NULL, gtf, 0);                  // обновляем сразу, а не после длительного расчета

      // Поиск экстремумов для первого уровня
      glevel=0;
      SamplingCreationExtremums();

      if(history)
        {

         if(ShowPrimaryLevel==0)
           {
            VisiblePrimarySelections(cL1, cH1, tL1, cLz1, cHz1, tLz1, LowestBuffer1, HighestBuffer1); // визуализация
           }

         // Создание следующих уровней и визуализация
         SelectionArrayForNextLevels();
         gtimelast=iTime(NULL, gtf, 0); // эта переменная используется в промежуточных расчетах, поэтому ее обновляем после расчетов
         history=false;

//*
         // Обрезка массивов
         if(QuantityExtremums>0)
           {
            for(i=1;i<11;i++)
             {
              int k=ScrapOfArrays(i);
              if(k!=0) Print("размер массива уровня ",i-1," = ",k);
              if(k==0) break;
//              if(ScrapOfArrays(i)==0) break;
             }
          }
//*/
        }
      else
        {
         WriteNewExtremums(cL1, cH1, tL1, cLz1, cHz1, tLz1);

         // Создание следующих уровней и визуализация
         SelectionArrayForNextLevels();

         gtimelast=iTime(NULL, gtf, 0); // эта переменная используется в промежуточных расчетах, поэтому ее обновляем после расчетов
        }
      if(gRecalculation>0) gRecalculation--;
     }

   gcurrentBars=iBars(NULL, gtf);       // обновляем в конце, чтобы не накапливались непосчитанные бары за время расчета
                                        // и не срабатывал полный пересчет на следующем тике в случае длительного расчета

Err(371);

   return(0);
  }
//+------------------------------------------------------------------+

A small piece of code. And about the same with some variations in all my indicators.

Note that I have a rather large area where buffers are re-initialized. All the ArrayInitialize functions are just engaged in such reinitialization. But it only happens as needed, not forced.

 

I already wrote on the first page for the developers to explain the meaning of point 6

Terminal: Buffers initialisation has been added for custom indicators when reading historical data again.

No explanation has been received from them yet. And we create a storm in a glass of water here. But it's not just here either. I have warned everyone, who uses my indicators, to wait before downloading build 387.

 
The discussion is over.
 
Zhunko:

Figured out why the complex wasn't working. Goodbye optimisation :-(

Now for every tick I have to re-fill buffers. Taken care of...

No change - no initialization! At least think about it!

I don't read historical data in buffers. I only use them for vertical sweep in subwindow. Why do I need to fill them all the time? There are only three occasions when they need to be overwritten (first run, zoom, chart shift). As it is, MT4 can hardly move, and there is one more brake.


No change, no initialisation. That's right. Initialisation is only done after the historical data has been overwritten. This was envisaged before, only it didn't work as intended. Under normal conditions, when bar after bar (or several bars after a connection failure), there is no buffer initialization.
 

2 Terminal: Fixed quotation counter calculation when calculating custom indicators.

There was an error with estimation of number of changes in historical data. With a large number of changes the data was wrongly caused by additional calculation, not recalculation. This especially affected the ZigZag indicator, when the data has changed dramatically, but the zigzag was not recalculated.

 
VBAG:

That's great! The developers haven't given up on the B4, but are supporting it and even improving it. This is simply evidenced by the build number 387!

Last I saw was - 229. And at once - 387 (maybe a coprocessor connected? Huh...)! Cool!

The main thing is to respect the main commandment of the surgeon-programmer - "Do no harm!

MetaTrader 4 platform is a set of many components - servers, data centres, feeders of quotes and news, client terminal, manager and administrator terminals, APIs, standard add-ons written using APIs, etc. These components have evolved in different ways.

Therefore, all the current components have been given the number 380, equalizing the numbering of builds. Purely a cosmetic operation.

Reason: