Welcome to the Traders Laboratory Forums.
TradeStation Custom Programming Discuss projects, ideas, obstacles in programming with TradeStation.

Like Tree2Likes

Reply
Old 07-04-2011, 01:39 PM   #1

Tradewinds's Avatar

Join Date: Nov 2008
Location: Northeast U.S.
Posts: 891
Ignore this user

Thanks: 373
Thanked 231 Times in 164 Posts
Blog Entries: 6

Trendline Vs Plots

I've read that Plots can be converted to Trendlines in EasyLanguage. What is the difference between a Plot and a Trendline? How is the code different? I'd like to see an example of each. A Plot has the syntax of:

PlotN(Expression[,"<PlotName>"[,ForeColor[,Default[,Width]]]]);

Expression is the price value to be plotted, PlotName and ForeColor are self explanatory. Width is how thick you want the plot to be.

Text and Trend Lines are created using the Text_XXXXX and TL_XXXXX Reserved Words. The "TL_New" reserved word adds a trendline.

TL_New (Reserved Word)

This reserved word adds a trendline with the specified starting and ending points to a price chart. It returns a numeric expression corresponding to the ID number of the trendline added to the chart.


I want to start a trendline, and have it continue until the next signal.
__________________
Precise, "dialed-in", targeted combination setups, like opening a combination lock; is the experience you should be having while trading. Dial left, right, left, . . . click - the lock opens.
Tradewinds is offline  
Reply With Quote
Old 07-04-2011, 01:47 PM   #2

Tradewinds's Avatar

Join Date: Nov 2008
Location: Northeast U.S.
Posts: 891
Ignore this user

Thanks: 373
Thanked 231 Times in 164 Posts
Blog Entries: 6

Re: Trendline Vs Plots

There is the:

TL_SetEnd (Reserved Word)

This sets the end of the trendline.


Quote:
This reserved word changes the end point of the specified trendline; the end point has a later date and time.
The trendlines seem like a lot more work, and more difficult to program. I'm also curious as to whether they take more computing power.

I'm trying to avoid having connecting lines between trend lines that are at different price levels.
__________________
Precise, "dialed-in", targeted combination setups, like opening a combination lock; is the experience you should be having while trading. Dial left, right, left, . . . click - the lock opens.
Tradewinds is offline  
Reply With Quote
Old 07-04-2011, 01:54 PM   #3

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,477 Times in 912 Posts

Re: Trendline Vs Plots

Quote:
Originally Posted by Tradewinds »
I've read that Plots can be converted to Trendlines in EasyLanguage. What is the difference between a Plot and a Trendline? How is the code different? I'd like to see an example of each. A Plot has the syntax of:

PlotN(Expression[,"<PlotName>"[,ForeColor[,Default[,Width]]]]);

Expression is the price value to be plotted, PlotName and ForeColor are self explanatory. Width is how thick you want the plot to be.

Text and Trend Lines are created using the Text_XXXXX and TL_XXXXX Reserved Words. The "TL_New" reserved word adds a trendline.

TL_New (Reserved Word)

This reserved word adds a trendline with the specified starting and ending points to a price chart. It returns a numeric expression corresponding to the ID number of the trendline added to the chart.


I want to start a trendline, and have it continue until the next signal.
PLOT is used to paint a price bar, a dot, a dash, a cross, or a line on a chart.
you plot one bar at a time...
when plotting a line, as in a moving average, you get a continuous curving line.
when plotting a line based on a pivot value... you get a straight line.


Trendline (TL_NEW) is a drawing object.
you define the coordinates -- the starting point and the ending point, in terms of date, time and price, and you get a trendline.

a trendline is always straight; it can be a vertical line, horizontal line, or a line that spans diagonally across the chart.

a trendline can be made to extend beyond the starting and/or ending point.

a trendline can be moved, deleted, attributes modified...

well... trendlines can be fun, or headache... depends on which side of the fence you are on.


