Welcome to the Traders Laboratory.

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

Like Tree1Likes
Reply
Old 04-26-2009, 03:07 PM   #1

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 4,052
Ignore this user

Thanks: 2,275
Thanked 1,661 Times in 1,010 Posts

Trendline (EasyLanguage)

This thread is about using EasyLanguage to draw trendlines on a chart.





TL_New

Displays a trendline, with the specified starting and ending points,
on the chart that the study is based on;

returns a trendline-specific ID number, required to modify the trendline.

Usage

TL_New (sDate, sTime, sPriceValue, eDate, eTime, ePriceValue)

Parameters

sDate - a numerical expression specifying the trendline starting point date;
the date is indicated in the YYYMMdd format,
where YYY is the number of years since 1900,
MM is the month,
and dd is the day of the month

sTime - a numerical expression specifying the trendline starting point time;
the time is indicated in the 24-hour HHmm format,
where 1300 = 1:00 PM

sPriceValue - a numerical expression specifying the trendline starting point price value
(vertical position, corresponding to a value on the price scale of a chart)

eDate - a numerical expression specifying the trendline ending point date

eTime - a numerical expression specifying the trendline ending point time

ePriceValue - a numerical expression specifying the trendline ending point price value

Example

Display a trendline,
that begins at 9:00 AM at a price value of 1381,
and ends at 3:00 PM at a price value of 1337,
on January 17th, 2008,
on the chart that the study is based on:

Value1 = TL_New( 1080117, 900, 1381, 1080117, 1500, 1337);





source: EasyLanguage Manual
Tams is offline  
Reply With Quote
The Following 3 Users Say Thank You to Tams For This Useful Post:
aaa (04-26-2009), kh_model (08-21-2010), livernik (07-06-2011)
Old 04-26-2009, 04:37 PM   #2

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 4,052
Ignore this user

Thanks: 2,275
Thanked 1,661 Times in 1,010 Posts

Re: Trendline (EasyLanguage)

examples of trendline

How to Draw a Tape
http://www.traderslaboratory.com/for...tape-5646.html

Tams is offline  
Reply With Quote
The Following 2 Users Say Thank You to Tams For This Useful Post:
daedalus (05-03-2009), livernik (07-06-2011)
Old 04-26-2009, 05:10 PM   #3

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 4,052
Ignore this user

Thanks: 2,275
Thanked 1,661 Times in 1,010 Posts

Re: Trendline (EasyLanguage)

Here's an example of
drawing a trendline
at the highest high and the lowest low of X days back.


it utilizes the highD and lowD functions to obtain the highest/lowest prices.





MC version can be used on sub-minute charts.
i.e. tick, seconds, volume bar, etc.
Attached Thumbnails
Trendline (EasyLanguage)-hl_bar.jpg  
Attached Files
File Type: txt HL_bar_(TS).txt (763 Bytes, 419 views)
File Type: txt HL_bar_(MC).txt (806 Bytes, 304 views)

Last edited by Tams; 04-26-2009 at 05:25 PM.
Tams is offline  
Reply With Quote
The Following 7 Users Say Thank You to Tams For This Useful Post:
aaa (04-26-2009), daedalus (05-03-2009), kh_model (08-21-2010), livernik (07-06-2011), TIKITRADER (07-30-2009), ValueTrader (07-14-2011)
Old 04-26-2009, 05:40 PM   #4
aaa

aaa's Avatar

Join Date: Jun 2008
Location: Switzerland
Posts: 466
Ignore this user

Thanks: 243
Thanked 354 Times in 151 Posts

Re: Trendline (EasyLanguage)

An other great Topic from Tams
aaa is offline  
Reply With Quote
Old 05-03-2009, 08:44 AM   #5
aaa

aaa's Avatar

Join Date: Jun 2008
Location: Switzerland
Posts: 466
Ignore this user

Thanks: 243
Thanked 354 Times in 151 Posts

Re: Trendline (EasyLanguage)

I think that I understand TL_New but no way to extend extend lines on the right !!!

I've coded something horrible and complicate , but it works

Tams, If you have time to correct it I will appreciate it a lot

Code:
// HL bar (MC)
// version: beta 0.1
// author: TAMS
// date: 20090426
// license: public use
// description: this indicator draws a trendline 
// at the highest high and lowest low of X days back

