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
1 answer

How to read a JSON from a URL in MQL5?

How can I read JSON from a url in MQL5? For example this simple JSON from: https://api.myjson.com/bins/56z28 { "employees": [ { "firstName": "John", "lastName": "Doe" }, { "firstName": "Anna", …
fadi
  • 35
  • 2
  • 5
2
votes
3 answers

Why MQL4 OrderModify() will not modify the order when backtesting?

I'm trying to ADD a stop loss to my open market orders in MetaTrader 4 when a position gets 100 pips "to the good" which is to be equal to the Order Open Price; OrderStopLoss() == OrderOpenPrice() But this isn't happening. I've added Print() &…
user6216142
2
votes
2 answers

Switch() Case: with an already defined constant

The compiler keeps whining about the need of a constant for the case type in a switch(){...}. But I have provided a freaking constant. - sorry, /rant mode off Up in my class I have defined the type plus the TYPE_BULLISH and TYPE_BEARISH constants of…
Nique
  • 543
  • 7
  • 21
2
votes
1 answer

MQL4 how to get if a price hits an object?

How to get if a price hits an object? Lets say, the object is a pitchfork, or trendline, manually drawn. I guess, it should start this way: if(Bid==?)
2
votes
4 answers

Reversed array with MQL4

With MetaTrader Terminal ( MQL4 ), I try to have a reversed array, that I append ( prepend ) items to. So, on every tick, myArray[0] becomes the 'newest' value, and the previous value shifts to myArray[1] and so on. But its harder then it sounds. I…
DutchKevv
  • 1,659
  • 2
  • 22
  • 39
2
votes
2 answers

Is there a way to send a multi dimensional array via a web request with MQL4?

I've already used the native WebRequest() function to POST data. Usually I post data using these lines below // ********** char dataUpdatePost[]; char dataUpdateResult[]; string dataUpdateStr = "dataUpdateFlag=YES&orderNumber=" + orderNumber +…
nadstation
  • 23
  • 5
2
votes
1 answer

mql4: Get data from site

How I can get "Maintenance" value from site using a MQL4 script ? As I understand, I must set an internet connection, get data from site, parse it and get data. Is there a way how I can do it? I'll be grateful for any example.
lsv
  • 1,687
  • 4
  • 21
  • 31
2
votes
2 answers

Error 1 in OrderModify

I'm trying to modify an Order, but I always get Error #1. From my research, I have discovered that error 1 means I have input parameter in a wrong way. How can I fix my OrderModify() function? stoploss = NormalizeDouble(Ask - Point *…
Filipe Ferminiano
  • 8,373
  • 25
  • 104
  • 174
2
votes
2 answers

How to avoid array out of range

Does somebody know how to avoid the error array out of range when trying to display long number of bars (lets say 7000) in an indicator buffer?
JLLMNCHR
  • 1,551
  • 5
  • 24
  • 50
2
votes
1 answer

How to include Fibonacci levels in Expert Advisor (EA)?

I want to have access to various Fibonacci levels like 23.6%, 38.2%, 50%, 61.8% and 100% in my expert advisor (EA). How can I define those in my EA so that traders can select them via the inputs? I tried this input double Fibo=23.6; However, is…
Peter Simmons
  • 23
  • 1
  • 5
2
votes
1 answer

Executing an URL from MQL4

On my MQL4 Code I need to execute an External url/link in order to update a table, I have Added the URL in the Allowed URL List Option. However I got the following error : Any Idea how to solve this problem ? Thanks . PS: I am using MT4 Build 840
koul
  • 431
  • 2
  • 10
  • 20
2
votes
0 answers

How to reverse-engineer and convert a protected EX4 file to MQL4-source in an MQ4 file?

I have a few .EX4-files which are protected / encrypted. I want to decompile them to MQL4-source-code files in an .MQ4 format. Is there any direct solution for this?
Ronak Sharma
  • 39
  • 1
  • 1
  • 2
2
votes
1 answer

What is the correct way to define MQL4 "#import of static class methods"?

What I'm trying to achieve is define classes (using MQL4) in separate files and use the methods from those classes in the main code. Essentially importing static class member functions. class example{ //…
Joel Box
  • 429
  • 1
  • 6
  • 12
2
votes
1 answer

Metatrader4/MQL4 code: "wrong parameters count" with dependent classes

In an effort to simplify the problem I am having, I have included two classes in foo.mqh and bar.mqh. When I compile them, I get: 'bar' - wrong parameters count foo.mqh Line 20 Column 9 which is this line in foo.mqh: foobar(bar & b) { example =…
revivalfx
  • 41
  • 1
  • 3
2
votes
1 answer

Troubles with zmq_bind() in ZeroMQ binding for MQL4 language

I am working on MT4 and used wrapper mql4zmq.dll as given in link https://github.com/AustenConrad/mql4zmq As I have followed all instruction and successfully loaded DLL as well as lib file at specific locations from pre-compiled. But it can not…
Junaid
  • 21
  • 3