How to detect a new bar - page 3

To add comments, please log in or register
shunajo
400
shunajo  
Stephen Njuki:
I use this...

Thanks man

Fabio Fontes
53
Fabio Fontes  
Stephen Njuki:
I use this...

I had many problems using time as a variable and I was looking for a way to use variables bars


thank you, work!


Thiago Duarte
15251
Thiago Duarte  
Mladen Rakic:

Why not simply using something like this :

   static datetime prevTime=0;
          datetime lastTime[1];
          if (CopyTime(_Symbol,_Period,0,1,lastTime)==1 && prevTime!=lastTime[0])
          {
               prevTime=lastTime[0];
              
               // ...
          }
It should work in all cases (even when there is an error with CopyTime() it avoids a trap)

thank you bro!

123
To add comments, please log in or register