DEFPARAM CumulateOrders = false
LookBack = 10
nLots = 1
TP = 50
SL = 50
//
Ema5 = average[5 ,1](close)
Ema20 = average[20,1](close)
//
MyADX = Adx[14] > 25
//
Body = abs(close - open)
UpperWick = high - max(close,open)
LowerWick = min(close,open) - low
BearHammer = (UpperWick >= (Body * 2)) AND (high = highest[LookBack](high))
BullHammer = (LowerWick >= (Body * 2)) AND (low = lowest[LookBack](low))
//
Lcond = (Ema5 > Ema20) AND MyADX AND BullHammer AND (low <= Ema5) AND (high > Ema5)
Scond = (Ema5 < Ema20) AND MyADX AND BearHammer AND (high >= Ema5) AND (low < Ema5)
// --- LONG
IF Lcond AND Not OnMarket THEN
BUY nLots CONTRACTS AT Market
ENDIF
// --- SHORT
IF Scond AND Not OnMarket THEN
SELLSHORT nLots CONTRACTS AT Market
ENDIF
//
SET TARGET pPROFIT TP
SET STOP pLOSS SL