A long triggers when the close crosses above the previous day's high while price is above the 14-period SMA, and a short when it crosses below the previous day's low under the 9-period SMA. Longs are blocked on Fridays and shorts only run on Mondays and Tuesdays. Each side can trade at most 2 times a day.
Best run of 8. Gold, 4 hours, spread 0.6, from run pf:2026-09-24-GOLD-4h.tsv:1.
| Period | Up to 2026-09-25 |
| Instrument | Gold, 4 hours |
| Spread | 0.6 points |
| Starting capital | 1,000,000 |
| Costs | Spread only. Commissions and overnight financing are not included. |
| Bars | Up to 200,000 bars, fewer where the instrument has less history |
| Last tested | 2026-09-25 |
| startingCapital Account size used for sizing | 10000 |
| riskFraction Share of capital risked | 0.01 |
| sizingStopPoints Stop distance assumed for sizing | 10 |
| longTrendPeriod SMA longs must close above | 14 |
| shortTrendPeriod SMA shorts must close below | 9 |
| maxTradesPerDay Entries per side per day | 2 |
| noLongDay No longs on this day (Friday) | 5 |
| shortDayLimit Shorts only on days below this (Monday, Tuesday) | 3 |
| longStopPoints Long stop, points | 50 |
| longTargetPoints Long target, points | 130 |
| shortStopPoints Short stop, points | 90 |
| shortTargetPoints Short target, points | 30 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | 4 hours | 1.14 | 1,326 | 39.52 | 21,810 EUR | -12,137 |
| Gold | 5 min | n/a | 416 | 36.78 | 21,452 EUR | -9,071 |
| Gold | 15 min | n/a | 1,063 | 32.08 | 20,631 EUR | -8,123 |
| Gold | 1 hour | n/a | 1,934 | 35.52 | 17,832 EUR | -10,490 |
| Gold | 30 min | n/a | 1,869 | 33.39 | 16,991 EUR | -10,274 |
| Gold | 10 min | n/a | 776 | 31.70 | 15,982 EUR | -9,192 |
| Gold | 3 min | n/a | 258 | 43.02 | 15,001 EUR | -8,600 |
| Gold | 2 min | n/a | 182 | 43.96 | 11,839 EUR | -9,103 |
Charts
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.
// ============================================================ // Lift Up Down // ProRealAlgos Strategy Library | prorealalgos.com // Type: Breakout // Direction: Long & short // Timeframe tested: 4 hours // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- 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 longTrendPeriod = 14 // SMA length that longs must close above shortTrendPeriod = 9 // SMA length that shorts must close below maxTradesPerDay = 2 // entries per side per day noLongDay = 5 // no longs on this day of week (5 = Friday) shortDayLimit = 3 // shorts only on days of week below this (Monday, Tuesday) longStopPoints = 50 // stop on longs, in points longTargetPoints = 130 // target on longs, in points shortStopPoints = 90 // stop on shorts, in points shortTargetPoints = 30 // target on shorts, in points // --- 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) // Daily trade counters reset on the first bar of the day. IF IntradayBarIndex = 0 THEN longTradeCount = 0 shortTradeCount = 0 ENDIF longTrendMA = Average[longTrendPeriod](close) shortTrendMA = Average[shortTrendPeriod](close)
24 more lines: the entry and exit rules.
Read this first
Questions
Yes. The rewritten code has not been compile-checked, and the stats come from the earlier version, so demo test it first.
All seven Gold timeframes were profitable. The 4 hour run made the most, EUR 21,810 over 1,326 trades, and 5 minutes was close at EUR 21,452.
Size is calculated from a starting capital of 10000 and a 0.01 risk fraction over a 10-point stop. The best run's max drawdown was EUR 12,136.50, so check what size your broker's point value gives you.
Longs skip Fridays and shorts only trade Monday and Tuesday. These filters come from the tested version and cut out days that did worse for each side.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.