Join today
Strategies / Breakout / Opening Range Breakout TEMA

Opening Range Breakout TEMA: Smoothed Breaks of the First Bars

The first 7 bars of the session form an opening range, and a long triggers when TEMA(5) crosses above its high. Shorts need a TEMA cross below the low plus a close under yesterday's close. Stop and target both equal the range height, and open trades close at the next session's first bar.

BreakoutLong & shortSwingNot yet tested
This strategy has not been backtested yet. The rules and code are published now, and the numbers will appear here after the first runs.

Entry rules, long

  1. The opening range (first 7 bars of the session) is complete
  2. Members only
  3. First long of the day

Entry rules, short

  1. The opening range (first 7 bars of the session) is complete
  2. Members only
  3. Close is below yesterday's close
  4. First short of the day

Exit rules

  1. Stop loss equal to the opening range height
  2. Members only
  3. Close any open trade on the first bar of the next session

Parameters

startingCapital
Account size used for sizing
10000
riskFraction
Share of capital risked per trade
0.01
sizingStopPoints
Stop distance assumed when sizing, in points
10
rangeBars
Bars after the session's first bar that build the opening range
6
temaPeriod
TEMA length for the breakout signal
5

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.

// ============================================================
// Opening Range Breakout TEMA
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Breakout
// Direction: Long & short
// Timeframe tested: Not yet tested
// ============================================================

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

// --- Parameters ---
startingCapital = 10000      // account size used for sizing
riskFraction = 0.01          // share of capital risked per trade
sizingStopPoints = 10        // stop distance assumed when sizing, in points
rangeBars = 6                // bars after the session's first bar that build the opening range
temaPeriod = 5               // TEMA length for the breakout signal

ONCE dayBar = 0
ONCE longTrades = 0
ONCE shortTrades = 0

// --- Indicators ---
// Size is fixed once on the first bar from capital, risk and the sizing stop.
ONCE equity = startingCapital + StrategyProfit
ONCE maxRisk = round(equity * riskFraction)
ONCE positionSize = abs(round((maxRisk / sizingStopPoints) / PointValue) * PipSize)

// Bar counter within the session, 0 on the first bar of a new day.
IF Day <> Day[1] THEN
  dayBar = 0
ELSE
  dayBar = dayBar + 1
ENDIF

temaValue = TEMA[temaPeriod](close)
prevDayClose = DClose(1)

// Opening range, plus a stop and target equal to its height.
IF dayBar <= rangeBars THEN
  IF dayBar = 0 THEN
    rangeHigh = high
    rangeLow = low
  ENDIF
  IF high > rangeHigh THEN
    rangeHigh = high
  ENDIF
  IF low < rangeLow THEN
    rangeLow = low
  ENDIF

  stopDistance = rangeHigh - rangeLow
  targetDistance = stopDistance

  longTrades = 0
  shortTrades = 0
ENDIF

32 more lines: the entry and exit rules.

Read this first

Known weaknesses

  • This strategy has not been backtested yet, so no performance claims can be made.
  • Stop and target are the same distance, so the win rate has to beat costs on its own with no reward to risk advantage.
  • Size is computed once from 10000 capital, 1% risk and a 10 point sizing stop, so the real risk per trade depends on the instrument's point value.
  • The rewritten code has not been compile-checked.

Indicators used

TEMA

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 this run in ProOrder?

It is written for ProOrder, but it has not been compile-checked or backtested. Test it on demo first.

Which instruments has it been tested on?

None yet. There are no results on this site.

How is position size set?

The code sizes trades from 10000 capital, 1% risk and a 10 point sizing stop. Check what that means for the instrument you trade, as the actual stop is the range height.

What timeframe fits an opening range?

The range is built from bars, so the timeframe sets its length. A faster chart gives a shorter opening window, a slower one a wider range with bigger stops.

Related

Strategies like this one

Smoothed Bollinger

Uses the same indicator.

1.66 PF · 492 trades

Breakout Regime Filter

Also a breakout strategy.

6.28 PF · 70 trades

Bollinger Band Walk

Also a breakout strategy.

3.10 PF · 148 trades

Want to follow opening range tests as they come in? Join the ProRealAlgos waitlist.

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