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.
| 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
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
Questions
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.
None yet. The defaults are set for one yen pair, but no results exist for any market.
It uses a size of 1 share per trade. There is no drawdown figure yet, so paper trade it before committing money.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.