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

 

Does anyone else besides costy_ understand anything about IndicatorCounted, because he didn't really get the gist of the problem.

And as if he did, and as if he didn't.

 
depth_finde писал(а) >>

Does anyone else besides costy_ understand anything about IndicatorCounted, because he didn't really get the gist of the problem.

And as if he did, and as if he didn't have an answer.

What is there to understand about it. During normal operation it behaves correctly. In non-normal (history loading) it behaves incorrectly most of the time, but the result is usually satisfying

 
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 re-calculate all 3000 too, I need IndicatorCounted. I don't know how to specify the condition that would show only the last 3000 without re-calculating the already passed ones.

Thank you for your feedback.

I will repeat.

 
depth_finde писал(а) >>

I'll say it again.

Now I get it.

>> Example implementation.

Files:
 
depth_finde >> :

Again.

Instead of Bars, put your value 300 or 100, or WindowBarsPerChart() The function returns the number of bars that fit in the current chart window.(i.e. what is visually visible in the window)

 
Vinin писал(а) >>

Now I get it.

An example of implementation

Thank you very much, costy_ and thank you sorry for the abruptness.

 
depth_finde >> :

Again.

For example, you could do this:

int CountBars=3000;

int limit=Bars-IndicatorCounted()-1;
if( limit> CountBars) limit= CountBars;
   
for(int i=0; i< limit; i++)
   {
   Buffer[ i]=...;
   }

you can limit the number of bars in the window.

Service-Settings-Graphics-Max. bars per window.

 
Urain >> :

It's worth it, and instead of deleting, you can set ObjectCreate by checking if(ObjectFind(RectangleSell)==-1){ ObjectCreate()}

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

As for the deletions - the point is that as the number of bars increases, the rectangle gets larger on the timeline(EndBoxTime)

while the "StartBoxTime" for it remains unchanged. Therefore, if the conditions are fulfilled and a new bar is formed, we have to delete the previous one and draw a new rectangle in its place

draw a new rectangle instead.

Thank you!

 
chief2000 >> :

As for deletions - the point is that as the number of Bars increases, the rectangle increases in time scale(EndBoxTime)

while the "StartBoxTime" for it remains unchanged. Therefore, if the conditions are fulfilled and a new bar is formed, we have to delete the previous one and draw a new rectangle in its place

draw a new rectangle in its place.

>> Thank you!

You don't have to delete it, you can just change the parameters via ObjectSet.

ps But in general, it is up to you to look at the case study.

 

Folks, a word of advice to anyone who knows. Let's say I draw a custom indicator on the main chart. Then I use another custom indicator that involves the first indicator via iCustom function. Can I connect them so that when the first indicator's parameter changes on the chart, the parameter in the second custom indicator automatically changes?

Reason: