how to remove the delay?

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
User avatar
arnie
Posts:1593
Joined:11 Feb 2009
Location:Portugal
Has thanked: 481 times
Been thanked: 512 times
how to remove the delay?

Postby arnie » 09 Mar 2011

Hi.

How can I remove the delay that this countdown sometimes have when compared with the build in countdown?
This is for volume bar charts.

Is it possible?

I tried the intrabarpersist, but the delay continued.

Code: Select all

Variables:
TextSize (14),
txtCountdown (-1),
volumeCountdown (0);


if CurrentBar = 1 then begin
txtCountdown = Text_New_S(Date, Time, 0, " ");
Text_SetSize(txtCountdown, TextSize);
Text_SetStyle(txtCountdown, 0, 0);
end;

volumeCountdown = barinterval - ticks;

text_setlocation_s(txtCountdown, date, time_s, low);
text_setstring(txtCountdown, numtostr(volumeCountdown, 0) + "V");

SP
Posts:455
Joined:06 Feb 2006
Has thanked: 36 times
Been thanked: 283 times

Re: how to remove the delay?

Postby SP » 09 Mar 2011

Reset the counter at the opening tick of each new bar

Code: Select all

inputs:
HOffset (2),
VOffset (2),
TextSize (8),
AlertLevel (50),
TextColor (White);

vars:
txt (0),
str (" "),
Count (0),
CountTotal(0);


if BarStatus(1) = 0 then //Reset the counter at the opening tick of each new bar
begin
count = 0;
CountTotal = 0;
str = " ";
end;

count = upticks + downticks;
CountTotal = BarInterval - count;
str = " "+numtostr(CountTotal,0);

if Barnumber = 1 then
begin
txt = text_new(date,Calctime( Time, HOffset),close ,str);
text_SetStyle(txt,0,VOffset);
text_SetColor(txt,TextColor);
text_setsize (txt,textsize);

end else begin

text_SetString(txt,str);
text_SetColor(txt,TextColor);
text_SetLocation_s(txt,date,time_s, (h+l)/2);

end;

User avatar
arnie
Posts:1593
Joined:11 Feb 2009
Location:Portugal
Has thanked: 481 times
Been thanked: 512 times

Re: how to remove the delay?

Postby arnie » 09 Mar 2011

Thanks for the reply SP, but I'm sorry to say that the problem continues.

Having both plots side by side, sometimes my code updates in front of yours, other times your updates in front of mine, but both have from time to time delay when compared with MC's countdown.

User avatar
TJ
Posts:7354
Joined:29 Aug 2006
Location:Global Citizen
Has thanked: 993 times
Been thanked: 2100 times

Re: how to remove the delay?

Postby TJ » 09 Mar 2011

Hi.

How can I remove the delay that this countdown sometimes have when compared with the build in countdown?
This is for volume bar charts.

Is it possible?

I tried the intrabarpersist, but the delay continued.
how much delay you are observing?
1 tick? multiple ticks?

I have tested your code on my computer,
sometimes I can see a minuscule delay, but not all the time.
eg. the built-in timer moves, then followed immediately by the indicator.
the delay seems like a worm dragging its behind,
but the delay is never a tick difference.

User avatar
arnie
Posts:1593
Joined:11 Feb 2009
Location:Portugal
Has thanked: 481 times
Been thanked: 512 times

Re: how to remove the delay?

Postby arnie » 10 Mar 2011

Hi TJ.

From time to time I can see 10 ticks delay.
Fast moves for example, where 1000 contracts are traded in 1 second the delay can go higher then 10 ticks, though this same delay can disappear right at the next traded tick.


Return to “User Contributed Studies and Indicator Library”