Buys when the ATR trailing state is up, STC turns up, and the close is at or above the 200-period SMA. Sells short on the mirror setup, with stops at the trailing level and targets set from ATR.
Best run of 2. Gold, Daily, spread 0.6, from run sweeps:2026-10-12-GOLD-D-opt.tsv:110.
| Period | Up to 2026-10-12 |
| Instrument | Gold, Daily |
| 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-10-12 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | Daily | n/a | 244 | 58.20 | 736 EUR | -581 |
| Nasdaq 100 | Daily | n/a | 223 | 55.61 | 9,004 EUR | -2,421 |
Charts
The code
// ============================================================== // STC Turn ATR Trail Filter // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: Daily // ============================================================== DEFPARAM CumulateOrders = false ONCE kone = 0 ONCE done = 0 ONCE ktwo = 0 ONCE stc = 0 ONCE stcinit = 0 ONCE ts = 0 ONCE pos = 0 myMacd = ExponentialAverage[26](close) - ExponentialAverage[50](close) lowm = lowest[12](myMacd) rngm = highest[12](myMacd) - lowm
74 more lines: the entry and exit rules.
Setup
Questions
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.
It was tested on 2 market and timeframe combinations. The best run by trade count was Gold, Daily, with 244 trades.
The best run had a maximum drawdown of 581 EUR at the tested position size, against a net result of 736 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.