2011年9月5日 星期一

最近一直找的code ,Tick countdown


{Tick Countdown
http://frankeasylanguage.blogspot.com/2008_02_01_archive.html}
//be sure you use "Tick Count" for volume
//works for both tick and share charts

input: 
AlertTicks(10), 
HOffset(3),
AlertText("tick"),
AlertColor(magenta),
NonAlertColor(magenta);

vars: 
txt(-1),
TicksLeft(0),
color(0);

if BarType = 0 then
begin
	//initiate the text variable
	if BarNumber = 1 then
	txt = text_new(date,time,close," ");

	TicksLeft = BarInterval - ticks;

	{if OneAlert(TicksLeft <= AlertTicks) then
	alert(NumToStr(TicksLeft,0)+"-"+AlertText+" alert");}

	//text color changes with alert
	if TicksLeft > AlertTicks then
	color = NonAlertColor
	else
	color = AlertColor;

	//reset at each tick
	text_SetLocation(txt,date,CalcTime(time,HOffset),close);
	text_SetString(txt,NumToStr(TicksLeft,0)+" " + AlertText);
	text_SetColor(txt,color);
end; 

沒有留言:

張貼留言