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

RE: CL_Trendline drawing question



PureBytes Links

Trading Reference Links

As long as the times have to be typed in, the arrays do not add anything
except complexity. The code can be shortened as follows below. 

input:height(.4);
Var: TLLine(0);
	
If t=1000 or t= 1100 or t= 1200 or t=1300 or t=1400 then begin  
   TLLine = TL_New(Date,t,High+.1,Date,t,High + Height);
   TL_SetStyle(TLLine, 1);
   TL_SetColor(TLLine, Red);
End;

If arrays are wanted, then Phil’s code can be shortened as follows. The
array, TLLine[5](0), is not needed as the reference for TL_New does not
need to be save unless SetStyle or SetColor is to be changed after the
TL is drawn. TS stores (somewhere) the sequential references for TL_New.
TLLine is made into a variable and TL_New is assigned to it.  Also,
SetExtRight should be omitted as the ends are defined in TL_New. 

Var: Counter(0), TLLine(0);

If currentbar >= 1 then begin
 For Counter = 1 to 5 begin
   If Time = TLArray[Counter] then begin
     TLLine = TL_New(Date,Time,High+2,Date,Time,High + Height);
     TL_SetStyle(TLLine, 1);
     TL_SetColor(TLLine, Red);
   end;
 end;
 {Print("TLLine : ", TLLine);}
end;


> 
> This one is better since I used 2 arrays to enter several inputs. In case you want to add more than 5 inputs, do not forget to increase the size of the 2 arrays and the upper boundary of the Counter
>  
> Rgds,
> Phil
>  
> {***************************************
> #VerticalTrendLines2
> Written by: Kimball Morgan
> Modifie par: Philippe Lhermie, le 16/07/2000 00h20
>  
> Description: Dessine des lignes de tendance Commentaires: 
>  
> *****************************************}
> Inputs :
>  TL1(1000),
>    TL2(1100),
>  TL3(1200),
>  TL4(1300),
>  TL5(1400),
>  Height(20);
>  
> Variables:
>  Counter(0);
>  
> Arrays:
>  TLArray[5](0),
>  TLLine[5](0);
>  
> TLArray[1] = TL1;
> TLArray[2] = TL2;
> TLArray[3] = TL3;
> TLArray[4] = TL4;
> TLArray[5] = TL5;
>  
>   
> If currentbar >= 1 then begin
>  For Counter = 1 to 5 begin
>   If Time = TLArray[Counter] then begin
>    TLLine[Counter] = TL_New(Date,Time,High+2,Date,Time,High + Height);
>    TL_SetExtRight(TLLine[Counter], True);
>    TL_SetStyle(TLLine[Counter], 1);
>    TL_SetColor(TLLine[Counter], Red);
>   end;
>  end;
>  {Print("TLLine[Counter] : ", TLLine[Counter]);}
> end;
>  
> -----Message d'origine-----
> De : Kimball Morgan [mailto:kmorgan@xxxxxxxx]
> Envoyé : samedi 15 juillet 2000 20:37
> À : code-list@xxxxxxxxxxxxx
> Objet : CL_Trendline drawing question
> 
> Question from novice EL user:
>  
> I'm attempting to create an indicator for use intraday on one-minute bars.  The objective is to draw vertical
> trendlines above bars that equal certain pre-determined times.  There are about a dozen of these times
> throughout any given day.
>  
> I'm obviously missing something here, as my attempt draws nothing at all. 
> Following is what I've written; any and all comments welcome.
>  
> Many thanks for your time and thought.
>  
> Kimball Morgan
>  
> {code follows}
> If currentbar > 1 then begin
>  
> vars: TCount(0),
>   T1(0700),
>   T2(0735),
>   T3(0820),
>   T4(0840),
>   {etc.} ;  
>  
>  
> if T <> T[1] then TCount = TCount +1;
>  
> if TCount = T1 then begin
>  value1 = TL_New(d,t,h+2,d,t,h+20);
>  TL_SetExtRight(value1, True);
>  TL_SetStyle(value1, 1);
>  TL_SetColor(value1, red);
> end;
>  
> end;