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

Trendlines problem



PureBytes Links

Trading Reference Links

Dear coders

I have been running into a strange problem with Ts4 trendline objects, I

wrote the following simple showme to plot the swing highs and a
trendline starting from last of them.

Inputs:Str(5);
Vars:tl(0);

Value1=SwingHighBar(1,H, STR,STR+1);

if CurrentBar=10 then begin
 tl=TL_New(D[5], T[5], H, D, T, H);
 TL_SetExtRight(tl, True);
end;

If Value1<>-1 then begin
 TL_SetEnd(tl, D[Value1-1], T[Value1-1], H[Value1]);
 TL_SetBegin(tl, D[Value1], T[Value1], H[Value1]);
 TL_SetExtRight(tl, True);
 Plot1[Value1](H[Value1],"SH");
end;

The problem is that sometimes the trendline plots and sometimes don't.
I tried on the same intraday data with different time and tick
compressions and as I said some time the Trendline plots and sometime
don't.
Just changing the compression of data makes appear/disappear the
problem, the error code was -5 or -9 for the variable tl but I couldn't
figure out what is the "real" problem.
Did anyone experience something similar or can shed some light?

ps. I apologize with CL users for cross posting.

--
Best regards

Massimo Ciarafoni


"Whatever you can do or dream you can, begin it. Boldness has genius,
magic and power in it. Begin it now." - Goethe