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

 
chief2000 >> :

The question is how it works (optimizing indicators):

Do I understand correctly that with every new tick the same rectangle

(the same size with equal number of bars) will be deleted and redrawn?

Is it worth adding a check for the number of bars (if there are more bars, only then redraw)?

To offload the computer CPU or will the gain be minimal and not worth messing around with it?

Yes, and instead of deleting, ObjectCreate can be set through checking if(ObjectFind(RectangleSell)==-1){ ObjectCreate()}

and the rest without checking, so that you don't have to delete and re-set an object on every tick.

if( MA_Fast[ i+1]> MA_Slow[ i+1]) {
   string RectangleSell = StringConcatenate("RECTANGLE_", StartBoxTime);   
   if(ObjectFind( RectangleSell)==-1){
      ObjectCreate( RectangleSell, OBJ_RECTANGLE, 0,  StartBoxTime, BoxLow,  EndBoxTime, BoxHigh);
     }
   ObjectSet( RectangleSell, OBJPROP_STYLE, STYLE_SOLID);
   ObjectSet( RectangleSell, OBJPROP_RAY, False);
   ObjectSet( RectangleSell, OBJPROP_WIDTH, 1);
   ObjectSet( RectangleSell, OBJPROP_BACK , True);
   ObjectSet( RectangleSell, OBJPROP_COLOR, ColorSell);
}
 
Vinin >> :

We need to add time synchronisation.

Surely there are developments, you can show how to implement it on MA!

 
Vladimir11 >> :

Can you tell me if I am working on a daily schedule?

And I want to access the minutes data. Is it updated or is it old data?

If in real time, they are updated, if in the tester on D1, the data M.. on the last bars (real time and not the one being tested).

 

This is my first post on the forum. I'm studying MQL4. I don't know if there was such a question before, I haven't found it. I think I need to use the IndicatorCounted function, but I don't know how to do it. I've added quotes for 300 000 and now when I try to start indicators hangs I think I should specify not all quotes, but only a certain one, e.g. 3000. But I don't want to re-calculate all 3000 too, I need IndicatorCounted. I don't know how to specify the condition that would show only the last 3000 and not recalculate the already passed ones.

Thank you for your feedback.

 
depth_finde >> :

This is my first post on the forum. I'm studying MQL4. I don't know if there was such a question before, I haven't found it. I think I need to use the IndicatorCounted function, but I don't know how to do it. I've added quotes for 300 000 and now when I try to start indicators hangs I think I should specify not all quotes, but only a certain one, e.g. 3000. But I don't want to count all 3000 too, I need IndicatorCounted. I don't know how to specify the condition that will show only the last 3000 and not recalculate the already passed ones.

Thank you for your feedback.

Yes, like this.

int start()
  {
   int counted_bars = IndicatorCounted();
//----
   if( counted_bars < 0) 
       return(-1);
//----
   if( counted_bars > 0) 
       counted_bars --;
   int pos = Bars - counted_bars;  
//----
   while( pos >= 0) 
     {
       ma1_buffer[ pos] = iMA(NULL, 0 , Period1* Коэфициент, 0, Метод_Вычисления_МА, Низ,  pos);
       ma2_buffer[ pos] = iMA(NULL, 0 , Period1* Коэфициент, 0, Метод_Вычисления_МА, Верх, pos);
       ma3_buffer[ pos] = iMA(NULL, 0 , Period2* Коэфициент, 0, Метод_Вычисления_МА, Низ,  pos);
       ma4_buffer[ pos] = iMA(NULL, 0 , Period2* Коэфициент, 0, Метод_Вычисления_МА, Верх, pos);
       ma5_buffer[ pos] = iMA(NULL, 0 , Period3* Коэфициент, 0, Метод_Вычисления_МА, Низ,  pos);
       ma6_buffer[ pos] = iMA(NULL, 0 , Period3* Коэфициент, 0, Метод_Вычисления_МА, Верх, pos);
       pos--;
       
     }
     
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
costy_ писал(а) >>

If in real time, they are updated, if in the D1 tester, the data M.. on the last bars (real time and not the tested one).

Replyed in private

 
costy_ писал(а) >>

It's more or less like this.

Probably not, because as you have shown in the first run will be calculated not 3000 but 300000 quotes, all there is.

 
depth_finde >> :

Probably not because the way you showed the first run it will not read 3000 but 300000 quotes, as many as there are.

Yes, only once, then they change!!!

To make the indicator appear on the whole chart and not on a part of it.

 
Vinin >> :

Answered in person.

>>Thank you very much!

 
costy_ писал(а) >>

Well yes, just once, then changed!!!

To display the indicator on the whole chart and not on a part of it.

This is the idea to download not all 300 thousand indicators and wait 5 minutes for them to load, but to download 3000 on the first run and then only those that have changed.

If we have five such indicators on a chart, the loading process will take 25 minutes.