Barstatus = -1

Questions about MultiCharts and user contributed studies.
maxmax68
Posts: 163
Joined: 20 Nov 2012
Has thanked: 55 times
Been thanked: 48 times

Barstatus = -1

Postby maxmax68 » 04 Jul 2013

Hi,
I have installed MultiCharts Version 8.7 Release (Build 7408)

To understand Barstatus behavior I took a chart with data1(1min) and data2(5min).
Then I inserted this code and looked the output.

Code: Select all

[IntrabarOrderGeneration=True];
once cleardebug;
vars:
intrabarpersist iClose1(0),
intrabarpersist iClose2(0),
recalcpersist rClose1(0),
recalcpersist rClose2(0);

iClose1=Close of data1;
iClose2=Close of data2;
rClose1=Close of data1;
rClose2=Close of data2;

print (time_s:0:0," : ",iClose1:0:3," ",iClose2:0:3," ",rClose1:0:3," ",rClose2:0:3," ",barstatus(1):0:0," - ",barstatus(2):0:0);
The output was like this:
...
140900 : 3.554 3.544 3.554 3.544 1 - -1
140900 : 3.554 3.544 3.554 3.544 1 - -1
140900 : 3.554 3.544 3.554 3.544 1 - -1
140900 : 3.554 3.544 3.554 3.544 1 - -1
140900 : 3.552 3.544 3.552 3.544 1 - -1
140900 : 3.552 3.544 3.552 3.544 1 - -1
140900 : 3.552 3.544 3.552 3.544 1 - -1
140900 : 3.552 3.544 3.552 3.544 1 - -1
140900 : 3.552 3.544 3.552 3.544 2 - -1
141000 : 3.552 3.546 3.552 3.546 0 - 0
141000 : 3.552 3.546 3.552 3.546 1 - 1
141000 : 3.552 3.546 3.552 3.546 1 - 1
141000 : 3.552 3.546 3.552 3.546 1 - 1
141000 : 3.552 3.546 3.552 3.546 1 - 1
141000 : 3.552 3.546 3.552 3.546 1 - 1
141000 : 3.552 3.546 3.552 3.546 1 - 1
141000 : 3.552 3.546 3.552 3.546 1 - 1
....

What I can see is that for data1(1min) on every tick I have the expected result:
0- first tick of the bar
1- intrabar tick
2- last tick of the bar
On the contrary for data2(5min) I have the expected results only every 5 minutes (140000,140500,141000 ...), while for 4 minutes (i.e. 140600,140700,140800,140900)
I have always barstatus(2)=-1.
Why ?
Any explanation would be greatly appreciated.
Massimo

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Barstatus = -1

Postby Henry MultiСharts » 05 Jul 2013

Hello Massimo,

That is expected behavior as the bars of your data series are closed at different time.
Only when close time of data1 and data2 match-you have the current barstatus of data2.
In order to always get the current barstatus of data2 please disable the option Realtime-History Matching.

maxmax68
Posts: 163
Joined: 20 Nov 2012
Has thanked: 55 times
Been thanked: 48 times

Re: Barstatus = -1

Postby maxmax68 » 08 Jul 2013

Hi Henry,
I tried in realtime with option disabled, and is ok, thanks.
Sometimes a barstatus=-1 comes out.
What's the meaning of -1. It stands for an error or what else?
Regards
Massimo

Code: Select all

[IntrabarOrderGeneration=True];
once cleardebug;

vars:
hi(0),
Lo(0),
intrabarpersist iClose1(0),
intrabarpersist iClose2(0),
recalcpersist rClose1(0),
recalcpersist rClose2(0);

iClose1=Average(Close of data2,2);
iClose2=Average(Close of data3,2);
rClose1=Close of data1;
rClose2=Close of data2;