more discussions here:
http://www.traderslaboratory.com/for...ylanguage.html

59.45
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
Old 07-04-2011, 10:54 PM   #4

Tradewinds's Avatar

Join Date: Nov 2008
Location: Northeast U.S.
Posts: 891
Ignore this user

Thanks: 373
Thanked 231 Times in 164 Posts
Blog Entries: 6

Re: Trendline Vs Plots

Quote:
Originally Posted by Tams »
A trendline can be made to extend beyond the starting and/or ending point.
I want a straight line for price level to keep going until the next price level signal fires. I looked at your code in the other thread, and here is what I have so far:

Code:
var: Peak(False),NoPriorPk(False);
var: ClsDwn(False),ClsUp(False);
var: ht(H);

ClsDwn=c<o;
ClsUp=c>o;

Peak=ClsUp[1] and ClsDwn;
NoPriorPk=Peak[1] = false;

if Peak and NoPriorPk then ht= H[1];


{-- restarts the trendline if a new peak signal fired ---}
var: HiTrget(-1);
if Peak then 
	Begin
		HiTrget = tl_new(d, t, H, d, t, H);
	end;
	
{--- extends the trendline from PEAK to current bar ---}
tl_setend(HiTrget, d, t, h);

// To test for a PEAK signal.  Set format to POINTS.
{If Peak and NoPriorPk then 
plot30(l,"Test",Black,5) 
else NoPlot(30);}
This won't plot anything. I've tried everything I can think of, and I can not get a trendline to do anything right. I've tried hard coding the dates, times and price levels. I've tried the simplest example I can think of, and I can't get anything to work for a trendline. If anyone can tell me how to make this work, I'd appreciate it.
__________________
Precise, "dialed-in", targeted combination setups, like opening a combination lock; is the experience you should be having while trading. Dial left, right, left, . . . click - the lock opens.
Tradewinds is offline  
Reply With Quote
Old 07-04-2011, 11:00 PM   #5

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,477 Times in 912 Posts

Re: Trendline Vs Plots

Quote:
Originally Posted by Tradewinds »
I want a straight line for price level to keep going until the next price level signal fires. I looked at your code in the other thread, and here is what I have so far:

Code:
var: Peak(False),NoPriorPk(False);
var: ClsDwn(False),ClsUp(False);
var: ht(H);

ClsDwn=c<o;
ClsUp=c>o;

Peak=ClsUp[1] and ClsDwn;
NoPriorPk=Peak[1] = false;

if Peak and NoPriorPk then ht= H[1];


{-- restarts the trendline if a new peak signal fired ---}
var: HiTrget(-1);
if Peak then 
	Begin
		HiTrget = tl_new(d, t, H, d, t, H);
	end;
	
{--- extends the trendline from PEAK to current bar ---}
tl_setend(HiTrget, d, t, h);

// To test for a PEAK signal.  Set format to POINTS.
{If Peak and NoPriorPk then 
plot30(l,"Test",Black,5) 
else NoPlot(30);}
This won't plot anything. I've tried everything I can think of, and I can not get a trendline to do anything right. I've tried hard coding the dates, times and price levels. I've tried the simplest example I can think of, and I can't get anything to work for a trendline. If anyone can tell me how to make this work, I'd appreciate it.
What is your chart resolution?

With tradestation, you can only use minute chart or higher resolutions.
ie no tick chart or any non-time based charts.

With MultiCharts, you can draw on any chart format.
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
Old 07-04-2011, 11:05 PM   #6

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,477 Times in 912 Posts

Re: Trendline Vs Plots

note correction on Ht

Code:
var: Peak(False),NoPriorPk(False);
var: ClsDwn(False),ClsUp(False);
var: ht(H);

ClsDwn=c<o;
ClsUp=c>o;

Peak=ClsUp[1] and ClsDwn;
NoPriorPk=Peak[1] = false;

if Peak and NoPriorPk then ht= H[1];


