Page 1 of 1

BarStatus ?

Posted: Mar 26 2008
by SUPER
It seems that function BarStatus(1)=1 does not work same as TS, it works more like LastBarOnChart. If applied to a strategy it does not show historical orders-only works in realtime.


Input: Length(10);

If BarStatus(1)=1 then Buy Next Bar at HighestFC(C,Length) + 1 Point Stop;

SetExitOnClose;

Re: BarStatus ?

Posted: Mar 26 2008
by drwar
[quote]It seems that function BarStatus(1)=1 does not work same as TS, it works more like LastBarOnChart. If applied to a strategy it does not show historical orders-only works in realtime.


Input: Length(10);

If BarStatus(1)=1 then Buy Next Bar at HighestFC(C,Length) + 1 Point Stop;

SetExitOnClose;[/quote]

I don't know why you would check for BarStatus(1)=1 ? As I understand it , All that tells you is that Data stream 1 had a tick come in. More frequently, barstatus is used to check for the close of a bar on a data stream i.e. Barstatus(1)=2 .

J~

Posted: Mar 26 2008
by aljafp
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;

Posted: Mar 26 2008
by drwar
[quote]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;[/quote]

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~

Posted: Mar 26 2008
by aljafp
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

Re: BarStatus ?

Posted: Mar 27 2008
by SUPER
It seems that function BarStatus(1)=1 does not work same as TS, it works more like LastBarOnChart. If applied to a strategy it does not show historical orders-only works in realtime.


Input: Length(10);

If BarStatus(1)=1 then Buy Next Bar at HighestFC(C,Length) + 1 Point Stop;

SetExitOnClose;
I don't know why you would check for BarStatus(1)=1 ? As I understand it , All that tells you is that Data stream 1 had a tick come in. More frequently, barstatus is used to check for the close of a bar on a data stream i.e. Barstatus(1)=2 .

J~
Here's definition of BarStatus(n)

BarStatus(1)=2 - closing tick of the a bar
BarStatus(1)=1 - a tick within a bar
BarStatus(1)=0 - opening tick of a bar

There are instances where I want to update my variables within a bar, the example I qoted is just for demonstration purpose only to show barstatus bug.

Posted: Mar 27 2008
by drwar
Super
We agree on the definition. I don't understand how your example exposes a bug. Could you explain what it does. It looks to me that your statement should be executed on every tick inside the bar.

J~

Posted: Mar 27 2008
by SUPER
Super
We agree on the definition. I don't understand how your example exposes a bug. Could you explain what it does. It looks to me that your statement should be executed on every tick inside the bar.

J~
Try out the strategy I have posed in my first thread and one without barstatus(1)=1 and you will see the difference.

i.e, Input: Length(10);

Buy Next Bar at HighestFC(C,Length) + 1 Point Stop;

SetExitOnClose;

Posted: Apr 01 2008
by Marina Pashkova
Hi SUPER,

The problem has been confirmed. We will work to fix it.

Regards.

Posted: Apr 01 2008
by SUPER
Thanks

Posted: Apr 14 2008
by SUPER
Barstatus(1)=1 works fine with intrabarordergeneration=true, however not with intrabarordergeneration disabled.

MC Beta 3.0.1195.6635

Posted: Apr 16 2008
by SUPER
Barstatus(1)=1 works fine with intrabarordergeneration=true, however not with intrabarordergeneration disabled.

MC Beta 3.0.1195.6635

Same problem exist with Final version 3.0

Conclusion: Bug not fixed