Join waitlist
Strategies / Breakout / Pivot Trendline Breakout (long and short) 3

Pivot Trendline Breakout (long and short) 3

The strategy buys when close crosses above a downward trendline through two recent swing highs, while the close is above the 200-bar EMA. It sells short when close crosses below an upward trendline through two swing lows, while below that EMA.

BreakoutLong & shortSwingUS Crude Oil4 hours
1.73Profit factor
5,295Net profit EUR
43.48%Win rate
115Trades
-1,323Max drawdown
46.05Avg trade

Best run of 6. US Crude Oil, 4 hours, spread 3, from run pf:2026-10-12-CRUDE-4h.tsv:3.

Entry rules, long

  1. The two recent confirmed swing highs, each with 5 bars on either side, lie within the last 20 bars and the newer is lower.
  2. The close is above the 200-bar EMA.
  3. Buys one contract at market when flat, after bar 210.

Entry rules, short

  1. The two recent confirmed swing lows, each with 5 bars on either side, lie within the last 20 bars and the newer is higher.
  2. The close is below the 200-bar EMA.
  3. Sells short one contract at market when flat, after bar 210.

Exit rules

  1. Long target: 2 times that risk above the fill price.
  2. Short stop and target mirror this, using the prior bar's high and 2 times the risk.

Test conditions

PeriodUp to 2026-10-12
InstrumentUS Crude Oil, 4 hours
Spread3 points
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-10-12

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
US Crude OilBest run4 hours1.73 11543.485,295 EUR-1,323
Dow Jones1 hourn/a 20341.386,863 EUR-3,249
Nasdaq 100Dailyn/a 4537.783,692 EUR-1,553
Brent Crude4 hoursn/a 9739.183,423 EUR-1,615
Gold4 hoursn/a 18037.78593 EUR-244
GoldDailyn/a 5345.28516 EUR-184

Charts

Results by run

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// Pivot Trendline Breakout (long and short) 3
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Breakout
// Direction: Long & short
// Timeframe tested: 4 hours
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE phone = 0
ONCE phonebar = -1000
ONCE phtwo = 0
ONCE phtwobar = -1000
ONCE plone = 0
ONCE plonebar = -1000
ONCE pltwo = 0
ONCE pltwobar = -1000
ONCE bully = 0
ONCE bullok = 0
ONCE beary = 0
ONCE bearok = 0

ema = ExponentialAverage[200](close)

56 more lines: the entry and exit rules.

Setup

How to load it

  1. Copy the code with the copy button on 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.

Indicators used

EMA
Read this firstKnown weaknesses2 points
  • Results include the spread only. Commissions and overnight financing are not included.
  • The code is published as it was backtested and has not been compiled again since.

Questions

About this strategy

Can I run Pivot Trendline Breakout (long and short) 3 in ProOrder?

Yes. The code is ProBuilder and runs as an automated ProOrder system. Backtest it on your own account with your own spread and position size before trading it live.

Which markets was it tested on?

It was tested on 6 market and timeframe combinations. The best run was US Crude Oil, 4 hours, with a profit factor of 1.73 over 115 trades.

How large was the drawdown?

The best run had a maximum drawdown of 1,323 EUR at the tested position size, against a net result of 5,295 EUR.

Does it trade long, short or both?

It trades both long and short.

Related

Strategies like this one

Reversal Pattern With Chaikin Volatility

Uses the same indicator.

2.26 PF · 6,872 trades

Short Term RSI Pullback Long Short

Best run on the same market, US Crude Oil.

1.33 PF · 493 trades

20 Day Breakout Long

Also a breakout strategy.

1.73 PF · 81 trades

Put your name on the ProRealAlgos waitlist to trade a tested portfolio instead of single strategies.

The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.

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