fx-chartingDocs
Scripts

Experts (MQL5 & Pine Script)

Max edition: paste MetaTrader 5 or TradingView Pine Script code and run it on the chart.

Open Experts in the header (or </> at the start of the time axis), choose MT5 or Pine Script, paste code and press Add to chart (F5). Expert Advisors and strategies are backtested over the history and then trade live (paper); indicators draw on the chart or in their own pane.

Run a script from code
api.runScript({
  language: "pine",
  name: "EMA cross",
  code: `//@version=5
indicator("EMA cross", overlay = true)
plot(ta.ema(close, 9), color = color.lime)
plot(ta.ema(close, 21), color = color.red)`,
});

Scripts that ask for other symbols or timeframes (request.security("GBPUSD", "240", close), iClose("USDJPY", PERIOD_H4, 1)) get them from your datafeed automatically — another reason to implement resolveSymbol for every symbol your users trade.