LineArray
- generate trend-line array

Exploration / Indicators
(AmiBroker 4.50)


SYNTAX LineArray( x0, y0, x1, y1, extend = 0, usebarindex = False )
RETURNS ARRAY
FUNCTION The LineArray function generates array equivalent to trend line drawn from point (x0, y0) to point (x1, y1). x coordinates are in bars (zero based), y coordinates are in dollars.

Note: x0 must be SMALLER than x1.

Note 2: the function accepts only numbers therefore generates single line. To produce multiple lines you have to call it many times with different co-ordinates.

extend parameter controls automatic extension of the trend line: if extend is 1 then line is right extended. if extend is 2 then line is left extended if extend is 3 then line is left and right extended

usebarindex parameter controls if x coordinates are interpreted as current array indexes (from 0..BarCount-1) (when usebarindex = False) or as absolute bar indexes (returned by BarIndex() function) when usebarindex = True. These two may differ if QuickAFL feature is turned on.

EXAMPLE y0=LastValue(Trough(L,5,2));
y1=
LastValue(Trough(L,5,1));
x0=
BarCount - 1 - LastValue(TroughBars(L,5,2));
x1=
BarCount - 1 - LastValue(TroughBars(L,5,1));
Line =
LineArray( x0, y0, x1, y1, 1 );
Plot(C, "C", colorWhite, styleCandle);
Plot( Line, "Trend line", colorBlue );
SEE ALSO

References:

The LineArray function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.