PureBytes Links
Trading Reference Links
|
still same problem, it keeps the text on previous bars.
but i corrected the problem with text_setlocation function.
here is the correct version:
var: min_left ( "" ), { minutes left in bar }
ref ( 0 ); { ref # of text object }
{ initialize text object }
if currentbar = 1 then
ref = text_new(date,time,close, " " );
if lastbaronchart then begin
{ string for text object }
min_left = "< " + numtostr(timetominutes(time) - timetominutes(currenttime),0);
{ move text to lastbaronchart }
text_setlocation(ref,date,time+1,close);
text_setstring(ref,min_left);
text_setstyle( ref, 0, 2 );
text_setcolor(ref, tool_yellow );
end;
bilo.
ps. i use webtime utility to synch my computer clock to atomic clock every time computer starts.
----- Original Message -----
From: BobR
To: Bilo Selhi ; Omega List
Sent: Friday, March 28, 2003 11:05 AM
Subject: Re: minutes left in bar indicator exercize
This is a followup with some corrections on the code posted earlier.
Try this. Create it as a ShowMe not an Indicator. This solves the drawing
problem and counts down like 2,1,0 for a 3 minute bar and for 5 minute bar
4,3,2,1,0. It may still need some tweaking by someone who knows coding
better than I.
bobr
{Minutes_In_Bar coded by bobr bobrabcd@xxxxxxxxxxxxx 3/28/03}
Var: ref(0);
Var: ref2(0);
var: min_left("< ");
var: ct(0);
ct=timetominutes(currenttime);
min_left=("< "
+NumToStr(-barinterval+1+timetominutes(currenttime)-ct[1],0));
ref2=Text_New(D,T,C," ");
If lastbaronchart then begin
if value1=0 then begin
ref=Text_New(D,T,C," "); {get id}
value1=1;
end;
value2=Text_Delete(ref);
ref=Text_New(D,T+1,C, min_left);
Text_SetStyle(ref,0,2);
Text_SetColor(ref,7);
End;
----- Original Message -----
From: "Bilo Selhi" <biloselhi@xxxxxxxxxxx>
To: "Omega List" <omega-list@xxxxxxxxxx>
Sent: Thursday, March 27, 2003 9:19 AM
Subject: minutes left in bar indicator exercize
> here is a handy indicator that supposed to draw a text object that
displays minutes left in the bar to the right
> of the close of the last bar on chart. for example if time frame is 10
minutes, it will count from 10 to 1
> 10,9,8....1 to the right of the close of the bar telling you how many
minutes are left in the bar.
>
> however it does not work properly and also draws not only on last bar on
chart but on all previous bars
> in real time.
>
> could someone fix this problem to make it display only on the last bar in
real time, if possible.
> can be sort of a good exercise in EL.
>
> setup:
> *** set "space to the right" to 10 bars.
> load 5 min chart in real time.
> load indicator.
> observe "< n" to the right of the close, where n = number of minutes left
in the bar.
>
> post solution here.
>
> good trading.
> bilo.
|