Questions tagged [mql4]

MetaQuotes Language 4 (MQL4) is a language used in the MetaTrader 4 online-trading terminal software for programming trading strategies. This language allows the creation of Expert Advisors that make trading management automated and are perfectly suitable for implementation of trade strategies. Also, MQL4 can be used for the creation of Custom Indicators, Scripts, and Libraries.

MetaQuotes Language 4 (MQL4) is a domain-specific language for programming of trading strategies built in to a MetaTrader Terminal — a client-side trading app.

This language allows one to create "Expert Advisors" that make visualisations and trading management augmented/automated and are perfectly suitable for implementation of trade strategies.

MQL4 can also be used for the creation of "Custom Indicators", "Scripts", "Libraries", and more complex, distributed/grid processing solutions.

The structure and syntax of the language is very similar to C.

MQL4, introduced in about 2012, added new concepts borrowed from the not-so-widely accepted MQL5 domain, and legacy MQL4 codes started to have two different compilation/execution modes, depending on a use of a #property strict directive. Also some internalities of the MetaTrader Terminal platform started to be changed, resulting in a need to massively redesign/re-engineer the code-base, due to injected changes (having no other option but to re-design DLL interfaces and much more - e.g., the string type ceased to be a string - but a NULL terminated block of chars).

Check further details at: http://www.mql4.com/

MetaQuotes' head of sales at the time, Anthony Papaevagorou, announced that MetaQuotes no longer intends to issue upgrades to the MetaTrader 4 (MT4), as reported on 2016-11-15.

857 questions
2
votes
4 answers

Managing JSON Array format in MQL4 script

I would need to get data from inside a JSON Array. I use a call to WebRequest() function to get an order list from my db, thru a nodejs(api) and then I got the following JSON-data format e.g: [{"orderid": 123556, "ordertype": 0, …
koul
  • 431
  • 2
  • 10
  • 20
2
votes
1 answer

Variable argument list with different types in MetaTrader5

I have some mql5 code which I want to print debug messages if the DEBUG macro is set. I would like to use a different function (DebugPrint for that matter) for those debug messages. My first attempt was to create a regular function, but variable…
Distjubo
  • 959
  • 6
  • 21
2
votes
2 answers

How to produce XGBoost outputs without an XGBoost library?

I have an XGBoost binary classifier model trained in Python. I would like to produce outputs from this model for a new input data, in a different scripting environment (MQL4), using pure mathematical operations and without using XGBoost library…
Gursel Karacor
  • 1,137
  • 11
  • 21
2
votes
1 answer

How to setup a period of time in an MQL4 source code?

I am using MQL4. Currently, I am using [Expert Advisor]-s in MT4.StrategyTester, and set a period-of-time by the build-in pull-down calendar GUI-elements. What I want to do is to setup a period-of-time straight in an MQL4-source code. If it is…
whitebear
  • 11,200
  • 24
  • 114
  • 237
2
votes
1 answer

How to open multiple OrderSend() in MQL4 Metatrader 4?

I am trying to simultaneously open multiple trades in MQL4 with an ExpertAdvisor or Script. However when I drag the EA to a chart, it only opens one Order, not the the second (or third, fouth, etc) extern double lots = 0.01; extern int takeprofit =…
rainerbrunotte
  • 907
  • 1
  • 17
  • 37
2
votes
0 answers

OpenMP and exporting parallelized functions within DLL

I have a function within DLL that uses OpenMP to parallelize few loops. The functions have been tested/exported by calling them from an app built in C++ and everything works nicely. I then export the functions to another platform ( MetaTrader…
2
votes
1 answer

MQL4: How to fetch an economic calendar's event value?

How can I fetch the latest released value of an economic announcement using MQL4 to be compared with another variable called x? I need to compare the fetched data (variable x) with the manually entered variable y value of 170000. If x > y, a…
p.luck
  • 646
  • 2
  • 9
  • 34
2
votes
3 answers

Find the Lowest Lots - in MQL4 MetaTrader Language

To All Master / Coder I have a question on how to find the Lowest Lots number in MQL4 Here's my starting code : for ( int T = 0; T < OrdersTotal(); T++ ){ if ( OrderSelect( T, SELECT_BY_POS ) == true ){ if ( OrderSymbol() ==…
user3869115
  • 41
  • 1
  • 6
2
votes
1 answer

How to correctly pass array of structs from MQL4 to C# DLL library

I am writing a script in MQL4 language for MetaTrader Terminal 4 which is using C# DLL library for further data processing. What I'm trying to do is to pass an array of following MQL4-structures: struct marketUpdate { double openPrice; …
Martin Vrábel
  • 830
  • 1
  • 13
  • 36
2
votes
2 answers

How to fix serialization problems MQL4?

Today I get problems with serialization in MQL4. I have a method, which I imported from a DLL: In MQL4: void insertQuery( int id, string tableName, double &values[4], long ×[3], …
Alex Fly
  • 96
  • 9
2
votes
1 answer

MQL4 OrderCloseBy() returns error 3 == [ ERR_INVALID_TRADE_PARAMETERS ]

I found this error and I am not sure about the reason ( The syntax is similar to C ) The function is supposed to close a buy order with a sell order but I'm getting error 3: invalid trade parameters. Is there some parameter that I am setting…
shuji
  • 7,369
  • 7
  • 34
  • 49
2
votes
1 answer

Automation of Binary Options Trading

Perhaps the easiest way to automate one's Forex trading strategy is to create an automated trading robot (aka expert advisor) using MQL4/5 programming language, that is built into the MetaTrader Terminal platform. A more exotic option is to develop…
2
votes
3 answers

How to disable autotrading globally from MQL4/5 program (EA) without DLLs?

How do I disable autotrading globally in MetaTrader 4/5 from within MQL4/5 code without using DLLs?
Enivid
  • 210
  • 2
  • 9
2
votes
2 answers

How to get OHLC-values from each new candle?

I am new in MQL5 and I am trying to capture the values of Open, High, Low and Close of each new candle. For now I am using a one minute TimeFRAME for each candle. I read the documentation and have not figured out how can I do it. My only clue was…
2
votes
2 answers

How to call a built-in function IsTesting() from a class-method which has the same name IsTesting()?

I've got the following code: class Check { public: static bool IsTesting() { #ifdef __MQL4__ return IsTesting(); // _______ @fixme: Here the infinite recursion occurs #else return (MQL5InfoInteger(MQL5_TESTER)); #endif …
kenorb
  • 155,785
  • 88
  • 678
  • 743