{ Function: _TLPlotVec Description: Draw a plot using a series of trend line segments. This function is a version of _TLPlot that uses vectors instead of arrays. It is therefore more efficient on memory utilization. Author: David Petersen (dpf16 on TS Forum) Usage: value1 = _TLPlotVec(MyFunction, Length, PriceOffset, PlotOffset, TLStyle, TLColor, TLSize); } using elsystem; using elsystem.collections ; using elsystem.drawingobjects ; using elsystem.drawing ; inputs: int PlotNr(NumericSimple), { plot number } double Price(NumericSeries), { Price to be plotted } int Length(NumericSimple), { number of bars to be plotted to the left of current bar } int PriceOffset(NumericSimple), { price offset } int PlotOffset(NumericSimple), { offset from rightmost bar of plot } int TLStyle(NumericSimple), int TLColor(NumericSeries), int TLSize(NumericSimple); vars: intrabarpersist Int ID(0), vector IDs (null), Vector IDVec (null), Trendline TL (null), int tmp (0), int j( 0 ) , int k( 0 ) , int n(0), PassNr(0), Optimizing(GetAppInfo(aiOptimizing) = 1); Once begin j=(PlotOffset + 1) astype int ; k=(PlotOffset + PriceOffset + 1) astype int ; IDs = New Vector; IDVec = New Vector; IDVec.insert(0,Length+1,0 astype int); IDs.push_back(IDVec.Clone() astype vector); end; If Length > 0 and PlotNr>0 and Not Optimizing and (BarStatus(1) = 2)then begin While IDs.count-1 0 and PassNr > 4 then begin TL = DrawingObjects.GetObjectByID(3, ID) astype Trendline; TL.SetEndPoint(DTPoint.create(BarDateTime[PlotOffset],Price[PlotOffset + PriceOffset])); TL.SetStartPoint(DTPoint.create(BarDateTime[j],Price[k])); TL.Style = (TLStyle-1) astype int; //The difference of 1 from the TS Style (i.e Tool_Solid) and the enumeration for Trendline.Style TL.Color = Color.FromArgb(TLColor); //Trendline.color takes a color class input, so this class method converts a named color integer to a color object TL.Weight = TLSize astype int; end; end; _TLPlotVec = 0;