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

 
FOReignEXchange:




I know a lot about programming, but when i try to do something with indicators or graphics i get stuck, it's too hard to understand this coordinate system, like drawing with Canvas, one or two ...
usver:


Use the Bars variable and keep track of its change. Increased by 5, remembered, etc.

example plz
 
if (N=0) N=iBars(Simbol(),TF);

if ((iBars(Simbol(),TF)-N)==5)
   {
   N=0;
   Также обнуляем все параметры, которые использует индикатор, чтобы он смог сделать перерасчёт.
   }

That's about it, I think.

 

IgorM:

That's about right.

int barsTtl;

int init()
   {
      barsTtl=iBars(Symbol(),PERIOD_H1);
      return(0);
   }

int start()
   {
      if (iBars(Symbol(),PERIOD_H1)==barsTtl+5)
        {
          // какие-то действия
          ...
          ...
          ...
          barsTtl=iBars(Symbol(),PERIOD_H1);
          return(0);
        }
   }
FOReignEXchange:

About the same, I think.


Yes, that's exactly what I meant
 

usver, FOReignEXchange

thanks a lot, how well will this code work when history is paging? paging sometimes happens randomly, even if the terminal is running 24/7, byte counter

suddenly seems to increase the amount of information downloaded, although no action is taken

 
usver:

IgorM:

About right.


Yes, that's exactly what I meant

Tried that kind of thing. Doesn't always work.
 
IgorM:

usver, FOReignEXchange

how well will this code work when history is paging? paging is sometimes started randomly, even if the terminal is on 24/7, according to the byte counter

there is a sudden increase in the size of the downloaded information, although no action is taken


Yes - so this method cannot be called reliable. I only use it to check strategies and indicators, as it is the easiest. It has never failed for me.
 

Therefore, we need to remember bar time iTime(NULL,TF,0) and then count iBarShift bars.

The logic is the same as above, but bar time is used.

 
IgorM:

usver, FOReignEXchange

how well will this code work when history is paging? paging is sometimes started randomly, even if the terminal is on 24/7, according to the byte counter

You can see a sudden increase in the amount of information downloaded, although no action is taken


Yes - that's why this method cannot be called reliable. I use it only to check strategies and indicators, as the easiest one. I have never had any problems with it.

I used it to open positions at the beginning of a new bar (second/third bar from the reference point), and everything looked fine. I analyzed the history in excel - everything works as per the condition. It's a case of one thing for another, as they say. It's up to you to decide. As an alternative, I advised you FOReignEXchange with an opening time. The technology is basically the same.

 
That's it in a nutshell.
if (t=0) t=iTime(NULL,TF,0);

if ((iBarShift(NULL,TF,t)-iBarShift(NULL,TF,iTime(NULL,TF,0))==5)
   {
   t=0;
   Также обнуляем все параметры, которые использует индикатор, чтобы он смог сделать перерасчёт.
   }


 
FOReignEXchange:
Like this


Great, but if you don't mind, please make a delay in minutes using this code

I.e. in indicator settings let's set redrawing in minutes, and from M1 we will take counter