|
inputs:
EndDate_YYMMDD( 0 ), { 0 or YYMMDD, constant; if EndDate_YYMMDD = 0,
EndTime_HHMM ignored and last bar on chart used }
EndTime_HHMM( 0 ), { 0 or HHMM, constant; EndTime_HHMM ignored if 0 }
Color( Yellow ),
ExtRight( true ) ;
variables:
EndDate( iff( EndDate_YYMMDD < 500000, EndDate_YYMMDD + 1000000,
EndDate_YYMMDD ) ),
LRV( 0 ),
LRVAgo( 0 ),
TLLRV( 0 ),
Flag( 0 ),
Length( 0 ),
firstbar(0);
if date>date[1] then begin
firstbar=currentbar;
end;
length=currentbar-firstbar;
if Flag = 0 then
{ Insert a lin reg line for the first time and set it's color and extents }
begin
if EndDate = 1000000 and LastBarOnChart then
begin
LRV = LinearRegValue( C, Length, 0 ) ;
LRVAgo = LinearRegValue( C, Length, Length - 1 ) ;
TLLRV = TL_New( Date[ Length - 1 ], Time[ Length - 1 ], LRVAgo, Date, Time,
LRV ) ;
Flag = 1 ;
end
else if Date = EndDate and ( Time = EndTime_HHMM or EndTime_HHMM = 0 ) then
begin
LRV = LinearRegValue( C, Length, 0 ) ;
LRVAgo = LinearRegValue( C, Length, Length - 1 ) ;
TLLRV = TL_New( Date[ Length - 1 ], Time[ Length - 1 ], LRVAgo, Date, Time,
LRV ) ;
Flag = 2 ;
end ;
if Flag = 1 or Flag = 2 then
begin
TL_SetColor( TLLRV, Color ) ;
TL_SetExtLeft( TLLRV, false ) ;
if ExtRight then
TL_SetExtRight( TLLRV, true )
else
TL_SetExtRight( TLLRV, false ) ;
end ;
end
else if Flag = 1 then
{ Reset the end-points of the flag-1 LRLine at each new bar after it has been drawn
for the first time; this effectively results in a new LRLine each time. }
begin
LRV = LinearRegValue( C, Length, 0 ) ;
LRVAgo = LinearRegValue( C, Length, Length - 1 ) ;
TL_SetBegin( TLLRV, Date[ Length - 1 ], Time[ Length - 1 ], LRVAgo ) ;
TL_SetEnd( TLLRV, Date, Time, LRV ) ;
end ;
{ ** Copyright (c) 1991-2003 TradeStation Technologies, Inc. All rights reserved. **
** TradeStation reserves the right to modify or overwrite this analysis technique
with each release. ** } |
|