Help with RecalcLastBarAfter

Questions about MultiCharts and user contributed studies.
aczk
Posts: 71
Joined: 08 Feb 2012
Has thanked: 8 times
Been thanked: 1 time

Help with RecalcLastBarAfter

Postby aczk » 06 Nov 2014

Hi All My indicator always leaves annoying lines on the chart, when I manually recalculate all studies its fine, but I thought this code could "RecalcLastBarAfter(25)" recalcualte after 25 sec !?!? doesn't seem to do it??

Here is my full code:

Code: Select all

[RecoverDrawings = false];
if not LastBarOnChart_s then #return;

Inputs:
DomLevels (5),CumTxtPos(6),
UpdateSpeed_seconds(0.1),
TLSize (4), Txtcol(white),
TxTSize (7);
Vars:
AskSum (0),
BidSum (0),
SumBidAskSizes(0);

array :
AskSizeLevel [10](0),BidSizeLevel [10](0);
RecalcLastBarAfter(UpdateSpeed_seconds);
repeat
if not dom_isconnected then
break;

value11 = 0;
value12 = 0;
for value1 = 0 to dom_askscount - 1 begin
value12 = dom_asksize(value1);
AskSizeLevel [value1] = dom_asksize(value1);
if value12 > value11 then value11 = value12;
end;

for value1 = 0 to dom_bidscount - 1 begin
value12 = dom_bidsize(value1);
BidSizeLevel [value1] = dom_bidsize(value1);
if value12 > value11 then value11 = value12;
end;

if 0 >= value11 then
break;

AskSum = array_sum (AskSizeLevel ,0,dom_askscount - 1);
BidSum = array_sum (BidSizeLevel ,0,dom_bidscount -1);

SumBidAskSizes = AskSum+BidSum;
//for value1 = 0 to dom_askscount - 1 begin
if dom_askscount =5 then begin
draw_DOM_CUM(
dom_askprice(1), dom_asksize(1), array_sum (AskSizeLevel ,0,value1),
SumBidAskSizes,value1, value11 ,
red,dom_askscount - 1 = value1,TLSize ,TxTSize,CumTxtPos);
end;

//for value1 = 0 to dom_bidscount - 1 begin
if dom_bidscount =5 then begin
draw_DOM_CUM(
dom_bidprice(1), dom_bidsize(1), array_sum (BidSizeLevel ,0,value1),
SumBidAskSizes,value1, value11 ,
color.dodgerblue,dom_bidscount - 1 = value1,TLSize ,TxTSize,-CumTxtPos);
end;
plot1("OK", "Status", white);
#return;
until(False);
plot1("Level2 data is not avaliable", "Status", red);

RecalcLastBarAfter(25);

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Help with RecalcLastBarAfter

Postby TJ » 06 Nov 2014

Hi All My indicator always leaves annoying lines on the chart, when I manually recalculate all studies its fine, but I thought this code could "RecalcLastBarAfter(25)" recalcualte after 25 sec !?!? doesn't seem to do it??

Here is my full code:
::
You should post a screenshot, with notes on the chart pointing out to the errors, so that people know what you are talking about.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Help with RecalcLastBarAfter

Postby TJ » 06 Nov 2014

You should add comments to your code, so that it can be read, instead of guess, what it does.

aczk
Posts: 71
Joined: 08 Feb 2012
Has thanked: 8 times
Been thanked: 1 time

Re: Help with RecalcLastBarAfter

Postby aczk » 06 Nov 2014

you are probably right, here is a screenshot...

hsi 31.png
(23.99 KiB) Downloaded 509 times
it adds the bid and asks of the DOM together to give an aggregate number. Tried a hundred things to try to get it not occasionally leaving some lines on the chart, to no avail.

Wonder if the RecalcLastBarAfter can do this?? Thx

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

Re: Help with RecalcLastBarAfter

Postby Henry MultiСharts » 10 Nov 2014

Hello aczk,

Please attach screenshot demonstrating the lines that are left when you recalculate the study.
The study is using some functions that are not prebuilt, therefore it cannot be compiled.
In PowerLanguage editor go to File->Export->export with dependent functions this study.
Please attach the pla file and the workspace you are using.


Return to “MultiCharts”