Welcome to the Traders Laboratory.

Coding Forum Collaborate, receive help, or discuss indicators and other coding-related topics

Like Tree1Likes
Reply
Old 09-23-2010, 09:06 AM   #41

BlowFish's Avatar

Join Date: Mar 2007
Location: In Da House
Posts: 3,233
Ignore this user

Thanks: 129
Thanked 1,080 Times in 708 Posts

Re: Trendline (EasyLanguage)

or for larger arrays use a loop, I think that's described in one of the docs tams did.

for n = arraysize-1 downto 1 arr[n+1] = arr[n];
arr[n] = variable;
BlowFish is offline  
Reply With Quote
Old 10-08-2010, 09:09 AM   #42

Join Date: Sep 2010
Posts: 4
Ignore this user

Thanks: 0
Thanked 0 Times in 0 Posts

Re: Trendline (EasyLanguage)

Hi guys - FYI I finally got my indicator working the way I intended it to. After many long nights and tons of mistakes. Thanks for your suggestions.
Tams likes this.
wiztrader is offline  
Reply With Quote
Old 07-05-2011, 09:38 AM   #43

Tradewinds's Avatar

Join Date: Nov 2008
Posts: 910
Ignore this user

Thanks: 379
Thanked 257 Times in 178 Posts

Re: Trendline (EasyLanguage)

Here is a tradestation help code example:

Code:
Variable: ID(-1);

If Low < Low[1] AND Close > High[1] Then Begin
  ID = TL_New(Date[1], Time[1], Low, Date, Time, Low);
  Value1 = TL_SetExtRight(ID, True);
 End;
The above code adds multiple trendlines to my chart. Every time the conditions are met, a new trendline is added to the chart. Each trendline is extended all the way to the current right hand edge of the chart. The reserved word "TL_SetExtRight" causes the trendline to extend continuously from the starting point to the right.

So, this means that multiple trend lines can be created from one trendline variable. A trendline variable is not confined to only having one trendline.
Tradewinds is offline  
Reply With Quote
Old 07-09-2011, 12:36 AM   #44

Tradewinds's Avatar

Join Date: Nov 2008
Posts: 910
Ignore this user

Thanks: 379
Thanked 257 Times in 178 Posts

Re: Trendline (EasyLanguage)

I've posted my completed EasyLanguage Auto Support and Resistance line indicator in the INDICATOR section. It uses trendlines instead of plots to draw horizontal lines on the chart.

http://www.traderslaboratory.com/for...uto-plots.html
Tradewinds is offline  
Reply With Quote
The Following User Says Thank You to Tradewinds For This Useful Post:
Tams (07-09-2011)
Old 03-16-2016, 07:11 AM   #45

Join Date: Feb 2016
Posts: 4
Ignore this user

Thanks: 1
Thanked 0 Times in 0 Posts

Re: Trendline (EasyLanguage)

I add some code to label the line in the chart (from day 1 to day 4 from today ) but I find that some letters is missed after it is enabled. For example, d2H = day 2 high, it display d2 without H. After a while, it will show up all. Any idea?


========================= ======

input:
lookback( 4 ),
Line.size ( 1 ),
Line.style ( 2 ),
color.h1( blue ),
color.l1( blue ),
color.h2( red ),
color.l2( red ),
color.h3( darkgreen ),
color.l3( darkgreen ),
color.h4( cyan ),
color.l4( cyan ),
hori_txdisp(10); {horizontal distance}

vars: d1Htid(0), d1Ltid(0),
d2Htid(0), d2Ltid(0),
d3Htid(0), d3Ltid(0),
d4Htid(0), d4Ltid(0);

// 1
if date <> date[1] and lookback = 1 then begin
value1 = tl_new_s(d , time_s , highd(1), d , time_s, highd(1 ));
value2 = tl_new_s(d , time_s, lowd(1), d , time_s, lowd(1));

tl_setcolor( value1, color.h1 );
TL_SetSize( value1, Line.size );
TL_SetStyle( value1, Line.style );