input:
lookback(	1	),
Line.size (	1 	),
Line.style (	1	),
color.tl.h(	blue	),
color.tl.l(	red	);
// 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.tl.h );
	TL_SetSize(  value1, Line.size  );
	TL_SetStyle( value1, Line.style );		
	
	tl_setcolor(  value2 , color.tl.l );
	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.tl.h );
	TL_SetSize(  value1, Line.size  );
	TL_SetStyle( value1, Line.style );		
	
	tl_setcolor(  value2 , color.tl.l );
	TL_SetSize(   value2, Line.size   );
	TL_SetStyle(  value2, Line.style  );
	
	tl_setcolor( value3, color.tl.h );
	TL_SetSize(  value3, Line.size  );
	TL_SetStyle( value3, Line.style );		
	
	tl_setcolor(  value4 , color.tl.l );
	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.tl.h );
	TL_SetSize(  value1, Line.size  );
	TL_SetStyle( value1, Line.style );		
	
	tl_setcolor(  value2 , color.tl.l );
	TL_SetSize(   value2, Line.size   );
	TL_SetStyle(  value2, Line.style  );
	
	tl_setcolor( value3, color.tl.h );
	TL_SetSize(  value3, Line.size  );
	TL_SetStyle( value3, Line.style );		
	
	tl_setcolor(  value4 , color.tl.l );
	TL_SetSize(   value4, Line.size   );
	TL_SetStyle(  value4, Line.style  );
	
	tl_setcolor( value5, color.tl.h );
	TL_SetSize(  value5, Line.size  );
	TL_SetStyle( value5, Line.style );		
	
	tl_setcolor(  value6 , color.tl.l );
	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)  );
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.tl.h );
	TL_SetSize(  value1, Line.size  );
	TL_SetStyle( value1, Line.style );		
	
	tl_setcolor(  value2 , color.tl.l );
	TL_SetSize(   value2, Line.size   );
	TL_SetStyle(  value2, Line.style  );
	
	tl_setcolor( value3, color.tl.h );
	TL_SetSize(  value3, Line.size  );
	TL_SetStyle( value3, Line.style );		
	
	tl_setcolor(  value4 , color.tl.l );
	TL_SetSize(   value4, Line.size   );
	TL_SetStyle(  value4, Line.style  );
	
	tl_setcolor( value5, color.tl.h );
	TL_SetSize(  value5, Line.size  );
	TL_SetStyle( value5, Line.style );		
	
	tl_setcolor(  value6 , color.tl.l );
	TL_SetSize(   value6, Line.size   );
	TL_SetStyle(  value6, Line.style  );
	
	tl_setcolor( value7, color.tl.h );
	TL_SetSize(  value7, Line.size  );
	TL_SetStyle( value7, Line.style );		
	
	tl_setcolor(  value8 , color.tl.l );
	TL_SetSize(   value8, Line.size   );
	TL_SetStyle(  value8, Line.style  );						
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;
aaa is offline  
Reply With Quote
Old 05-03-2009, 10:08 AM   #6

Join Date: May 2008
Location: Singapore
Posts: 58
Ignore this user

Thanks: 22
Thanked 32 Times in 16 Posts

Re: Trendline (EasyLanguage)

you are missing "TL_SetExtRight(xxx,True) " for all your trend lines that you want to extend where xxx is the name of those trendline.
sneo is offline  
Reply With Quote
The Following 2 Users Say Thank You to sneo For This Useful Post:
aaa (05-03-2009), EasyTrader_I (09-20-2010)
Old 05-03-2009, 10:18 AM   #7

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 4,052
Ignore this user

Thanks: 2,275
Thanked 1,661 Times in 1,010 Posts

Re: Trendline (EasyLanguage)

Quote:
Originally Posted by aaa »
I think that I understand TL_New but no way to extend extend lines on the right !!!
I've coded something horrible and complicate , but it works
Tams, If you have time to correct it I will appreciate it a lot


I am not sure if I understand what you want to achieve.

Can you make a screen shot, then draw some lines/arrows/notes to illustrate your intention?
Tams is offline  
Reply With Quote
Old 05-03-2009, 11:38 AM   #8
aaa

aaa's Avatar

Join Date: Jun 2008
Location: Switzerland
Posts: 466
Ignore this user

Thanks: 243
Thanked 354 Times in 151 Posts

Re: Trendline (EasyLanguage)

It's good to have friends all over the world

The idea is simple and works like classicals pivots

The goal is to have High Blue and low Red in a solid color

And to extend in Dotted lines to the right during xDays

The circles shows interesting S/R on the 15 mn graph

They are a lot of pullback in 1 mn on these support
Attached Thumbnails
Trendline (EasyLanguage)-hlxtended.jpg  
aaa 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 05:50 PM
GBP/USD Trendline Breakout DannyBly Forex Trading Laboratory 3 07-06-2008 10:13 AM
Trendline methods waveslider Technical Analysis 0 06-26-2007 10:13 PM
Russell 2000 (IWM) Trendline Test MrPaul Technical Analysis 0 03-25-2007 01:53 PM
The Downsloping Trendline On The YM Bfbusa Technical Analysis 0 02-07-2007 12:54 AM

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