print (time_s:6:0," : A1 ",iClose1:0:3," A2 ",iClose2:0:3," ",rClose1:0:3," ",rClose2:0:3," / ",barstatus(1):0:0," ",barstatus(2):0:0," ",barstatus(3):0:0);
Results for 1min-2min-5min:
...
151600 : A1 3.703 A2 3.702 3.702 3.702 / 1 1 1
151600 : A1 3.703 A2 3.702 3.702 3.702 / 1 1 1
151600 : A1 3.703 A2 3.702 3.702 3.702 / 1 1 1
151600 : A1 3.703 A2 3.702 3.702 3.702 / 1 1 1
151600 : A1 3.703 A2 3.702 3.702 3.702 / -1 1 1
151600 : A1 3.703 A2 3.701 3.702 3.702 / -1 -1 1
151600 : A1 3.703 A2 3.701 3.702 3.702 / 2 2 1
151700 : A1 3.701 A2 3.701 3.700 3.700 / 0 0 1
151700 : A1 3.701 A2 3.701 3.700 3.700 / 1 1 1
151700 : A1 3.701 A2 3.701 3.700 3.700 / 1 1 1
151700 : A1 3.701 A2 3.701 3.700 3.700 / 1 1 1
151700 : A1 3.701 A2 3.701 3.700 3.700 / 1 1 1
....
151700 : A1 3.701 A2 3.701 3.700 3.700 / 1 1 1
151700 : A1 3.701 A2 3.701 3.698 3.700 / 1 1 1
151700 : A1 3.700 A2 3.700 3.698 3.698 / 1 1 1
151700 : A1 3.700 A2 3.700 3.698 3.698 / -1 1 1
151700 : A1 3.700 A2 3.700 3.698 3.698 / -1 1 1
151700 : A1 3.700 A2 3.700 3.698 3.698 / 2 1 1
151800 : A1 3.700 A2 3.700 3.698 3.698 / 0 1 1
151800 : A1 3.700 A2 3.700 3.698 3.698 / 1 1 1
151800 : A1 3.700 A2 3.700 3.702 3.698 / 1 1 1
151800 : A1 3.702 A2 3.702 3.702 3.702 / 1 1 1
....

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Barstatus = -1

Postby Henry MultiСharts » 24 Oct 2013

Hi Henry,
I tried in realtime with option disabled, and is ok, thanks.
Sometimes a barstatus=-1 comes out.
What's the meaning of -1. It stands for an error or what else?
Regards
Massimo

Code: Select all

[IntrabarOrderGeneration=True];
once cleardebug;

vars:
hi(0),
Lo(0),
intrabarpersist iClose1(0),
intrabarpersist iClose2(0),
recalcpersist rClose1(0),
recalcpersist rClose2(0);

iClose1=Average(Close of data2,2);
iClose2=Average(Close of data3,2);
rClose1=Close of data1;
rClose2=Close of data2;

print (time_s:6:0," : A1 ",iClose1:0:3," A2 ",iClose2:0:3," ",rClose1:0:3," ",rClose2:0:3," / ",barstatus(1):0:0," ",barstatus(2):0:0," ",barstatus(3):0:0);
Results for 1min-2min-5min:
...
151600 : A1 3.703 A2 3.702 3.702 3.702 / 1 1 1
151600 : A1 3.703 A2 3.702 3.702 3.702 / 1 1 1
151600 : A1 3.703 A2 3.702 3.702 3.702 / 1 1 1
151600 : A1 3.703 A2 3.702 3.702 3.702 / 1 1 1
151600 : A1 3.703 A2 3.702 3.702 3.702 / -1 1 1
151600 : A1 3.703 A2 3.701 3.702 3.702 / -1 -1 1
151600 : A1 3.703 A2 3.701 3.702 3.702 / 2 2 1
151700 : A1 3.701 A2 3.701 3.700 3.700 / 0 0 1
151700 : A1 3.701 A2 3.701 3.700 3.700 / 1 1 1
151700 : A1 3.701 A2 3.701 3.700 3.700 / 1 1 1
151700 : A1 3.701 A2 3.701 3.700 3.700 / 1 1 1
151700 : A1 3.701 A2 3.701 3.700 3.700 / 1 1 1
....
151700 : A1 3.701 A2 3.701 3.700 3.700 / 1 1 1
151700 : A1 3.701 A2 3.701 3.698 3.700 / 1 1 1
151700 : A1 3.700 A2 3.700 3.698 3.698 / 1 1 1
151700 : A1 3.700 A2 3.700 3.698 3.698 / -1 1 1
151700 : A1 3.700 A2 3.700 3.698 3.698 / -1 1 1
151700 : A1 3.700 A2 3.700 3.698 3.698 / 2 1 1
151800 : A1 3.700 A2 3.700 3.698 3.698 / 0 1 1
151800 : A1 3.700 A2 3.700 3.698 3.698 / 1 1 1
151800 : A1 3.700 A2 3.700 3.702 3.698 / 1 1 1
151800 : A1 3.702 A2 3.702 3.702 3.702 / 1 1 1
....
maxmax68, do you have barstatus=-1 with Realtime-History Matching disabled.


Return to “MultiCharts”