tl_setcolor( value2 , color.l1 );
TL_SetSize( value2, Line.size );
TL_SetStyle( value2, Line.style );
end;

if lookback = 1 then begin
tl_setend_s(value1, d , time_s , highd(1) );
tl_setend_s(value2, d , time_s , lowd(1) );
end;

// 2
if date <> date[1] and lookback = 2 then begin
value1 = tl_new_s(d , time_s , highd(1), d , time_s, highd(1 ));
value2 = tl_new_s(d , time_s, lowd(1), d , time_s, lowd(1));
value3 = tl_new_s(d , time_s , highd(2), d , time_s, highd(2 ));
value4 = tl_new_s(d , time_s, lowd(2), d , time_s, lowd(2));

tl_setcolor( value1, color.h1 );
TL_SetSize( value1, Line.size );
TL_SetStyle( value1, Line.style );

tl_setcolor( value2 , color.l1 );
TL_SetSize( value2, Line.size );
TL_SetStyle( value2, Line.style );

tl_setcolor( value3, color.h2 );
TL_SetSize( value3, Line.size );
TL_SetStyle( value3, Line.style );

tl_setcolor( value4 , color.l2 );
TL_SetSize( value4, Line.size );
TL_SetStyle( value4, Line.style );
end;
if lookback = 2 then begin
tl_setend_s(value1, d , time_s , highd(1) );
tl_setend_s(value2, d , time_s , lowd(1) );
tl_setend_s(value3, d , time_s , highd(2) );
tl_setend_s(value4, d , time_s , lowd(2) );
end;

// 3
if date <> date[1] and lookback = 3 then begin
value1 = tl_new_s(d , time_s , highd(1), d , time_s, highd(1 ));
value2 = tl_new_s(d , time_s, lowd(1), d , time_s, lowd(1));
value3 = tl_new_s(d , time_s , highd(2), d , time_s, highd(2 ));
value4 = tl_new_s(d , time_s, lowd(2), d , time_s, lowd(2));
value5 = tl_new_s(d , time_s , highd(3), d , time_s, highd(3 ));
value6 = tl_new_s(d , time_s, lowd(3), d , time_s, lowd(3 ));

tl_setcolor( value1, color.h1 );
TL_SetSize( value1, Line.size );
TL_SetStyle( value1, Line.style );

tl_setcolor( value2 , color.l1 );
TL_SetSize( value2, Line.size );
TL_SetStyle( value2, Line.style );

tl_setcolor( value3, color.h2 );
TL_SetSize( value3, Line.size );
TL_SetStyle( value3, Line.style );

tl_setcolor( value4 , color.l2 );
TL_SetSize( value4, Line.size );
TL_SetStyle( value4, Line.style );

tl_setcolor( value5, color.h3 );
TL_SetSize( value5, Line.size );
TL_SetStyle( value5, Line.style );

tl_setcolor( value6 , color.l3 );
TL_SetSize( value6, Line.size );
TL_SetStyle( value6, Line.style );
end;

if lookback = 3 then
begin
tl_setend_s(value1, d , time_s , highd(1) );
tl_setend_s(value2, d , time_s , lowd(1) );
tl_setend_s(value3, d , time_s , highd(2) );
tl_setend_s(value4, d , time_s , lowd(2) );
tl_setend_s(value5, d , time_s , highd(3) );
tl_setend_s(value6, d , time_s , lowd(3) );

if lastbaronchart then
begin
tl_setextright(value1, true);
tl_setextright(value2, true);
tl_setextright(value3, true );
tl_setextright(value4, true);
tl_setextright(value5, true);
tl_setextright(value6, true);
end;
end;


