Page 1 of 1

help with inverted hammer indicator?

Posted: Fri Dec 28, 2007 3:34 pm
by chancee90046
Can anyone please help me arrange this code so that it shows the opposite of a hammer/hanging man... which I guess would be a shooting star or inverted hammer? My goal is to create an indicator that will show me when a candle has formed that has a small body and upper tail, with no or hardly any lower tail. Basically exactly what the hammer show me indicator does - except the opposite. Any help would be much appreciated. -Chance.


{ Candlestick ShowMe }

inputs: Length( 14 ), Factor( 2 ) ;
variables: oHammer( 0 ), oHangingMan( 0 ) ;

Value1 = C_Hammer_HangingMan( Length, Factor, oHammer, oHangingMan ) ;

if oHammer = 1 then
begin
Plot1( High, "Hammer" ) ;
Alert( "Hammer" ) ;
end
else if oHangingMan = 1 then
begin
Plot2( Low, "HangMan" ) ;
Alert( "HangingMan" ) ;
end ;

Posted: Fri Dec 28, 2007 9:33 pm
by obx
Chancee,

Likely you haven't gotten responses bcse your requirements aren't as defined as you might first assume. I suggest you create an EL function (with a different name but using same C_ naming conventions) using the following code as a template

Code: Select all

inputs:
   Length( numericsimple ),
   Factor( numericsimple ),
   oHammer( numericref ),
   oHangingMan( numericref ) ;

variables:
   BodyHi( 0 ),
   BodyLo( 0 ),
   Body( 0 ),
   PriceAvg( 0 ),
   BodyAvg( 0 ) ;

BodyHi = MaxList( Close, Open ) ;
BodyLo = MinList( Close, Open ) ;
Body = BodyHi - BodyLo ;
PriceAvg = XAverage( Close, Length ) ;
BodyAvg = XAverage( Body, Length ) ;

oHammer = 0 ;
oHangingMan = 0 ;

if Body < BodyAvg
            { BODY SMALL }
   and Body > 0
            { ...BUT NOT ZERO... }
   and BodyLo > MedianPrice
            { ...AND IN UPPER HALF OF RANGE }
   and BodyLo - Low > Factor * Body
            { LOWER SHADOW MUCH LARGER THAN BODY }
   and High - BodyHi < Body
            { UPPER SHADOW SMALLER THAN BODY }
then
   if Close < PriceAvg then
            { TREND IS down }
      oHammer = 1
   else if Close > PriceAvg then
            { TREND IS up }
      oHangingMan = 1 ;

C_Hammer_HangingMan = 1 ;



edit the logic in the condition
if Body < BodyAvg { BODY SMALL } and
Body > 0{ ...BUT NOT ZERO... } and
BodyLo > MedianPrice{ ...AND IN UPPER HALF OF RANGE }and
BodyLo - Low > Factor * Body { LOWER SHADOW MUCH LARGER THAN BODY } and
High - BodyHi < Body { UPPER SHADOW SMALLER THAN BODY }
to do what you want it to do
(ie the <'s change to > and/or BodyHi's change to BodyLo, etc )

then use the 'hanging man' showme as a template to create a new show me and call your new function in it...

hth

Posted: Sat Dec 29, 2007 4:22 am
by chancee90046
Nice... thanks so much. It took me a while but I got it. Much appreciated. Chance