Official MQL4 documentation map

MQL4 reference: where to find the authoritative answer

The official MQL4 Reference at docs.mql4.com is the primary source for language syntax, event handlers, standard functions, constants, and runtime behavior. Use it to verify exact signatures and constraints, then compile the complete source in MetaEditor.

ReferenceLookupExample.mq4.mq4
#property strict

void OnStart()
  {
   string symbol = Symbol();
   int timeframe = Period();
   int bars = iBars(symbol, timeframe);
   double point = MarketInfo(symbol, MODE_POINT);

   PrintFormat("symbol=%s timeframe=%d bars=%d point=%s",
               symbol,
               timeframe,
               bars,
               DoubleToString(point, Digits));
  }
  • Start with the official reference
  • Verify exact function signatures
  • Separate compile and runtime rules
  • Test broker-dependent behavior

Use the reference by subsystem

Language Basics covers types, variables, operators, arrays, functions, classes, preprocessing, and program structure. Runtime and Event Handling explain which functions the terminal calls and under what program type.

Timeseries and Indicator Functions cover market data. Trade Functions cover classic MQL4 order operations. Object, File, Common, Conversion, String, Math, and Network sections cover platform services.

QuestionReference sectionWhat to verify
Why is this handler ignored?Event HandlingExact signature and program type
Which bar does this value use?Timeseries / IndicatorsSymbol, timeframe, mode, shift
Why was a trade rejected?Trade Functions / error codesReturn value and broker constraints
How is this text or number converted?String / ConversionInput type, return value, precision

Documentation and compilation answer different questions

The reference describes the contract of a language feature or function. The MetaEditor compiler checks how the complete source uses that contract, including identifiers, parameter types, handler signatures, and warnings.

Neither one proves that a strategy is profitable, history is complete, a URL is allowed, or a broker accepts an operation. Runtime and market assumptions need separate tests.

  • Prefer the official function page over copied forum snippets
  • Check the current source against the classic MQL4 API, not an MQL5 lookalike
  • Read return values and Notes sections, not only the signature
  • Record broker and terminal build assumptions for trading code

Pineify is a coding workflow, not the reference owner

Pineify Coding Agent can generate or revise a single-file MQL4 program and run a syntax check. It does not replace MetaQuotes documentation, MT4 runtime testing, Strategy Tester, or broker validation.

For a documentation-only lookup, stay with the official reference. Use the agent when the task includes turning requirements into source, explaining a compiler diagnostic, or revising code under explicit constraints.

Review the complete example

This small script crosses four reference areas: predefined environment functions, chart timeframe, timeseries, and symbol information. Each API links to a dedicated official signature and behavior page.

Reference pages document API contracts, not strategy quality or broker acceptance. Compile the complete source and test runtime behavior in the target MT4 environment.

ReferenceLookupExample.mq4.mq4
#property strict

void OnStart()
  {
   string symbol = Symbol();
   int timeframe = Period();
   int bars = iBars(symbol, timeframe);
   double point = MarketInfo(symbol, MODE_POINT);

   PrintFormat("symbol=%s timeframe=%d bars=%d point=%s",
               symbol,
               timeframe,
               bars,
               DoubleToString(point, Digits));
  }
Where Pineify fits

Move from the rule to editable MQL4 source

Pineify can generate or revise one self-contained .mq4 file with MQL4-specific reference context. Its independent static checker returns MetaEditor diagnostics so you can repair source issues before testing in your own MT4 environment.

Open MQL4 Coding Agent

Static diagnostics do not prove runtime behavior, backtest results, broker compatibility, or live-trading safety.

Pineify MQL4 Coding Agent with MQL4 selected and an editable MetaTrader 4 code artifact

A practical workflow

  1. 1

    Classify the question

    Identify whether it concerns syntax, events, data, indicators, trading, or a platform service.

  2. 2

    Open the official page

    Read the signature, parameters, return value, notes, and linked constants.

  3. 3

    Apply it to complete source

    Keep program type, symbol, timeframe, shift, and ownership assumptions visible.

  4. 4

    Compile and test

    Resolve diagnostics, then test runtime or broker behavior separately.

Frequently asked questions

Where is the official MQL4 reference?

MetaQuotes publishes it at docs.mql4.com with sections for the language and standard API.

Is MQL4 the same as MQL5?

No. They share concepts and modern language features, but trading APIs, program behavior, and platform data models differ.

Can the reference compile my code?

No. It documents contracts. MetaEditor or a compatible compiler service checks the complete source.

Does a documented function work in every program type?

No. Some functions have runtime restrictions. For example, WebRequest cannot run in custom indicators or the Strategy Tester.

When should I use Pineify instead of the reference?

Use Pineify when you need source generation, revision, or a syntax-check workflow. Use the official reference as the authority for API contracts.

Last verified against the linked official references on . Compile and test the final source in the MetaTrader 4 build, broker, symbol, and account environment you plan to use.

Continue with one reviewable MQL4 file

Define the requirement, inspect the generated source, repair diagnostics, and test the behavior in your own MT4 environment.

Open Coding Agent