Questions tagged [mt4]

MetaTrader 4 is a software platform for manual and automatic trading, including free clients (end-user terminals) for Windows, iPhone, and Android, as well as server-side modules for processing trade transactions, storing and distributing history of quotes, proxy-servers, and administration tools (for brokers).

MetaTrader 4 is a widespread online trading platform designed to provide brokerage services to customers in FOREX Majors, Metals, Commodities, CFD, Indices, Futures and recently even BTC cryptocurrency markets.

The MetaTrader Terminal 4 natively supports a built-in programming language MQL4 and other DLL #import-s, which together allows users to extend the standard functionality with custom scripts, expert advisers (trading robots) and technical indicators.

MetaTrader server-side functionality is also extensible with their proprietary MetaTrader 4 API.

MetaQuotes head of sales, Anthony Papaevagorou, has announced that MetaQuotes no longer intends to issue upgrades to the MetaTrader 4 (MT4) [reported on 2016-11-15]

225 questions
14
votes
2 answers

How can I write mql4 code (EA) that marks the listed candle patterns with rectangles

I am quite new to writing mql4 code and would be grateful if I could get some help drawing rectangles when the following candlestick patterns occur: FIG1: Run code snippet
TopLeft
  • 159
  • 1
  • 7
7
votes
1 answer

How to return an array from a function in MQL4?

I would like to return an array from my function, how can I do that? Look! int GetOrdresVente(){ int ordrevente; int Tabordresvente[]; for(int j = OrdersTotal() - 1; j >= 0 ; j--){ if(OrderSelect( j, SELECT_BY_POS ) == true){ …
packy
  • 71
  • 1
  • 4
6
votes
1 answer

How to create C++ DLL (with DEV -C++) and use in MT4 script (Step by step)

I am trying to create my own DLL with DEV-C++ IDE tool and trying to use it inside MT4 script. I tried to study the example file [MT4_HOME]\MQL4\Scripts\Examples\DLL\DLLSample.cpp available in any MT4 installation and I tried to follow the same…
Andrea Caronello
  • 217
  • 2
  • 11
5
votes
1 answer

Forcebly stop EA in OnTick()

I am making a EA for backTest. Normally program works like this. Ontick() is called until the end of certain period. OnDeinit() OnTester() are called. However now I want to stop in OnTick() and goto 2). like this, void OnTick() { if (cnt >…
whitebear
  • 11,200
  • 24
  • 114
  • 237
5
votes
6 answers

How to calculate (add) datetime values in MQL4?

With MQL4 I have troubles in handling datetime. What I want to do is put datetime in array by month or by year. For now I do in this way. datetime myDate; myDate[0] = D'2010.01.01 00:00'; myDate[1] = D'2010.02.01 00:00'; myDate[2] = D'2010.03.01…
whitebear
  • 11,200
  • 24
  • 114
  • 237
5
votes
1 answer

Handling exceptions in MQL4

In the Java language one can handle exceptions with a try-catch mechanism. Does it exist any similar behaviour in MQL4? This code throws the error 'array out of range' in the Close[bar] expression and I cannot handle it properly. Any help will be…
JLLMNCHR
  • 1,551
  • 5
  • 24
  • 50
4
votes
6 answers

How to get current milliseconds in MetaTrader4 Terminal?

How can I get current milliseconds from MQL4 using an Expert Advisor. i.e.: in Java we can get current milliseconds using system.currenttimemillis()
Nitin
  • 2,701
  • 2
  • 30
  • 60
3
votes
2 answers

How to get the number of decimal places for every Symbol() price

Certain Currency pairs display values to 5 decimal places (EURUSD), others 4 and so on. I wrote the code below to return the integer value of the decimal places minus one. This function just takes into consideration a few pairs. I would like to…
TenOutOfTen
  • 467
  • 6
  • 14
3
votes
2 answers

How can I use iOpen(), iClose(), iLow() and iHigh() to find these pinbars?

I want to find the pinbars circled in the attached image below. For the one on the right, the body is about 1/5th of the candle size and for the one on the left, let's say the body is 1/7th the size candle size and it also has a wick of 1/7th the…
SuperHueman
  • 165
  • 15
3
votes
2 answers

How can I calculate lot size risking X% of account balance

My question is in two closely related parts: Given the entry price and stop loss, how can I calculate my lot size so that 2.5% of my current account balance would be risked on trades? Also in cases where the 2.5% lot size is not a tradable lot…
3
votes
2 answers

How to communicate to a Metatrader 4 Server in order to read data from it?

I need to access the data available for MT4 Investor account or, in general, talk to MT4 server in order to read some data. Is it possible? It should, but i can't figure out how to do it ( is there a specific protocol? Is it allowed? Is there a…
mark
  • 939
  • 2
  • 13
  • 36
3
votes
5 answers

How to control MT4 from python?

I'm using a MetaTrader4 Terminal and I'm experienced python developer. Does anyone know, how can I connect MT4 and Python? I want to: - connect to MT4 - read USD/EUR data - make order (buy/sell) Does anyone know some library, a page with…
Dragon.M
  • 249
  • 1
  • 4
  • 11
3
votes
2 answers

Can't run a simple Expert Advisor with [ nquotes ] using Visual Studio 2015, MetaTrader Terminal 4

Can't run simple expert advisor. Wnd.dll - file from "bin" folder, created with VS2015. Wnd.dll file is inside a correct "MQL4\Libraries\" folder.So I tried to run this Advisor on a Live mode but nothing happened. Please help what I am doing…
Alexey Gapon
  • 73
  • 2
  • 11
2
votes
1 answer

Can I edit a file before installing with Inno Setup?

I would like to make a simple windows installer to copy some files into the client's file system -that's all-. However, I would like to edit the main binary and insert the license code directly into it. Is there a way to do so from Innosetup? Sort…
flaab
  • 543
  • 9
  • 19
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
1
2 3
14 15