W
> How we know when a new bar is formed
When the current bar gives its first tick
You can detect this with
...
if (Volume[0]==1) { // First tick is here so do stuff for new bar }
...
Good Luck
-BB-
W
> How we know when a new bar is formed
When the current bar gives its first tick
You can detect this with
...
...
Good Luck
-BB-
Thanks BarrowBoy
you could also:
int barsTotal = 0; int start() { if(Bars > barsTotal){ //...do stuff..; barsTotal = Bars; } }
you could also:
I do that in first and I would be sure if something like newBarFormed exists?
also thanks
Chris
you could also:
i like this better somehow closer to my style.
Thx
i like this better somehow closer to my style.
Thx
How about:
datetime lastBarOpenTime;
bool IsNewBar()
{
datetime thisBarOpenTime = Time[0];
if(thisBarOpenTime != lastBarOpenTime)
{
lastBarOpenTime = thisBarOpenTime;
return (true);
}
else
return (false);
}
Gosh, this is an old topic!
> Always use time..
Is the right answer
-BB-
Gosh, this is an old topic!
> Always use time..
Is the right answer
-BB-
Is time really that reliable ?
The granularity of Time[0] is in seconds, so if
within the first second you get two ticks, it would
count as two newbars. :/
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
How we know when a new bar is formed, please?
It's because I would want to stop analyse, trade...ets when something happened in the last bar.
Regards
Chris