BarStatus ?

Questions about MultiCharts and user contributed studies.
SUPER
Posts: 622
Joined: 03 Mar 2007
Has thanked: 99 times
Been thanked: 80 times

BarStatus ?

Postby SUPER » 26 Mar 2008

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;

drwar
Posts: 218
Joined: 31 Jul 2005

Re: BarStatus ?

Postby drwar » 26 Mar 2008

[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~

aljafp
Posts: 184
Joined: 28 Oct 2005
Been thanked: 1 time

Postby aljafp » 26 Mar 2008

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;

drwar
Posts: 218
Joined: 31 Jul 2005

Postby drwar » 26 Mar 2008

[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~

aljafp
Posts: 184
Joined: 28 Oct 2005
Been thanked: 1 time

Postby aljafp » 26 Mar 2008

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

SUPER
Posts: 622
Joined: 03 Mar 2007
Has thanked: 99 times
Been thanked: 80 times

Re: BarStatus ?

Postby SUPER » 27 Mar 2008

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.

drwar
Posts: 218
Joined: 31 Jul 2005

Postby drwar » 27 Mar 2008

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~

SUPER
Posts: 622
Joined: 03 Mar 2007
Has thanked: 99 times
Been thanked: 80 times

Postby SUPER » 27 Mar 2008

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;

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 01 Apr 2008

Hi SUPER,

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

Regards.

SUPER
Posts: 622
Joined: 03 Mar 2007
Has thanked: 99 times
Been thanked: 80 times

Postby SUPER » 01 Apr 2008

Thanks

SUPER
Posts: 622
Joined: 03 Mar 2007
Has thanked: 99 times
Been thanked: 80 times

Postby SUPER » 14 Apr 2008

Barstatus(1)=1 works fine with intrabarordergeneration=true, however not with intrabarordergeneration disabled.

MC Beta 3.0.1195.6635

SUPER
Posts: 622
Joined: 03 Mar 2007
Has thanked: 99 times
Been thanked: 80 times

Postby SUPER » 16 Apr 2008

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


Return to “MultiCharts”