Ver 5 beta 2 - Barstatus command

Questions about MultiCharts and user contributed studies.
drwar
Posts: 218
Joined: 31 Jul 2005

Ver 5 beta 2 - Barstatus command

Postby drwar » 11 Nov 2008

This still doesn't work properly. Here is some very simple code you can use to test. Obviously apply this to a chart with two data streams. I tested it with Data stream 1 = 343 volume bars. Data Stream 2 = 2401 volume bars.

IF Barstatus(1)=2 then Print(file("c:\BarstatusOne.txt"),time_s);
IF Barstatus(2)=2 then Print(file("c:\BarStatusTwo.txt"),time_s);


It does several things incorrectly.

1) On history bars, It randomly triggers twice on the same bar close for datastream 2 . Does not do this for dataStream 1 to which it is applied.

2) When it is on the lastbar(bar being built) of the chart. It thinks every tick is the close of the datastream 2. It does not do this for DataStream number 1 to which the indicator is applied.

Please fix this. we need it to work correctly

J~

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

Postby Marina Pashkova » 12 Nov 2008

Hello,

What symbol are you using? What is its normal volume?

Could you log the following:
----

IF Barstatus(1)=2 then Print(file("c:\BarstatusOne.txt"), currentbar of data1, " ", time_s of data1);
IF Barstatus(2)=2 then Print(file("c:\BarStatusTwo.txt"), currentbar of data2, " ", time_s of data2);
-----

And mark the areas that don't look right.

drwar
Posts: 218
Joined: 31 Jul 2005

Postby drwar » 12 Nov 2008

[quote]Hello,

What symbol are you using? What is its normal volume?

Could you log the following:
----

IF Barstatus(1)=2 then Print(file("c:\BarstatusOne.txt"), currentbar of data1, " ", time_s of data1);
IF Barstatus(2)=2 then Print(file("c:\BarStatusTwo.txt"), currentbar of data2, " ", time_s of data2);
-----

And mark the areas that don't look right.[/quote]

The symbol is ES #F. As you know its volume is high but then again these are volume bars and should account for that. However , now that you mention it on lower time frames the volume bars are off when high volume trades come in. So maybe thats what your getting at. I will log the results shortly to capture realtime and post the marked up files later tonight.

J~

drwar
Posts: 218
Joined: 31 Jul 2005

Postby drwar » 12 Nov 2008

[quote]Hello,

What symbol are you using? What is its normal volume?

Could you log the following:
----

IF Barstatus(1)=2 then Print(file("c:\BarstatusOne.txt"), currentbar of data1, " ", time_s of data1);
IF Barstatus(2)=2 then Print(file("c:\BarStatusTwo.txt"), currentbar of data2, " ", time_s of data2);
-----

And mark the areas that don't look right.[/quote]

Marina
Both files are attached . I did not bother to mark it up because it is obvious it is completely wrong. Look at BarStatusTwo.txt . It is more obvious, it is on the higher time frame (Data1 = 343volume bars,data 2=2401 volume bars) . data2 prints everytime thru the routine . You can see that because it prints even when the current bar number has not changed. data1 also prints eveytime thru althougth a little less obvious because it only prints twice when there is a new data two bar.

J~
Attachments
BarstatusOne.txt
(10.49 KiB) Downloaded 328 times
BarStatusTwo.txt
(10.84 KiB) Downloaded 321 times

drwar
Posts: 218
Joined: 31 Jul 2005

Postby drwar » 26 Nov 2008

Push to top

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

Postby Marina Pashkova » 27 Nov 2008

Hi Jerry,

The behavior that you are describing is not an MC bug. It's behavior is simply different from that of TS.

In TS BarStatus -1 is returned when: "an error occurred while executing the reserved word" The lines where barstatus=-1 are simply not shown in TS.

MC cannot return barstatus -1, hence the difference.

The outputs below will help you understand what exactly is going on:

Code: Select all


MC

