When you use iBarShift it's for the shift in bars from a specified date (your trying to get the shift from a time stamp of 0 or Jan 1 1970). What you want is the pre-defined variable bars. It will increase every time there is a new bar. You could just replace the barcount variable with Bars and it should sort it out.
heelflip43:
When you use iBarShift it's for the shift in bars from a specified date (your trying to get the shift from a time stamp of 0 or Jan 1 1970). What you want is the pre-defined variable bars. It will increase every time there is a new bar. You could just replace the barcount variable with Bars and it should sort it out.
bars is not reliable for a similar reason as I stated above. USE time . . .
When you use iBarShift it's for the shift in bars from a specified date (your trying to get the shift from a time stamp of 0 or Jan 1 1970). What you want is the pre-defined variable bars. It will increase every time there is a new bar. You could just replace the barcount variable with Bars and it should sort it out.
I normally do, I just suggested it because he was using bars anyway. This is the bit of code which I use:
static datetime currTime; if(currTime == iTime(Symbol(), 0, 0))return; currTime = iTime(Symbol(), 0, 0));
bool NewBar(string Symb,int Perd){ static datetime LastTime; datetime Time0=iTime(Symb,Perd,0); if(LastTime!=Time0){LastTime=Time0; return(true);} }Same things I guess. The Poster could just search Google for Once_Per_Bar and find all the millions of ways it's been done before.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Any insights ?
Thank you for your time =]