cannot detect new bar form. - page 3

 
Yes its do and maybe more optimized, thanks, i just posted my post because in this threat there was no complete or too mangled code to start, maybe it just looked so for me.
 
RaptorUK:
In my opinion it's bad practice to use a function for this . . . you can only use it once per tick within start() if you call it a second time on the same tick, the same tick that is the start of a new bar, it will return false . . .


I agree with you, I wouldn't use a function for this, but in the above code, the start function is exited if it is false.

That means that all subsequent code depends on the condition being true and so there would be no reason to call the function again in the same tick.

 
RaptorUK:
In my opinion it's bad practice to use a function for this . . . you can only use it once per tick within start() if you call it a second time on the same tick, the same tick that is the start of a new bar, it will return false . . .


And in my opinion function is ok, because then code becomes more complicated in "start ()" section its much easier to read it and test with function's calls not code. It's just my opinion. Yes this function can be called once in tick, but why it should be called twice?


edit:

and if you need more bar open conditions with iTime(), you can edit and pass some parameters :) with mirror modifications and use it much more times :)

Reason: