Convert MQL5 to Pine Script — MT5 indicators and strategies on TradingView
If you've built an indicator or expert advisor in MetaTrader 5 and want to run it on TradingView, you need it in Pine Script. Stratlate is a free online converter that translates MQL5 to Pine Script v6: paste your .mq5 source, click Convert, and get Pine code you can drop straight into TradingView's Pine Editor.
Stratlate is a structural transpiler, not a magic wand. It maps the large common subset the two languages share — indicator calls, price series, math, control flow, buffer plots — and it tells you, line by line, about everything it can't map. MT5 concepts like terminal functions, broker order infrastructure and tick-level events simply don't exist on TradingView, so instead of silently changing your strategy's meaning, Stratlate emits an explicit warning for each one.
That honesty matters for trading code. MetaTrader evaluates OnTick() on every tick, while Pine evaluates once per bar close by default — a difference that can change fills and signals. You get a faithful translation of the structure plus a checklist of exactly what to review before you backtest.
Common MQL5 → Pine Script mappings
| MQL5 | Pine Script v6 | Notes |
|---|---|---|
iMA(..., MODE_SMA, ...) | ta.sma(close, len) | EMA/SMMA/LWMA map to ta.ema, ta.rma, ta.wma |
iRSI(...) | ta.rsi(close, len) | Direct equivalent |
iATR(...) | ta.atr(len) | Direct equivalent |
iBands(...) | ta.bb(close, len, mult) | Returns basis, upper and lower bands |
Close[i] / close[] | close[i] | Series indexing carries over; same for open/high/low |
OrderSend(...) / CTrade::Buy | strategy.entry(...) | Broker parameters (slippage, magic number) have no equivalent |
Ask / Bid | close (approximation) | Pine has no live bid/ask feed — flagged as a warning |
OnTick() | bar-close evaluation | Pine runs per bar, not per tick — behavior can differ |
OnCalculate() + buffers | indicator() + plot() | Indicator buffers become plotted series |
Print(...) | log.info(...) | Debug output goes to Pine logs |
Convert your MQL5 code now
Free, both directions. Paste your MT5 indicator or EA and see the Pine Script v6 output — with every unmapped construct clearly flagged.
Open the converter