Join today
Strategies / Pattern / Negated Hammer

Negated Hammer

When a bar with its body in the bottom third of its range is followed by a strong bar that opens and closes wholly above it, the system buys, as long as price is above the 5, 10 and 50-period SMAs. The short side mirrors this. Exits use a trailing stop of 18 points for longs and 24 for shorts.

PatternLong & shortSwingNasdaq 1001 hour
3.20Profit factor
8,515Net profit EUR
87.10%Win rate
372Trades
-2,494Max drawdown
22.89Avg trade

Best run of 17. Nasdaq 100, 1 hour, spread 3, from run pf:2026-09-16-NAS100-1h.tsv:2.

Entry rules, long

  1. Previous bar has its body in the bottom third of its range
  2. Members only
  3. Close is above the 5, 10 and 50-period SMAs

Entry rules, short

  1. Previous bar has its body in the top third of its range
  2. Members only
  3. Close is below the 5, 10 and 50-period SMAs

Exit rules

  1. Members only
  2. No fixed stop loss or target

Test conditions

PeriodUp to 2026-09-16
InstrumentNasdaq 100, 1 hour
Spread3 points
Contracts1
Starting capital1,000,000
CostsSpread only. Commissions and overnight financing are not included.
BarsUp to 200,000 bars, fewer where the instrument has less history
Last tested2026-09-16

Parameters

positionSize
Contracts per trade
1
fastPeriod
Fast SMA length
5
midPeriod
Middle SMA length
10
slowPeriod
Slow SMA length
50
minBodyRatio
Signal candle body must exceed this share of its range
0.5
longTrailPoints
Trailing stop distance for longs (points)
18
shortTrailPoints
Trailing stop distance for shorts (points)
24

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
Nasdaq 100Best run1 hour3.20 37287.108,515 EUR-2,494
Silver4 hours2.57 10489.4216,440 USD-3,416
S&P 5001 hour1.50 26978.441,753 EUR-1,015
Brent Crude30 min1.44 46890.175,000 EUR-2,604
S&P 50015 min1.43 41175.182,401 EUR-1,049
Gold1 hour1.42 26667.291,366 EUR-1,263
FTSE 1001 hour1.28 35985.791,933 EUR-894
FTSE 10030 min1.27 70978.703,362 EUR-1,091
DAX 401 hour1.26 38391.383,240 EUR-2,417
Nasdaq 10010 min1.19 63188.433,319 EUR-2,614
USD/JPY3 min1.15 77459.04145,340 JPY-110,190
GBP/USD10 min1.12 59371.161,160 USD-902
FTSE 1005 min1.10 68161.53918 EUR-661
Brent Crude10 min1.07 72384.921,207 EUR-1,453
USD/JPY4 hoursn/a 9296.74275,680 JPY-127,470
Brent Crude4 hoursn/a 6592.312,609 EUR-1,991
Nasdaq 100Dailyn/a 3193.551,176 EUR-623

Charts

Results by run

Profit factor by run

Above 1.0 made money, below 1.0 lost money.

0.01.32.53.85.01.0 = break-evenNasdaq 100 · 1 hour3.20Silver · 4 hours2.57S&P 500 · 1 hour1.50Brent Crude · 30 min1.44S&P 500 · 15 min1.43Gold · 1 hour1.42FTSE 100 · 1 hour1.28FTSE 100 · 30 min1.27DAX 40 · 1 hour1.26Nasdaq 100 · 10 min1.19USD/JPY · 3 min1.15GBP/USD · 10 min1.12FTSE 100 · 5 min1.10Brent Crude · 10 min1.07

Net profit against max drawdown

Net profitMax drawdown
0-200K-100K250K500KUSD/JPY · 4 hoursUSD/JPY · 3 minSilver · 4 hoursNasdaq 100 · 1 hourBrent Crude · 30 minFTSE 100 · 30 minNasdaq 100 · 10 minDAX 40 · 1 hourBrent Crude · 4 hoursS&P 500 · 15 minFTSE 100 · 1 hourS&P 500 · 1 hourGold · 1 hourBrent Crude · 10 minNasdaq 100 · DailyGBP/USD · 10 min