Data1> 1.00 944.00
Data2> 1.00 944.00
Data1> 2.00 945.00
Data2> 1.00 944.00
Data1> 3.00 946.00
Data2> 1.00 944.00
Data1> 4.00 947.00
Data2> 1.00 944.00
Data1> 5.00 948.00
Data2> 1.00 944.00
Data1> 6.00 949.00
Data2> 1.00 944.00
Data1> 7.00 950.00
Data2> 1.00 944.00
Data1> 8.00 951.00
Data2> 2.00 951.00
Data1> 9.00 952.00
Data2> 2.00 951.00
Data1> 10.00 953.00
Data2> 2.00 951.00
Data1> 11.00 954.00
Data2> 2.00 951.00
Data1> 12.00 955.00
Data2> 2.00 951.00
Data1> 13.00 956.00
Data2> 2.00 951.00
Data1> 14.00 957.00
Data2> 2.00 951.00
Data1> 15.00 958.00


-----------
TS

Data1> 1.00 944.00
Data2> 1.00 944.00
Data1> 2.00 945.00
Data1> 3.00 946.00
Data1> 4.00 947.00
Data1> 5.00 948.00
Data1> 6.00 949.00
Data1> 7.00 950.00
Data1> 8.00 951.00
Data2> 2.00 951.00
Data1> 9.00 952.00
Data1> 10.00 953.00
Data1> 11.00 954.00
Data1> 12.00 955.00
Data1> 13.00 956.00
Data1> 14.00 957.00
Data1> 15.00 958.00
Data2> 3.00 958.00

-------

TS (with barstatus -1 is shown)

Data1> 1.00 944.00
Data2> 1.00 944.00
Data1> 2.00 945.00
Data2> 1.00 944.00 -1.00
Data1> 3.00 946.00
Data2> 1.00 944.00 -1.00
Data1> 4.00 947.00
Data2> 1.00 944.00 -1.00
Data1> 5.00 948.00
Data2> 1.00 944.00 -1.00
Data1> 6.00 949.00
Data2> 1.00 944.00 -1.00
Data1> 7.00 950.00
Data2> 1.00 944.00 -1.00
Data1> 8.00 951.00
Data2> 2.00 951.00
Data1> 9.00 952.00
Data2> 2.00 951.00 -1.00
Data1> 10.00 953.00
Data2> 2.00 951.00 -1.00
Data1> 11.00 954.00
Data2> 2.00 951.00 -1.00
Data1> 12.00 955.00
Data2> 2.00 951.00 -1.00
Data1> 13.00 956.00
Data2> 2.00 951.00 -1.00
Data1> 14.00 957.00
Data2> 2.00 951.00 -1.00
Data1> 15.00 958.00

drwar
Posts: 218
Joined: 31 Jul 2005

Postby drwar » 27 Nov 2008

Marina

You can say that the behavior is different than TS but the fact remains IT DOES NOT WORK AS PER YOUR OWN HELP FILE. It cannot detect the close of data2 therefore indicators that need to calculate on the close of data2 do not calculate properly. This used to work fine, it no longer does.

Here is an excerpt from your help file:

BarStatus
Returns a numerical value, indicating the status of the most recent tick in the current bar of the specified data series.
A value of 0 indicates that the tick is the opening tick of the bar, 1 indicates that the tick is within the bar, and 2 indicates that the tick is the closing tick of the bar.

Look at Barstatustwo.txt it should only print once per bar, on every close of data2 but it prints everytime thru. It can't separate the close of data2 from any tick on data2. The files you posted were probably done with minute data not tick/volume data. The problem I am showing is with TICK/volume bars not minute bars.

Please look at this unless this is corrected to work as it once did we cannot use multiple data streams and then there is no advantage for us using MC.

J~

drwar
Posts: 218
Joined: 31 Jul 2005

Postby drwar » 27 Nov 2008

Marina
We could go round and round about how it is supposed to work even tho I say it does not work like your own help file indicates. So let me turn the question around.

How do you detect the close of a bar on Data2 when the indicator is applied to data1.

Barstatu(2)=2 used to do that, now it does not. How else can it be done so our indicators will calculate correctly?

J~

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

Postby Marina Pashkova » 28 Nov 2008

Hi Jerry,

The situation you are talking about is a consequence of the behavior that I mentioned earlier. Once it is changed you will see no extra print output on the bars.

Regards.


Return to “MultiCharts”