Help required with multipe horzontal trendlines

normanf

Newbie
Messages
2
Likes
0
Hi everyone

I am looking for some pionter / help to plot 30 or more trendlines on a chart.

I know how to set the values for the starting and end point and allthough date and time.

I what to use a for loop to plot trendline 1 to X
How could i assign to the trendlien array the line number
Here a piece of code, but it give me a error message:

Inputs:fclose(close),length(70),Min(3080.00),Max(4900.000);
vars:ntl(0),sDate(date),stime(time),counter(0),sVal(0);
Arrays: RHDate[10](99999), RHTime[10](99999), RHVal[10](99999),RHTLRef[10](99999);


if currentbar = 1 then begin

RHDate[0] = Date[0];
RHTime[0] = Time[0];


for counter = 1 to 28 begin
if counter = 1 then begin
sVal = Max;
ntl = 1;
end
else
sVal = sval - length;
ntl = ntl +1;
end;
end;

For counter = 1 to ntl begin
sVal = sval - length;
RHVal[counter] = sVal;

RHTLRef[counter] = TL_New(RHDate[0], RHTime[0], RHVal[counter], LastCalcDate , RHTime[0], RHVal[counter]);
RHTLRef[counter] = TL_SetExtRight(RHTLRef[counter], true);
RHTLRef[counter] = TL_SetStyle(RHTLRef[counter], -3); {dashed}
end;
 
You have an awful lot of logical errors and such with this code set of yours. What are you really wanting to accomplish with this ??
 
You have an awful lot of logical errors and such with this code set of yours. What are you really wanting to accomplish with this ??

I want breakdown the chart according to the user define scale setting range into horizontal lines.

Eg: price rang on the chart is 2000 - 4900 I would want the ts Calculate 4900 / 70 = 70, and than subtract from 4900 - 70, = 4830 and draw a horizontal line form the first date of the chart to the last calculated date at 4830.

Next horizontal line would be 4830 - 70 = 4760 and so forth untill 2000 mark is reached.

I hope that is clearer than the code.

thanks Normanf
 
If you have access to the TradeStation forums, then you should find a code set in the file library that plots out floor trader pivots. You can use this code as an easy example to accomplish what you are trying to do which is to simply plot trendlines and extend then right and left. A trendline that has the same values at the start and end, but different times will plot horizontally. You would only need to change the values that are plotted to your custom sets.
 
Top