PureBytes Links
Trading Reference Links
|
hello,
i just want to draw a trendline from a fixed date.
(it should be the mirror trendline from the previous
swing)
this works so far but as on the attached chart there
are plenty of lines drawn by my code.
i have no clue why.
maybe someone could have a look at the code and tell
me, where my mistake is.
thanks alexandra
Input: LastMove(1), Date1(1000101),
Time1(Sess1EndTime), Date2
(1000101), Time2(Sess1EndTime) , Line1(1) ;
VAR: Bar1(999999), Bar2(999999), bar2val(0),
tlid(0);
If Date1 = Date and Time1 = Time then bar1 =
currentbar;
If Date2 = Date and Time2 = Time then begin
bar2 = barnumber;
if LastMove = 1 then begin
bar2val = h;
value1 = H - L[currentbar - bar1];
value2 = currentbar - bar1;
value3 = value1/value2;
end;
if LastMove = -1 then begin
bar2val = l;
value1 = H[currentbar - bar1] - L;
value2 = currentbar - bar1;
value3 = value1/value2;
end;
end;
If currentbar > bar2 and currentbar - bar2 < 50 then
begin
value4 = (currentbar - bar2)*value3;
if LastMove = 1 then begin
TLID = TL_New(date2, time, bar2val, date, Time,bar2val
- value4 );
TL_SetColor(TLID, yellow);
TL_SetSize(TLID, 0);
TL_SetExtRight(TLID, false);
If close[1] > TL_GetValue(TLID, Date[1], Time[1])
then begin
TL_setend(TLID, date[1], time[1], bar2val - value4);
TL_setextright(TLID,false);
end;
end;
end;
|