Referência das funções do MQL5
Esta página é gerada automaticamente a partir do interpretador MQL5 do TMChart: as funções listadas rodam no TMChart; um programa que chama uma função que não está aqui é recusado na carga, com a mensagem do motivo (nada é imitado). Os nomes diferenciam maiúsculas de minúsculas, como no MetaTrader 5. Para criar e rodar um programa, veja MQL5.
Eventos
Seção intitulada “Eventos”EA: OnInit, OnTick, OnDeinit, OnTimer, OnTrade e OnTradeTransaction. Indicador: OnCalculate (as duas formas). Script: OnStart (roda uma vez). As ordens de um EA vão para o corretor do TMChart: Backtest, SIMULADOR, replay e, na conta REAL, só pela automação que você ligar. O MetaTrader 5 nunca executa o programa.
Saída e erros
Seção intitulada “Saída e erros”Escrevem no console do editor (e no registro da automação) e tratam o código de erro.
Alert · Comment · GetLastError · Print · printf · PrintFormat · ResetLastError · SetUserError
Matemática
Seção intitulada “Matemática”Funções numéricas, com os nomes Math... e os curtos (fabs, pow…).
acos · asin · atan · atan2 · ceil · cos · exp · fabs · floor · fmax · fmin · fmod · log · log10 · MathAbs · MathArccos · MathArccosh · MathArcsin · MathArcsinh · MathArctan · MathArctan2 · MathArctanh · MathCeil · MathCos · MathCosh · MathExp · MathExpm1 · MathFloor · MathIsValidNumber · MathLog · MathLog10 · MathLog1p · MathMax · MathMin · MathMod · MathPow · MathRand · MathRound · MathSin · MathSinh · MathSqrt · MathSrand · MathTan · MathTanh · NormalizeDouble · pow · rand · round · sin · sqrt · srand · tan
Texto e conversão
Seção intitulada “Texto e conversão”Funções de string e conversões entre texto, números, datas, cores e enumerações.
CharArrayToString · CharToString · ColorToString · DoubleToString · EnumToString · IntegerToString · ShortToString · StringAdd · StringBufferLen · StringCompare · StringConcatenate · StringFill · StringFind · StringFormat · StringGetCharacter · StringInit · StringLen · StringReplace · StringSetCharacter · StringSplit · StringSubstr · StringToCharArray · StringToColor · StringToDouble · StringToInteger · StringToLower · StringToTime · StringToUpper · StringTrimLeft · StringTrimRight · TimeToString
Data e hora
Seção intitulada “Data e hora”Horário do servidor da corretora (TimeCurrent), do PC e contadores.
GetMicrosecondCount · GetTickCount · GetTickCount64 · Sleep · StructToTime · TimeCurrent · TimeDaylightSavings · TimeGMT · TimeGMTOffset · TimeLocal · TimeToStruct · TimeTradeServer
Arrays dinâmicos e estáticos, ordem de série (ArraySetAsSeries) e cópias.
ArrayBsearch · ArrayCopy · ArrayFill · ArrayFree · ArrayGetAsSeries · ArrayInitialize · ArrayInsert · ArrayIsDynamic · ArrayIsSeries · ArrayMaximum · ArrayMinimum · ArrayRange · ArrayRemove · ArrayResize · ArrayReverse · ArraySetAsSeries · ArraySize · ArraySort · ArraySwap · ZeroMemory
Dados do ativo (SymbolInfo...), do gráfico e do timeframe.
Digits · Period · PeriodSeconds · Point · Symbol · SymbolExist · SymbolInfoDouble · SymbolInfoInteger · SymbolInfoMarginRate · SymbolInfoString · SymbolInfoTick · SymbolIsSynchronized · SymbolName · SymbolSelect · SymbolsTotal
Séries de preço
Seção intitulada “Séries de preço”Barras e séries do ativo em qualquer timeframe (CopyRates, iClose…).
Bars · CopyClose · CopyHigh · CopyLow · CopyOpen · CopyRates · CopyRealVolume · CopySpread · CopyTickVolume · CopyTime · iBars · iBarShift · iClose · iHigh · iHighest · iLow · iLowest · iOpen · iRealVolume · iSpread · iTickVolume · iTime · iVolume · SeriesInfoInteger
Conta, terminal e eventos
Seção intitulada “Conta, terminal e eventos”Dados da conta da execução, do programa e o temporizador do OnTimer.
AccountInfoDouble · AccountInfoInteger · AccountInfoString · EventKillTimer · EventSetMillisecondTimer · EventSetTimer · IsStopped · MQLInfoInteger · MQLInfoString · TerminalInfoInteger · TerminalInfoString
Indicadores
Seção intitulada “Indicadores”Indicadores técnicos por handle e CopyBuffer, e iCustom para um indicador MQL5 seu.
BarsCalculated · CopyBuffer · iAC · iAD · iADX · iADXWilder · iAlligator · iAMA · iAO · iATR · iBands · iBearsPower · iBullsPower · iBWMFI · iCCI · iChaikin · iCustom · iDEMA · iDeMarker · iEnvelopes · iForce · iFractals · iFrAMA · iGator · iIchimoku · iMA · iMACD · iMFI · iMomentum · IndicatorCreate · IndicatorRelease · iOBV · iOsMA · iRSI · iRVI · iSAR · iStdDev · iStochastic · iTEMA · iTriX · iVIDyA · iVolumes · iWPR
Indicador próprio
Seção intitulada “Indicador próprio”Buffers e plots de um indicador escrito em MQL5 (OnCalculate).
IndicatorSetDouble · IndicatorSetInteger · IndicatorSetString · PlotIndexGetInteger · PlotIndexSetDouble · PlotIndexSetInteger · PlotIndexSetString · SetIndexBuffer
Negociação
Seção intitulada “Negociação”Ordens, posições e histórico. As ordens vão só para o corretor do TMChart (veja abaixo).
HistoryDealGetDouble · HistoryDealGetInteger · HistoryDealGetString · HistoryDealGetTicket · HistoryDealSelect · HistoryDealsTotal · HistoryOrderGetDouble · HistoryOrderGetInteger · HistoryOrderGetString · HistoryOrderGetTicket · HistoryOrderSelect · HistoryOrdersTotal · HistorySelect · HistorySelectByPosition · OrderCalcMargin · OrderCalcProfit · OrderCheck · OrderGetDouble · OrderGetInteger · OrderGetString · OrderGetTicket · OrderSelect · OrderSend · OrderSendAsync · OrdersTotal · PositionGetDouble · PositionGetInteger · PositionGetString · PositionGetSymbol · PositionGetTicket · PositionSelect · PositionSelectByTicket · PositionsTotal
Biblioteca Padrão e #include
Seção intitulada “Biblioteca Padrão e #include”#include <Trade\Trade.mqh> (e os demais arquivos da pasta MQL5\Include do seu terminal) usa o arquivo original do MetaTrader 5 instalado no PC: a classe CTrade e as que ela usa rodam com as funções desta página. #include "arquivo.mqh" lê da pasta do próprio programa.
Ainda não disponíveis
Seção intitulada “Ainda não disponíveis”Existem no MetaTrader 5 e estão previstas; um programa que as chama é recusado na carga.
CopyTicks · CopyTicksRange
Fora do interpretador
Seção intitulada “Fora do interpretador”DLL e #import, .ex5 sem o código-fonte, objetos gráficos (ObjectCreate, ChartEvent), painéis e Canvas, arquivos, rede (WebRequest, e-mail, push), bancos de dados, OpenCL, matrizes/vetores e o calendário econômico.
Total: 257 funções.