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
. . .
This one pops up just fine. So i though it might be gotta do with the NewBar() one.
I had been staring at this one for so long and yet no clue.
First, you probably shouldn't use iBarShift() in the way you have. iBarShift(NULL,0,0) returns the shift to the last bar on the chart because you are giving it a date of 0. You aren't interested in the last bar; instead, you want to know if the current bar is actually a new bar. Second, the better way to determine whether a bar is a new bar is to test the bar's time with the last recorded bar time. If the bar's time is equal to the last recorded bar time, then it is not a new bar. See some explanation here and here. Based on those explanations, here is some example code.
Example of a variable in start():
i think the new bar is already changing when you call it the first time int count HAS CHANGE ITS VALUE
then when you call it twice it not detect a new bar