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
3
votes
2 answers

What is the difference between init() and OnInit()?

I am learning MQL4. On their reference website, creating a custom indicator is done like as follows: #property indicator_chart_window int init(){ return(0); } int deinit(){ ObjectsDeleteAll(); return(0); } int start(){ return(0);…
CyberShed
  • 41
  • 1
  • 7
3
votes
1 answer

Cannot open file on Ubuntu

I'm using Ubuntu 14 and trying to create a script to write files, but I'm getting the 5004 error, every time I try to open a file. datetime currtime; bool newcandle; string terminal_data_path = TerminalInfoString( TERMINAL_DATA_PATH ); string…
Filipe Ferminiano
  • 8,373
  • 25
  • 104
  • 174
3
votes
2 answers

Translating MQL4 ibands() to Matlab

I'm trying to translate an indicator from MQL4 (Metatrader language) to Matlab. The Bollinger bands code is as follows: for(int i=Bars;i>=0;i--) { BANDS=iBands(Symbol(),0,20,2,1,0,1,i+1); } the iBands() documentation lists the 8 inputs…
siegel
  • 819
  • 2
  • 12
  • 24
2
votes
1 answer

My indicator only has one value in the buffer , which is giving me a straight line

I am trying to convert an indicator I found on tradingview (which uses pinescript) to MQL4: ============================================== BullTrend = (close - lowest(low, 50)) / atr(5) BearTrend = (highest(high, 50) - close) / atr(5) BearTrend2=…
Max
  • 23
  • 3
2
votes
3 answers

why mql4 show error 130 when we use Stoploss in OrderSend function

I am trying to create a EA in mql4, but in OrderSend function, when i use some value instead of zero it show ordersend error 130. Please help to solve this problem Code line is int order =…
SUKHMANJIT Singh
  • 21
  • 1
  • 1
  • 2
2
votes
1 answer

How to get a profit of Nth open position MQL4 / MT4?

I want to create a function that can get random profit open position. For example : a profit of the Last 2 Open Position of overall Total Position a profit of the First 3 Open Position of overall Total Position Below function seems it only gets…
Roller
  • 35
  • 7
2
votes
1 answer

How do I keep the string value the same when the indicator buffer no longer gives a value?

I've coded a basic Expert Advisor to trigger a trade when the parameters are true. However, in this case the code will never meet all the requirements because the string value gives no value when the indicator buffer doesn't give a value. What I…
vinny9592
  • 37
  • 5
2
votes
0 answers

How could MQL4 communicate with python?

I want to communicate with each other the modes I wrote in the python programming language with MQL4, which is the fastest way to do this? Can there be another solution in this regard that zeromq seems difficult to install and use?
2
votes
2 answers

need to move intellisense popup window in visual studio code

I want to move the intellisense popup window to the left side. How can I do this? I tried this solution but it did not help me. How to make VSCode Intellisense window wider
jeon
  • 103
  • 1
  • 13
2
votes
1 answer

ZeroMQ Connector still sent data successfully but failed to get response from MT4 Server

I was following the 7 video tutorials on how to interface python with a MetaTrader Terminal 4 and got no problem running them on iPython kernel just as instructed in this video By no problem I mean a trade was sent to the server with ease and client…
tiensison
  • 21
  • 3
2
votes
1 answer

How can I recognise programmatically when an up/down arrow is drawn on a chart when arrow objects are hidden?

I know how to draw an object arrow on the chart, which I usually do like this: ObjectCreate(0,"prevHigh",OBJ_ARROW_DOWN,0,Time[0],High[highestCandle]); ObjectSetInteger(0, "prevHigh", OBJPROP_COLOR, clrRed); Now I have an indicator…
BBNN
  • 139
  • 1
  • 9
2
votes
0 answers

What is the PineScript equivalent of MQL4's _Point?

I am trying to convert this indicator to PineScript. Couldn't figure out how to get Point variable. Is there any way to achieve the same thing in PineScript? _Point official definition: The _Point variable contains the point size of the current…
Peter
  • 656
  • 1
  • 6
  • 14
2
votes
1 answer

MQL4 TEMA indicator. Indicator line gets messed up when I limit the amount of bars the indicator is processing

I have this TEMA indicator which worked fine. I added a piece of code in order to limit the amount of bars to process but the indicator line gets messed up in the back in an abnormal way and when I limit the amount of bars to process to a small…
2
votes
1 answer

Expert Advisor is not opening trades

I tried to create an EA in mql4 which opens and close the trade position as per condition given, but it is not opening the trade after mating the conditions, EA Works till signal which shows buy and sell and after that nothing happens. How can I…
2
votes
1 answer

"Unresolved function call" in MQL with configs all set

Phenomenon: I've already build a library file, and the EA that uses the library has been exeucted smoothly for months. The code is just like that: In library file: void MyFunction(int mode) .... In EA: #import "MyLibrary.ex4" void…
a4194304
  • 366
  • 2
  • 13