DAILY HI LO LINES
Posted: Tue Oct 13, 2009 1:52 pm
HI TRO :
I FOUND THIS INDICATOR FROM YOU IN TRADESTATION FORUM,PLEASE IS IT POSIBLE TOO SEE PREVIOUS DAILY HI LOW LINES IN A INTARDAY CHART?
THANKS IN REGARDS,
WERNER
[LegacyColorValue = true];
{ This indicator is for use with daily charts and
inserts 2 horizontal trendlines for each week, at the
high and low of the previous week, respectively. For
the current week, the trendlines are extended to the
right. }
inputs:
iDecimals(2),
Displace_Label( 0 ),
HighColor( Yellow ),
LowColor( Cyan ) ;
variables:
textTop(0),
textBottom(0),
HavePrevLines( false ),
TLHigh( 0 ),
TLLow( 0 ),
WeekHigh( 0 ),
WeekLow( 1000000 ),
PrevWeekHigh( 0 ),
PrevWeekLow( 0 ) ;
if DayOfWeek( Date ) < DayOfWeek( Date[1] ) then
{ ie, if new week }
begin
{ truncate the previous lines if they exist }
if HavePrevLines then
begin
TL_SetEnd( TLHigh, Date[1], Time[1],
PrevWeekHigh ) ;
TL_SetEnd( TLLow, Date[1], Time[1],
PrevWeekLow ) ;
TL_SetExtRight( TLHigh, false ) ;
TL_SetExtRight( TLLow, false ) ;
end ;
{ insert the new hi/lo lines and set their colors/
extents }
TLHigh = TL_New( Date[1], Time[1], WeekHigh,
Date, Time, WeekHigh ) ;
TLLow = TL_New( Date[1], Time[1], WeekLow,
Date, Time, WeekLow ) ;
TL_SetColor( TLHigh, HighColor ) ;
TL_SetColor( TLLow, LowColor ) ;
TL_SetExtLeft( TLHigh, false ) ;
TL_SetExtLeft( TLLow,false ) ;
TL_SetExtRight( TLHigh, true ) ;
TL_SetExtRight( TLLow, true ) ;
textTop = Text_New(Date, (CurrentTime + Displace_Label) ,WeekHigh,"Wk Hi ("+ NumToStr(WeekHigh, iDecimals )+")");
Text_SetStyle(textTop, 1, 1 );
Text_SetColor(textTop, HighColor );
textBottom = Text_New(Date, (CurrentTime + Displace_Label) ,WeekLow ,"Wk Lo ("+ NumToStr(WeekLow , iDecimals )+")");
Text_SetStyle(textBottom, 1, 1 );
Text_SetColor(textBottom, LowColor );
{ re-initialize hi/lo variables }
PrevWeekHigh = WeekHigh ;
PrevWeekLow = WeekLow ;
WeekHigh = High ;
WeekLow = Low ;
{ set flag }
if HavePrevLines = false then
HavePrevLines = true ;
end
else
{ if new hi/lo for week, save values }
begin
if High > WeekHigh then
WeekHigh = High ;
if Low < WeekLow then
WeekLow = Low ;
end ;
I FOUND THIS INDICATOR FROM YOU IN TRADESTATION FORUM,PLEASE IS IT POSIBLE TOO SEE PREVIOUS DAILY HI LOW LINES IN A INTARDAY CHART?
THANKS IN REGARDS,
WERNER
[LegacyColorValue = true];
{ This indicator is for use with daily charts and
inserts 2 horizontal trendlines for each week, at the
high and low of the previous week, respectively. For
the current week, the trendlines are extended to the
right. }
inputs:
iDecimals(2),
Displace_Label( 0 ),
HighColor( Yellow ),
LowColor( Cyan ) ;
variables:
textTop(0),
textBottom(0),
HavePrevLines( false ),
TLHigh( 0 ),
TLLow( 0 ),
WeekHigh( 0 ),
WeekLow( 1000000 ),
PrevWeekHigh( 0 ),
PrevWeekLow( 0 ) ;
if DayOfWeek( Date ) < DayOfWeek( Date[1] ) then
{ ie, if new week }
begin
{ truncate the previous lines if they exist }
if HavePrevLines then
begin
TL_SetEnd( TLHigh, Date[1], Time[1],
PrevWeekHigh ) ;
TL_SetEnd( TLLow, Date[1], Time[1],
PrevWeekLow ) ;
TL_SetExtRight( TLHigh, false ) ;
TL_SetExtRight( TLLow, false ) ;
end ;
{ insert the new hi/lo lines and set their colors/
extents }
TLHigh = TL_New( Date[1], Time[1], WeekHigh,
Date, Time, WeekHigh ) ;
TLLow = TL_New( Date[1], Time[1], WeekLow,
Date, Time, WeekLow ) ;
TL_SetColor( TLHigh, HighColor ) ;
TL_SetColor( TLLow, LowColor ) ;
TL_SetExtLeft( TLHigh, false ) ;
TL_SetExtLeft( TLLow,false ) ;
TL_SetExtRight( TLHigh, true ) ;
TL_SetExtRight( TLLow, true ) ;
textTop = Text_New(Date, (CurrentTime + Displace_Label) ,WeekHigh,"Wk Hi ("+ NumToStr(WeekHigh, iDecimals )+")");
Text_SetStyle(textTop, 1, 1 );
Text_SetColor(textTop, HighColor );
textBottom = Text_New(Date, (CurrentTime + Displace_Label) ,WeekLow ,"Wk Lo ("+ NumToStr(WeekLow , iDecimals )+")");
Text_SetStyle(textBottom, 1, 1 );
Text_SetColor(textBottom, LowColor );
{ re-initialize hi/lo variables }
PrevWeekHigh = WeekHigh ;
PrevWeekLow = WeekLow ;
WeekHigh = High ;
WeekLow = Low ;
{ set flag }
if HavePrevLines = false then
HavePrevLines = true ;
end
else
{ if new hi/lo for week, save values }
begin
if High > WeekHigh then
WeekHigh = High ;
if Low < WeekLow then
WeekLow = Low ;
end ;