As far as i have tried, barstatus(1)=1 does not work.
Here's my workaround:
vars: intrabarpersist myCurrentBarNumber(0);
if currentBar<>myCurrentBarNumber then begin
// Do what ever you want
myCurrentBarNumber=currentBar;
end;
Aljafp
I don't understand how your code above relates to Barstatus(N)=1 . Barstatus =1 only tells you that it is a tick within a bar. Barstatus=2 tells you it is a tick on the close of the bar, Barstatus=0 tells you it is a tick on the open of the bar. Your code seems to assure that "//do what ever you want" only executes once per bar. But as far as I understand that has nothing to do with what barstatus does. It does correct for LastbaronChart triggering multiple times on the same bar in MC but what does that have to do with Barstatus=1 ? Please enlighten me.
J~
sry, my workaround is for barstatus(1)=0, the open of the bar...
my apologies
Maybe you can still adapt it to do it this way:
vars: intrabarpersist myCurrentBarNumber(0);
if currentBar<>myCurrentBarNumber then begin
myCurrentBarNumber=currentBar;
end
else if currentBar=myCurrentBarNumber then begin
// do whatever you want
// depending on how you want to treat the opening tick, you may also
// seperate the if else into 2 if statements, one after another.
end