// 4
if date <> date[1] and lookback = 4 then begin
value1 = tl_new_s(d , time_s , highd(1), d , time_s, highd(1 ));
value2 = tl_new_s(d , time_s, lowd(1), d , time_s, lowd(1));
value3 = tl_new_s(d , time_s , highd(2), d , time_s, highd(2 ));
value4 = tl_new_s(d , time_s, lowd(2), d , time_s, lowd(2));
value5 = tl_new_s(d , time_s , highd(3), d , time_s, highd(3 ));
value6 = tl_new_s(d , time_s, lowd(3), d , time_s, lowd(3 ));
value7 = tl_new_s(d , time_s , highd(4), d , time_s, highd(4 ));
value8 = tl_new_s(d , time_s, lowd(4), d , time_s, lowd(4 ));

tl_setcolor( value1, color.h1 );
TL_SetSize( value1, Line.size );
TL_SetStyle( value1, Line.style );
//piv1tid = Text_New(date, Minlist(Time + hori_txdisp, SessionEndTime(0, 1) + hori_txdisp), highd(1) - (textscale * MinMove/PriceScale), "d1H");
d1Htid = Text_New(date, currenttime+hori_txdisp , highd(1), "d1H");

tl_setcolor( value2 , color.l1 );
TL_SetSize( value2, Line.size );
TL_SetStyle( value2, Line.style );
d1Ltid = Text_New(date, currenttime+hori_txdisp, lowd(1) , "d1L");

tl_setcolor( value3, color.h2 );
TL_SetSize( value3, Line.size );
TL_SetStyle( value3, Line.style );
d2Htid = Text_New(date, currenttime+hori_txdisp , highd(2), "d2H");

tl_setcolor( value4 , color.l2 );
TL_SetSize( value4, Line.size );
TL_SetStyle( value4, Line.style );
d2Ltid = Text_New(date, currenttime+hori_txdisp, lowd(2) , "d2L");

tl_setcolor( value5, color.h3 );
TL_SetSize( value5, Line.size );
TL_SetStyle( value5, Line.style );
d3Htid = Text_New(date, currenttime+hori_txdisp , highd(3), "d3H");

tl_setcolor( value6 , color.l3 );
TL_SetSize( value6, Line.size );
TL_SetStyle( value6, Line.style );
d3Ltid = Text_New(date, currenttime+hori_txdisp, lowd(3) , "d3L");

tl_setcolor( value7, color.h4 );
TL_SetSize( value7, Line.size );
TL_SetStyle( value7, Line.style );
d4Htid = Text_New(date, currenttime+hori_txdisp , highd(4), "d4H");

tl_setcolor( value8 , color.l4 );
TL_SetSize( value8, Line.size );
TL_SetStyle( value8, Line.style );
d4Ltid = Text_New(date, currenttime+hori_txdisp, lowd(4) , "d4L");
end;

if lookback = 4 then begin
tl_setend_s(value1, d , time_s , highd(1) );
tl_setend_s(value2, d , time_s , lowd(1) );
tl_setend_s(value3, d , time_s , highd(2) );
tl_setend_s(value4, d , time_s , lowd(2) );
tl_setend_s(value5, d , time_s , highd(3) );
tl_setend_s(value6, d , time_s , lowd(3) );
tl_setend_s(value7, d , time_s , highd(4) );
tl_setend_s(value8, d , time_s , lowd(4) );
end;
Attached Thumbnails
Trendline (EasyLanguage)-1.png  
ppcl is offline  
Reply With Quote

Reply

Tags
trendline

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:

Similar Threads
Thread Thread Starter Forum Replies Last Post
Easylanguage Auto Trendline Study raven4ns Technical Analysis 3 03-30-2009 04:50 PM
GBP/USD Trendline Breakout DannyBly Forex Trading Laboratory 3 07-06-2008 09:13 AM
Trendline methods waveslider Technical Analysis 0 06-26-2007 09:13 PM
Russell 2000 (IWM) Trendline Test MrPaul Technical Analysis 0 03-25-2007 12:53 PM
The Downsloping Trendline On The YM Bfbusa Technical Analysis 0 02-06-2007 11:54 PM

All times are GMT -4. The time now is 08:17 AM.
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
2006-2011 Traders Laboratory, All Rights Reserved.