[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trendlines



PureBytes Links

Trading Reference Links

> var: id1(0);
> 
> id1=tl_new(date[1],2200,close[36],date,0700,close);
> value1=tl_setextright(id1,false);
> value2=tl_setextleft(id1,false);

On most bars, date[1] is the same as date because date[1] is the date
one bar ago, not one day ago. So you need to store yesterday's date as a
variable. Also, to improve speed, you should restrict the code so it
only draws the trendline once a day instead of redrawing it on every
bar.

var: id1(0), date1(0);

if date[1] < date then date1 = date[1];

if date1 > 0 and time = 0700 then begin
   id1=tl_new(date1,2200,close[36],date,0700,close);
   value1=tl_setextright(id1,false);
   value2=tl_setextleft(id1,false);
end;

-- 
  Dennis