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
1
vote
0 answers

efficiency in 2 different scenario of code structure on mql4 Expert Advisor

Hi I have EA with code structure like this, void OnTick() { resetCounterVar(); //there's for loop CloseOrders(); //there's for loop UpdateAllOpenOrders(); //there's for loop SetSLTP(); //there's for loop CheckPendOrder();…
1
vote
0 answers

C++ - How to listen to a server sent event (SEE)?

I am trying to listen to a server sent event (SEE) in C++/MQL4 natively. Basically, through a web hook data is sent, then on the desktop I'm willing to listen to the new incoming information from the…
Hamza L.
  • 1,783
  • 4
  • 25
  • 47
1
vote
1 answer

How do you write a function that returns the low and the top of the moving average for a specified number of candles in mql4?

I hope someone guides me, I want to calculate the lowest moving average level during a certain number of candles, as well as the highest moving average level during a certain number of candles. That is, I want the moving average top and the moving…
hre007
  • 11
  • 1
1
vote
0 answers

Getting error when sending POST request to server using MQL4

I am trying to post data using an MQL4 script to a local server on the same network and I am getting errors. Here is the code: #import "Wininet.dll" int InternetOpenW(string, int, string, string, int); int InternetConnectW(int, string, int, string,…
rerat
  • 321
  • 3
  • 14
1
vote
2 answers

MQL4: How to convert the value of iHigh() - iLow() to integer?

double _high = iHigh(Symbol(), Period(), 0); double _low = iLow(Symbol(), Period(), 0); double result = _high - _low; Excuse my limited English. The type of result is a double number, and I want to convert the double number to an integer…
Abbotton
  • 201
  • 2
  • 3
1
vote
1 answer

MQL4 WebRequest POST Json to Django API using Django rest framework, getting \x00 at the end of body

I am using Django only for few weeks so there might be some mistakes. I have an API using Django rest framework, which seems to work well. Using postman every thing is ok I send data using WebRequest in Mql4 to the api string data = "{ ... }“; char…
GuiDrn
  • 333
  • 1
  • 4
  • 12
1
vote
1 answer

How to get a value from Custom Indicator with zmq?

I have an MQL4 Custom Indicators and I make the EA ( an Expert Advisor ) to get data into MetaTrader Terminal 4 ( mt4 ). But, how can I import my custom indicators EA to client zmq to get the value ?
Agam Theos
  • 17
  • 6
1
vote
2 answers

MQL4 how can I check if the order hit SL?

I am coding an algorithmic trading robot and how can I check if the order hit SL on MQL4?
NeoOne
  • 13
  • 3
1
vote
1 answer

i want the distance between (open price-EMA)*2 for take profit

in my expert i want the distance between (open price-EMA)*2 for take profit?how can i do this in mql4? i use this formula for buy position but it does not work Ask+((Bid-EMA)*2)
1
vote
1 answer

why pending orders doesn't adjusted in mql4? error: the price doesnt declared. here is the mql4 code

/here i saved my last order's open price at op parameter./ double op = OrderOpenPrice(); int ticket = SendOrder(_symbol,OP_SELLSTOP,0.02,op -0.0020,100, 0,0);
ali
  • 35
  • 3
1
vote
0 answers

How to fix Close[1] & Close[2]

I have a problem with my EA trades, now I will show you the code with a screenshot of a trade (it happens often) I see that I was definitely wrong for how the entry below must read I put an image where it explains what I have in mind void…
1
vote
0 answers

ThinkOrSwim function equivalent in MQL

I have never heard of ThinkOrSwrim till yesterday when someone asked me to convert a ThinkOrSwim script to an MQL4 indicator. A part of the code is as follows: input length = 21; input price = close; input ATRs=1; input trueRangeAverageType =…
1
vote
1 answer

question about Drawing arrows using iBarshift

I am trying to draw Arrows Based on another indicator's signal from higher timeframe, but the problem i am facing is that it draws the arrow on multiple candles For example : If I check the arrow visibility on W1 timeframe and have the my indicator…
Sam
  • 161
  • 1
  • 11
1
vote
2 answers

OrderClose function not working correctly

Is this the correct implementation of OrderClose()? for(int ii = 0; ii < OrdersTotal(); ii++) { if(OrderSelect(ii, SELECT_BY_POS, MODE_TRADES)) { if(OrderType() == OP_BUY && OrderMagicNumber() == MagicStart && OrderSymbol() == symb) …
Umer
  • 183
  • 2
  • 16
1
vote
1 answer

How can open orders continue in same trading condition

I want to open orders by orders whenever a certain trading condition is met. I want to open pending orders in previous highest and lowest price. So, I tried like this: …
linlin
  • 25
  • 1
  • 7