Dear all,I wonder if you could help me please. I posted this already before. Tried unsuccessfully to code this. I’d like a screener to fulfil the following criteria:
LONG
1. Price closes above EMA5
2. Bullish hammer crosses and rests on EMA5
3. EMA5 above EMA20
4. ADX above 25
SHORT
1. Price closes below EMA5
2. Bearish hammer crosses and rests on EMA5
3. EMA5 below EMA20
4. ADX above 25
Any help is appreciated.
Thanks.
There you go (non tested):
Ema5 = average[5,1](close)
Ema20 = average[20,1](close)
MyAdx = Adx[14]
Body = abs(close - open)
UpperShadow = high - max(open,close)
LowerShadow = min(open,close) - low
BullishHammer = (Body <= (LowerShadow * 0.30)) AND (UpperShadow <= (Body * 0.10))
BearishHammer = (Body <= (UpperShadow * 0.30)) AND (LowerShadow <= (Body * 0.10))
L1 = close Crosses Over Ema5
L2 = Ema5 > Ema20
L3 = MyAdx > 25
L4 = low <= Ema5
Lcond = L1 and L2 and L3 and L4 and BullishHammer
S1 = close Crosses Under Ema5
S2 = Ema5 < Ema20
S3 = MyAdx > 25
S4 = high >= Ema5
Scond = S1 and S2 and S3 and S4 and BearishHammer
Screener[Lcond or Scond]
Thanks a lot @robertogozzi. I’ll test it and get back to you. Bless.
Hi @robertogozzi, I tried the screener but it didn’t come up with any instruments even though manually, I could see the hammers form on EMA5.
Please report instrument, TF, date and time, so I can check what’s wrong.
It works, despite returning very few signals. I selected ALL shares, currencies and Indices, but only 11 items were found matching the conditions (see attached pic).
I also realized that, due to the above Hammer difinition, there can be (though rare) times when both signals are true, so I suggest that you get rid of line 19 and append these lines, instead:
IF Scond AND Lcond THEN
Lcond = 0
Scond = 0
ENDIF
Screener[Lcond or Scond]
Hi @robertogozzi, thanks for the code. It works just like you described, few but valid hammers.