Stange barstatus ...  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
Smoky
Posts: 517
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 99 times
Been thanked: 121 times

Stange barstatus ...

Postby Smoky » 20 May 2017

I use an indicator with multi datas 1-4 and this code show a mistake :

Code: Select all

if barstatus(1)=0 then
begin
messagelog(Symbol_CurrentBar data1); // print only one time, and only last bar !
end;


if barstatus(3)=0 then
begin
messagelog(Symbol_CurrentBar data3); // never print !

end;

if barstatus(4)=0 then
begin
messagelog(Symbol_CurrentBar data4); // never print !

end;
at the end of indicator if i add this line :

Code: Select all

MESSAGELOG(Symbol_CurrentBar data1);
all bar of data1 are printing !

?

User avatar
Angelina MultiСharts
Posts: 260
Joined: 28 Dec 2016
Has thanked: 28 times
Been thanked: 66 times

Re: Stange barstatus ...

Postby Angelina MultiСharts » 22 May 2017

Hello Smoky,

Code: Select all

if barstatus(1)=0
Such condition can only be true in real-time, so it will only print values for bars formed in real-time. "Update on every tick" option has to be enabled.

By design the studies are calculated at every tick of the first data series.

So, for example,

Code: Select all

if barstatus(3)=0
condition will be true only if a tick of data1 comes right after first tick of data3 and before the second one.

Also, please check the Realtime-History Matching, it can make the fulfillment of second and third conditions even less likely.

User avatar
Smoky
Posts: 517
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 99 times
Been thanked: 121 times

Re: Stange barstatus ...[SOLVED]  [SOLVED]

Postby Smoky » 22 May 2017

Thanks, sure, all works fine in real-time but not when you load a chart...


Return to “MultiCharts”