//
// Program: Labels for trading the Jack Hershey Method
// Version: 1.1, Feb 29, 2008
// Author: TUMS
// Modified: Vorzo
// License: Public Domain
//
// Description: This EasyLanguage script puts labels on the chart
// ob = Outside Bar
// Sym = Sym Pennant
// FTP = Flat Top Pennant
// FTP = flat bottom pennant
// Lat = Lateral
//
// In the spirit of Paying-Forward, you are invited to post your
// extensions and enhancements on:
// [url]http://www.elitetrader.com/vb/showthread.php?s=&threadid=97684[/url]
//
Input:
text_col(yellow),
TL_Col(yellow),
Txt_Offset(0.05),
Show_Txt(1),
Show_OB(1),
TextStyleHor(2),
TextStyleVert(1),
PennantSize(1);
Variables:
ID_TL (0),
ID_txt(0),
id_TxtLat(0),
old_id(0),
ccc(0),
top_TL(0),
bot_tL(0),
top_TLlat(0),
bot_tLlat(0),
LatHi(0),
LatLo(0),
inside(false),
insidebar(false),
lateral(false);
inside = high <= high[1] and low >= low[1];
insidebar = high < high[1] and low > low[1];
if high[1]<=high[2] and high<=high[2] and
low[1]>=low[2] and low>=low[2] and lateral=false then
begin
lateral=true;
LatHi=High[2];
LatLo=Low[2];
end;
{== Lateral ==}
if lateral and lateral[1]=false then
begin
if Show_Txt=1 then
begin
{******* Comment out in TradeStation *******}
text_delete( id_txt );{delete prior label}
id_TxtLat = Text_New( Date, Time[1], high[2]*(1 + Txt_Offset/100),
"Lateral" );
Text_SetStyle( id_TxtLat, TextStyleHor, TextStyleVert );
Text_SetColor( id_TxtLat, BLUE );
end;
top_TLlat = tl_new( date[2], time[2], high[2], date, time, high[2] );
bot_tLlat = tl_new( date[2], time[2], low[2], date, time, low[2] );
TL_setcolor(top_TLlat,TL_Col);
TL_setcolor(bot_TLlat,TL_Col);
TL_SetSize(top_TLlat,1);
TL_SetSize(bot_TLlat,1);
end;
//if date=1080205 then
Print(date,time,lateral,ID_txt:10:2,id_TxtLat:10:2);
if lateral and lateral[1] then
begin
{******* Comment out in TradeStation *******}
if id_txt>Id_txtlat and Show_Txt=1 then {delete labels inside lateral}
text_delete( id_txt );
TL_SetEnd(top_TLlat,date,time,LatHi);
TL_SetEnd(bot_TLlat,date,time,LatLo);
end;
if Close>LatHi or Close<LatLo then
begin
lateral=false;
LatHi=0;
LatLo=0;
end;
{== FBP ==}
if h < h[1] and l = l[1] then
begin
//id_tl = tl_new( date, time, high + Txt_Offset, date, time, high + Txt_Offset * 2 );
//TL_setcolor(ID_tl,TL_Col);
if Show_Txt=1 then
begin
id_txt = Text_New( Date, Time, high[1]*(1 + Txt_Offset/100), "FBP" );
Text_SetStyle( id_txt, TextStyleHor, TextStyleVert );
Text_SetColor( id_txt, text_col);
end;
draw_pennant(top_TL,bot_tL,TL_Col,PennantSize);
end
else
{== FTP ==}
if high = high[1] and low > low[1] then
begin
//id_tl= tl_new( date, time, high + Txt_Offset , date, time, high + Txt_Offset * 2 );
//TL_setcolor(ID_tl,TL_Col);
if Show_Txt=1 then
begin
id_txt = Text_New( Date, Time, high[1]*(1 + Txt_Offset/100),
"FTP");
Text_SetStyle( id_txt, TextStyleHor, TextStyleVert);
Text_SetColor( id_txt, text_col);
end;
draw_pennant(top_TL,bot_tL,TL_Col,PennantSize);
end
else
{== InsideBar ==}
if insidebar then
begin
//id_tl= tl_new( date, time, high + Txt_Offset, date, time, high + Txt_Offset * 2 );
//TL_setcolor(ID_tl,TL_Col);
if Show_Txt=1 then
begin
id_txt = Text_New( Date, Time, high[1]*(1 + Txt_Offset/100), "Sym P" );
Text_SetStyle( id_txt, TextStyleHor, TextStyleVert );
Text_SetColor( id_txt, text_col);
end;
draw_pennant(top_TL,bot_tL,TL_Col,PennantSize);
end;
{== Outside Bar ==}
if Show_OB=1 then
begin
if high > high[1] and low < low[1] then
begin
id_txt = Text_New( Date, Time, Low*(1-Txt_Offset/100), "OB" );
Text_SetStyle( id_txt, TextStyleHor, 0 );
Text_SetColor( id_txt, text_col);
end;
end;