GAP FILL
Posted: Sat Sep 15, 2007 4:25 pm
TOP 25 COWS TO MILK - FIXED
I added the time the gap was filled to the the Message column.
ELD attached.
Code: Select all
[LegacyColorValue = true];
{ _SMAA_MTC_TRADE}
{Attn: TradeStation
if this indicator is posted on the TradeStation Forum, I, TheRumpledOne, did NOT post it there,
so I can't be blamed for this indicator having my contact info.}
{Programmer: Avery T. Horton, Jr. aka TheRumpledOne,
gifts and donations accepted, PO Box 43575, Tucson, AZ 85733 }
{ ? Copyright 2007 Avery T. Horton, Jr.}
inputs:
iHigh( High) ,
iLow( Low) ,
iDecimals(2),
iPeriods(60),
iMarketOpenTime( 0631 ) ;
{*************************************************}
{ V A R I A B L E S }
{*************************************************}
variables:
xBars(0),
tMid(""),
tAlert(""),
DayTop( 0 ),
DayBottom( 0 ),
DayHigh( 0 ),
PrevDayMid( 0 ),
DayLow( 0 ),
tInd(""),
tGap(""),
FG1(white),
BG1(black),
fg2(white),
bg2(black),
fg3(white),
bg3(black),
fg4(white),
bg4(black),
xLast(0),
xGapFill(0),
xOpenGap(0),
xNetChgAtOpen(0),
xNetChg(0);
{commentary variables}
variables:
xcomm(0),
oComm1( "" ),
oComm2( "" ),
oComm3( "" ),
oComm4( "" ),
oComm5( "" ),
oComm6( "" ),
oComm7( "" ),
oComm8( "" ),
oComm9( "" ),
oComm10( "" );
{ INITIALIZE }
tInd = "";
tMid = "Wait";
FG1 = WHITE;
BG1 = BLACK;
fg2 = yellow;
bg2 = BLACK;
fg3 = WHITE;
bg3 = BLACK;
fg4 = WHITE;
bg4 = BLACK;
{*************************************************}
{ R E S E T }
{*************************************************}
If d <> d[1]
then begin
tGap = "" ;
xNetChgAtOpen = 0 ;
xNetChg = 0 ;
end;
{*************************************************}
{ C A L C U L A T I O N S }
{*************************************************}
DayHigh = iHigh ;
DayLow = iLow ;
PrevDayMid = ( HighD(1) + LowD(1) ) * .50 ;
If close crosses above PrevDayMid
or close crosses below PrevDayMid
then xBars = 1
else xBars = xBars + 1;
// xBars = _fBarsSinceXover( close, PrevDayMid, iPeriods) ;
If time <= iMarketOpenTime
then begin
xNetChgAtOpen = close - closed(1);
xLast = close ;
xNetChg = xNetChgAtOpen ;
end
else begin
xNetChgAtOpen = Opend(0) - closed(1);
xNetChg = close - closed(1);
end;
{*************************************************}
{ D I S P L A Y }
{*************************************************}
If xNetChgAtOpen > 0
then begin
tInd = "GapUp - Short" ;
Fg4 = red;
Bg4 = BLACK;
xGapFill = closed(1) - lowd(0) ;
if xGapFill >= 0
then fg2 = green;
end
else
If xNetChgAtOpen < 0
then begin
tInd = "GapDn - Long" ;
Fg4 = green;
Bg4 = BLACK;
xGapFill = highd(0) - closed(1) ;
if xGapFill >= 0
then fg2 = green;
end;
if xGapFill >= 0
and tGap = ""
then begin
tGap = numtostr(time, 0) + " Filled " + tInd ;
end;
If tGap <> ""
then tInd = tGap ;
{ Alert criteria }
If CLOSE CROSSES ABOVE PrevDayMid
then begin
tMid = "XA Mid " + Numtostr(close - PrevDayMid , idecimals) ;
tAlert = tInd ;
Fg1 = black;
Bg1 = yellow;
end
else
If CLOSE CROSSES below PrevDayMid
then begin
tMid = "XB Mid " + Numtostr( PrevDayMid - close , idecimals) ;
tAlert = tInd ;
Fg1 = red;
Bg1 = yellow;
end
else
If CLOSE > PrevDayMid
then begin
tMid = "Above Mid " + Numtostr(close - PrevDayMid , idecimals) ;
Fg1 = green;
Bg1 = BLACK;
end
else
If CLOSE < PrevDayMid
then begin
tMid = "Below Mid " + Numtostr( PrevDayMid - close , idecimals) ;
Fg1 = red;
Bg1 = BLACK;
end
else begin
tMid = "Midpoint! " ;
tAlert = tInd ;
Fg1 = magenta;
Bg1 = white;
end;
If xNetChgAtOpen > 0
and CLOSE < PrevDayMid
then begin
Fg1 = red;
Bg1 = WHITE;
tMid = "SELL SHORT " + Numtostr( PrevDayMid - close , idecimals) ;
end
else
If xNetChgAtOpen < 0
and CLOSE > PrevDayMid
then begin
Fg1 = darkgreen;
Bg1 = WHITE;
tMid = "BUY LONG " + Numtostr(close - PrevDayMid , idecimals) ;
end;
tMid = Numtostr( xBars , 0 ) + " " + tMid ;
{ PLOT }
Plot1( tMid, "Middle Msg", fg1 ) ;
SetPlotBGColor( 1, bg1);
plot2( xGapFill , "Gap Fill", fg2 ) ;
SetPlotBGColor( 2, bg2);
plot3( closed(1) ,"PrevC", fg3 ) ;
SetPlotBGColor( 3, bg3);
plot4( tInd ,"Gap Message", fg4 ) ;
SetPlotBGColor( 4, bg4);
xComm = _fCommentary(oComm1, oComm2, oComm3, oComm4, oComm5, oComm6, oComm7, oComm8, oComm9, oComm10);
CommentaryCl(oComm1 );
CommentaryCl(oComm2 );
CommentaryCl(oComm3 );
CommentaryCl(oComm4 );
CommentaryCl(oComm5 );
CommentaryCl(oComm6 );
CommentaryCl(oComm7 );
CommentaryCl(oComm8 );
CommentaryCl(oComm9 );
CommentaryCl(oComm10 );
CommentaryCl( "closed(1): ", NumToStr( closed(1) , iDecimals) );
CommentaryCl( "opend(0): ", NumToStr( opend(0) , iDecimals) );
CommentaryCl( "highd(0): ", NumToStr( highd(0) , iDecimals) );
CommentaryCl( "lowd(0): ", NumToStr( lowd(0) , iDecimals) );
CommentaryCl( "PrevDayMid: ", NumToStr( PrevDayMid , iDecimals) );
CommentaryCl( "xNetChgAtOpen: ", NumToStr( xNetChgAtOpen , iDecimals) );
CommentaryCl( "xNetChg : ", NumToStr( xNetChg , iDecimals) );
CommentaryCl( "xLast: ", NumToStr( xLast , iDecimals) );
CommentaryCl( "iMarketOpenTime: ", NumToStr( iMarketOpenTime , 0 ) );
CommentaryCl( "Time: ", NumToStr( Time , 0 ) );
I added the time the gap was filled to the the Message column.
ELD attached.