JOYBOY: Pine Indicator Ported to a Verified MT5 Expert Advisor
A client's 4H Heikin-Ashi zone plus 15m stochastic trigger ported from Pine to MQL5 and matched 267 of 267 signals.
Live-mode EA reproducing Pine's real-time view, close-all-opposite and multi-timeframe alignment options, a numba Monte Carlo replica, and a sideways-filter study that found Choppiness Index the only filter that helped on gold.

- 267/267 signal parity with an independent replica
- 334 live-mode tester trades, 0 failed orders
- Overlapping deals reduced from 729 to 0 with close-all-opposite
- Filter study documented with one-sample caveats
The client traded a Pine v5 indicator by hand: 15-minute stochastic triggers inside a live 4-hour Heikin-Ashi zone with Fibonacci-based stops and targets. They wanted an EA that trades it the way they see it on screen, including the partially formed higher-timeframe bar, rather than TradingView's lookahead history. The port reproduces that live view and was verified two ways: closed-bar mode matched an independent Python replica on 267 of 267 signals, and live mode placed 334 trades with zero failed orders in a headless tester run.
Over several versions the client's focus points were added: a new order closes all opposite positions across both magic numbers (the old build had 729 overlapping deals, the new one zero), timeframe-2-to-4 alignment toggles, and a configurable stop base. A tester bug of the author's own making (extra timeframes required more history than the tester preloads) was found and fixed, and reported as such.
A sideways-market study ran fourteen tester passes: Choppiness Index at 50 on the 4-hour chart was the only single filter that improved both profit factor and drawdown, while flip-count and leg-size filters were harmful. A numba replica sweeps three million parameter combinations a minute for ranking, with the rule that every winner is confirmed in the MT5 tester because the replica inflates profit factor. A specification hole in the original Pine (ladder stops landing on the wrong side) was documented for the client rather than silently patched.
How it works
- Pine logic is restated as live-bar MQL5 with explicit higher-timeframe handling
- EA compiled and run in a headless tester via a PowerShell harness
- Signals diffed against a Python replica for parity
- Client focus points added as inputs and re-verified
- Monte Carlo and filter sweeps rank settings; MT5 tester confirms
Software and automation are infrastructure, not financial advice. No performance guarantees. Every live system needs staged testing, risk limits, and owner approval.