The code

ProBuilder, rewritten to house standard

Every file in the library uses the same header, the same section order and the same variable names. The numbers above were produced by the original version before the rewrite, and the rewrite has not yet been compiled in ProRealTime.

// ============================================================
// Negated Hammer
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Pattern
// Direction: Long & short
// Timeframe tested: 1 hour
// ============================================================

// --- Settings ---
DEFPARAM CumulateOrders = false
DEFPARAM PreloadBars = 1000

// --- Parameters ---
positionSize = 1          // contracts per trade
fastPeriod = 5            // fast SMA length
midPeriod = 10            // middle SMA length
slowPeriod = 50           // slow SMA length
minBodyRatio = 0.5        // signal candle body must exceed this share of its range
longTrailPoints = 18      // trailing stop distance for longs (points)
shortTrailPoints = 24     // trailing stop distance for shorts (points)

// --- Indicators ---
fastMA = Average[fastPeriod](close)
midMA = Average[midPeriod](close)
slowMA = Average[slowPeriod](close)
trendUp = close > fastMA AND close > midMA AND close > slowMA
trendDown = close < fastMA AND close < midMA AND close < slowMA

bodyRatio = abs(open - close) / (high - low)

// Previous bar has its body in the top third (hammer), and this bar's body
// sits wholly below it: the hammer is negated.
prevHammer = MIN(open[1], close[1]) > high[1] - (high[1] - low[1]) / 3
hammerNegated = MAX(open, close) < MIN(open[1], close[1]) AND bodyRatio > minBodyRatio

// Previous bar has its body in the bottom third (inverted hammer), and this
// bar's body sits wholly above it.
prevInvertedHammer = MAX(open[1], close[1]) < low[1] + (high[1] - low[1]) / 3
invertedHammerNegated = MIN(open, close) > MAX(open[1], close[1]) AND bodyRatio > minBodyRatio

39 more lines: the entry and exit rules.

Read this first

Known weaknesses

  • There is no fixed stop loss. The trail only starts once the trade is 18 or 24 points in profit, so a losing trade has no protection.
  • No position check before entries, so an opposite signal reverses the trade immediately.
  • Some rows have very few trades, like 31 on Nasdaq 100 Daily and 65 on Brent Crude 4 hours.
  • A win rate of 87.1% in the best run sits next to a max drawdown of EUR 2,493.90, a sign that the losers are large.

Indicators used

SMA

How to load it

  1. Copy the code with the copy button above the code block.
  2. In ProRealTime, open a chart of the instrument and timeframe you want to test, then open ProOrder > New trading system and choose "Create with programming".
  3. Paste the code, give the system a name and save it.
  4. Click "Backtest", set your own spread and position size, and run it before you consider trading it live.

Questions

About this strategy

Can I automate the Negated Hammer in ProOrder?

Yes, every rule is automatic, including the separate long and short trails. Run the new code through a compile check first, since the backtest numbers were produced by the older version.

How did it do across markets?

Nasdaq 100 1 hour made EUR 8,515.10 over 372 trades with a profit factor of 3.2. Silver 4 hours had 2.57, and every market tested was profitable.

What is the drawdown at 1 contract?

The best run had a max drawdown of EUR 2,493.90. Silver 4 hours reached USD 3,415.50.

Why do the trails differ for longs and shorts?

Longs use an 18-point trail and shorts 24 points, as tested. Shorts get more room because down moves in these markets tend to be sharper.

Related

Strategies like this one

Bollinger Squeeze

Uses the same indicator.

14.30 PF · 86 trades

Internal Bar Strength

Best run on the same market, Nasdaq 100.

2.00 PF · 905 trades

Bollinger Band Walk

A similar profit factor.

3.10 PF · 148 trades

Want to see pattern strategies tested the same way across every market? Join the ProRealAlgos waitlist.

Copy trading on US indices is available to ProRealAlgos members as spots open.

Past backtest results do not guarantee future results. This is not financial advice. Curated and maintained by ProRealAlgos. ProRealTime™ is a trademark of ProRealTime SAS. prorealalgos.comStatsDocs