The MetaTrader 5 backtest file

The .mq5 file from Pinary is an Expert Advisor (EA) that runs your strategy's rules in MetaTrader 5's Strategy Tester. It runs only in the Strategy Tester: on a chart it refuses to start, and it places no orders.

What to set

  • The same symbol and timeframe as your Pinary backtest.
  • An initial deposit of 10,000 in the symbol's settlement currency, the same as Pinary's backtest.
  • A hedging account if the strategy holds more than one position at a time.
  • If the strategy reads the time of day, set the EA's inputs to your broker's server time (offset from UTC and daylight saving).
  • Volume limits and trading hours on the symbol that let the strategy trade. When the EA skips an entry, the tester's log shows a line starting with “Pinary:” that says why.
  • Test time: on each new bar the EA recalculates its indicators over the whole history, so a year of 5-minute bars can take hours. A year of hourly or daily bars takes a few minutes or less.

Why results can differ from Pinary

  • Prices: your broker's data is not the data Pinary used.
  • Costs: the tester buys at the ask, sells at the bid, and charges your broker's commission and swap. Pinary trades at one price and charges only the commission set in the strategy.
  • Stop loss and take profit: the tester fills them at the first tick it generates past the level, which can be beyond it; Pinary fills at the level. When one bar reaches both, the tester decides which comes first; Pinary assumes price first reaches the bar's high or low, whichever is nearer the open.
  • History: with no history before the start date, the tester holds back about 100 bars before it trades. Indicators built on their own past values (EMA, RSI, ATR…) also depend on how much history comes first.
  • Volume: many MT5 symbols have only tick volume, so a strategy that reads volume sees other values.
  • Position size is rounded down to the symbol's volume step.