{-- restarts the trendline if a new peak signal fired ---}
var: HiTrget(-1);
if Peak then 
	Begin
		HiTrget = tl_new(d, t, Ht, d, t, Ht); // <--- note correction on Ht
	end;
	
{--- extends the trendline from PEAK to current bar ---}
tl_setend(HiTrget, d, t, ht);  // <--- note correction on Ht

// To test for a PEAK signal.  Set format to POINTS.
{If Peak and NoPriorPk then 
plot30(l,"Test",Black,5) 
else NoPlot(30);}
chart from above code:

Attached Thumbnails
Trendline Vs Plots-hsi-tl.png  
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
The Following User Says Thank You to Tams For This Useful Post:
Tradewinds (07-05-2011)
Old 07-05-2011, 12:01 AM   #7

Tradewinds's Avatar

Join Date: Nov 2008
Location: Northeast U.S.
Posts: 891
Ignore this user

Thanks: 373
Thanked 231 Times in 164 Posts
Blog Entries: 6

Re: Trendline Vs Plots

I'm using a 1 minute chart of the @ESU11. I used that code with the change you made, and it still would not plot. I'm wondering if the issue is at least partly related to something other than the indicator. I'm constantly getting a msg that the Axis Scaling is being reset to "No Axis" when I add an indicator to the chart. Attached is a screen shot of the msg. I can get a POINT to plot from my signals, I can get regular plot lines to work, but when I try using a trendline, then it just doesn't work. I may need to post something on the tradestation support forum.
Attached Thumbnails
Trendline Vs Plots-axis-scaling.jpg   Trendline Vs Plots-es_chart.jpg  
__________________
Precise, "dialed-in", targeted combination setups, like opening a combination lock; is the experience you should be having while trading. Dial left, right, left, . . . click - the lock opens.
Tradewinds is offline  
Reply With Quote
Old 07-05-2011, 12:37 PM   #8

Tradewinds's Avatar

Join Date: Nov 2008
Location: Northeast U.S.
Posts: 891
Ignore this user

Thanks: 373
Thanked 231 Times in 164 Posts
Blog Entries: 6

Re: Trendline Vs Plots

This code does part of what I want. It starts a trendline at one of my PEAK signals.

Code:
Variable: ID(-1);

If C[1]>O[1] AND Close<O Then Begin
  ID = TL_New(Date[1], Time[1], H[1], Date, Time, H[1]);
  Value1 = TL_SetExtRight(ID, True);
 End;
I want the LAST high to be the price level of the trend line if my peak signal fires. So I used "H[1]" for the start price. For the end price, I want the line to be perfectly level and horizontal, so the end price must be the same as the start price. So I used the last high for the end price also.

ID = TL_New(Date[1], Time[1], H[1], Date, Time, H[1]);

So this is a beginning. Now I need to be able to stop one trend line when the next one starts.

This code uses the same logic, but just adds a little bit of detail:

Code:
var: Peak1(False);

Peak1 = C[1]>O[1] AND Close<O;

Variable: ID(-1);

If Peak1 Then Begin
  ID = TL_New(Date[1], Time[1], H[1], Date, Time, H[1]);
  Value1 = TL_SetExtRight(ID, True);
 End;
Tams likes this.
__________________
Precise, "dialed-in", targeted combination setups, like opening a combination lock; is the experience you should be having while trading. Dial left, right, left, . . . click - the lock opens.
Tradewinds 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
Instantaneous TrendLine Tams Trading Indicators 43 09-06-2011 11:21 PM
Hideing Plots from Info Window chrisleonard Coding Forum 9 03-02-2011 06:18 AM
RSI Divergence TrendLine aaa Trading Indicators 11 02-25-2011 02:36 PM
Trendline Indicator andypap Coding Forum 1 01-04-2010 07:27 PM
Chart Style Symbol Type Plots in Showme cjstrader5 The Candlestick Corner 7 11-19-2009 11:33 PM

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