GAP FILL

post your indicators here

Moderator: moderators

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 11418
Joined: Sun May 14, 2006 9:31 pm
Reputation: 45
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

GAP FILL

Postby TheRumpledOne » Sat Sep 15, 2007 4:25 pm

TOP 25 COWS TO MILK - FIXED




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.
Attachments
SMAA_MTC_TRADE.ELD
(12.5 KiB) Downloaded 103 times
Last edited by TheRumpledOne on Sun Sep 16, 2007 4:15 pm, edited 4 times in total.
IT'S NOT WHAT YOU TRADE, IT'S HOW YOU TRADE IT!

Please do NOT PM me with trading or coding questions, post them in a thread.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

Ken_S
rank: 50+ posts
rank: 50+ posts
Posts: 60
Joined: Tue Jun 19, 2007 2:43 am
Reputation: 0
Location: Rivervale, NJ
Gender: Male

Postby Ken_S » Sun Sep 16, 2007 4:07 am

TRO,
What does the gap fill time pertain to if the gap was never filled as is the case for RIMM in your screenshot above. (1516 Filled GapUp - Short).
You see another column in the ELD titled Middle MSG. What does this column represent?
Any idea how I can modify this to see the results over a number of days?
Thanks in advance.
Ken

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 11418
Joined: Sun May 14, 2006 9:31 pm
Reputation: 45
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

Postby TheRumpledOne » Sun Sep 16, 2007 4:08 pm

Ken_S wrote:TRO,
What does the gap fill time pertain to if the gap was never filled as is the case for RIMM in your screenshot above. (1516 Filled GapUp - Short).
You see another column in the ELD titled Middle MSG. What does this column represent?
Any idea how I can modify this to see the results over a number of days?
Thanks in advance.
Ken



You're right about RIMM.. it was a "bug". Thanks! Will post corrected code.

Middle Msg is for the midpoint crossover trade.

You would have to use my Statistics indicator to see results over a number of days.
IT'S NOT WHAT YOU TRADE, IT'S HOW YOU TRADE IT!



Please do NOT PM me with trading or coding questions, post them in a thread.

Ken_S
rank: 50+ posts
rank: 50+ posts
Posts: 60
Joined: Tue Jun 19, 2007 2:43 am
Reputation: 0
Location: Rivervale, NJ
Gender: Male

Postby Ken_S » Mon Sep 17, 2007 1:25 am

TRO,
Any reason why you have the opening time input set to 31 past the hour and not 30?

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 11418
Joined: Sun May 14, 2006 9:31 pm
Reputation: 45
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

Postby TheRumpledOne » Mon Sep 17, 2007 8:32 am

Think about it. The time is the candle CLOSE TIME.

So the candle that closes at 9:31 EST STARTS at 9:30 which is when the market opens.
IT'S NOT WHAT YOU TRADE, IT'S HOW YOU TRADE IT!



Please do NOT PM me with trading or coding questions, post them in a thread.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

Noam
rank: <50 posts
rank: <50 posts
Posts: 8
Joined: Fri Feb 20, 2009 3:55 am
Reputation: 0
Gender: Male

What do you mean by "Middle Msg is for the midpoint cro

Postby Noam » Fri Feb 20, 2009 4:40 am

TheRumpledOne wrote:
Ken_S wrote:TRO,
What does the gap fill time pertain to if the gap was never filled as is the case for RIMM in your screenshot above. (1516 Filled GapUp - Short).
You see another column in the ELD titled Middle MSG. What does this column represent?
Any idea how I can modify this to see the results over a number of days?
Thanks in advance.
Ken



You're right about RIMM.. it was a "bug". Thanks! Will post corrected code.

Middle Msg is for the midpoint crossover trade.

You would have to use my Statistics indicator to see results over a number of days.


Hi,

What do you mean by "Middle Msg is for the midpoint crossover trade", How should i use it?

Thanks

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 11418
Joined: Sun May 14, 2006 9:31 pm
Reputation: 45
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

Postby TheRumpledOne » Fri Feb 20, 2009 2:53 pm

Just ignore it.
IT'S NOT WHAT YOU TRADE, IT'S HOW YOU TRADE IT!



Please do NOT PM me with trading or coding questions, post them in a thread.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “Tradestation indicators”