Join today
Strategies / Mean reversion / Yen End-of-Day Straddle

Yen End-of-Day Straddle

At the start of each day the system places a buy limit below the first bar's close and a sell limit above it, each 0.5 times the 12-bar range away. Any open position is closed on the first bar of the next day. It has not been backtested yet.

Mean reversionLong & 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. Members only
  2. Not on Fridays

Entry rules, short

  1. Members only
  2. Not on Fridays

Exit rules

  1. Stop loss at 1% from entry
  2. Profit target at 0.8% from entry
  3. Members only

Parameters

positionSize
Shares per trade
1
entryRatio
Limit distance as a fraction of the recent range; higher means fewer trades
0.5
stopLossPct
Protective stop, percent of entry price
1
takeProfitPct
Profit target, percent of entry price
0.8
rangePeriod
Bars used for the recent range
12
fridayNumber
No new orders on this day of the week
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.

// ============================================================
// Yen End-of-Day Straddle
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Mean reversion
// Direction: Long & short
// Timeframe tested: Not yet tested
// ============================================================

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

// --- Parameters ---
// Defaults are the USD/JPY set. Other pairs from the published table:
//   AUD/JPY ratio 0.5, stop 0.8, target 1.2, period 12
//   EUR/JPY ratio 0.6, stop 1, target 0.8, period 8
//   GBP/JPY ratio 0.5, stop 0.6, target 1, period 8
positionSize = 1          // shares per trade
entryRatio = 0.5          // limit distance as a fraction of the recent range; higher means fewer trades
stopLossPct = 1           // protective stop, percent of entry price
takeProfitPct = 0.8       // profit target, percent of entry price
rangePeriod = 12          // bars used for the recent range
fridayNumber = 5          // no new orders on this day of the week

// --- Indicators ---
newDay = Day <> Day[1]

19 more lines: the entry and exit rules.

Read this first

Known weaknesses

  • Untested. There are no backtest results on this page.
  • Default settings come from one currency pair's column of a per-pair table, so other pairs need their own values.
  • Buying weakness and selling strength with limit orders means it can fill right before a strong trend day, with only a 1% stop.

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 with limit orders, a 1% stop and a 0.8% target. It has not been compile-checked or backtested yet.

Which instruments has it been tested on?

None yet. The defaults are set for one yen pair, but no results exist for any market.

What size does the code trade?

It uses a size of 1 share per trade. There is no drawdown figure yet, so paper trade it before committing money.

Related

Strategies like this one

Monday Dip Buy

Also a mean reversion strategy.

n/a PF · 146 trades

ATR Band

Also a mean reversion strategy.

10.31 PF · 53 trades

Four Percent Dip

Also a mean reversion strategy.

8.77 PF · 68 trades

New strategies get tested every week. Join the ProRealAlgos waitlist to follow along.

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