Questions tagged [mql5]

MetaQuotes Language 5 (MQL5) is a built-in language for programming trading strategies. This language is developed by MetaQuotes Software Corp and allows to create your own Expert Advisors that make trading management automated and are perfectly suitable for implementing your own trading strategies. Besides, using MQL5 you can create your own technical indicators (custom indicators), scripts and libraries.

MQL5 contains a large number of functions necessary for analyzing current and previously received quotes and has built-in basic indicators and functions for managing trade positions and controlling them. The MetaEditor 5 (text editor) that highlights different constructions of MQL5 language is used for writing the program code. It helps users to orientate themselves in the expert system text quite easily.

MQL5 is the evolution of its predecessor - the MQL4 programming language, in which numerous indicators, scripts, and Expert Advisors were written. Despite the fact that the new programming language is maximally compatible with the previous-generation language, there are still some differences between these languages.

Check further details here: http://www.mql5.com/

404 questions
4
votes
2 answers

ExpertMACD raise [invalid stops] if Stop Loss is not 0

Please consider that I am just starting with MQL5. Just for learning, I ran the EA optimization of MT5 on ExpertMACD (preinstalled in MT5) on BTCUSD H1 pair on an Alpari-MT5-Demo account. All ok until July 2017 data, after which the Advisor does not…
alec_djinn
  • 10,104
  • 8
  • 46
  • 71
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
4
votes
2 answers

How to post from MetaTrader Terminal 5 MQL 5 a request to my nodejs server, which is running locally on my MT5 host?

I'm trying to get FX rates in my nodejs server and socke.io emit them to the client, while running MetaTrader Terminal 5 or 4. So I guess I have to use MQL4/5. I know how the handle the request in my nodejs server. What I dont know is where to write…
Georgi Antonov
  • 1,581
  • 21
  • 40
4
votes
1 answer

Simple function to read file from an URL to a string buffer ( C++ / MQL{4|5} using WinInet.dll )

I am looking for a simple function which is able to read a text or binary file from the internet into a string variable. It´s unbelievable that I could not find anything in the web, just low level descriptions of all the WinInet functions and…
Doerk
  • 71
  • 8
4
votes
2 answers

How to get an amount of open trades in MQL5

I want to get the amount of open trades in MQL5 on a demo account during strategy testing. PositionsTotal() and OrdersTotal() always return 0 even if there are open trades. The solution suggested here does not work. Any help will be appreciated.
Freek Nortier
  • 780
  • 1
  • 13
  • 27
3
votes
3 answers

How to code and compile mql4 and mql5 language in VS Code?

I moved to mql4 and mql5 programming language. But, MetaEditor is very noob to code with, so I want to code mql4 language and compile with VS Code. If you have any solution please share with us..... Thanks
3
votes
1 answer

How to search for a candlestick pattern on multiple timeframes

I have an expert advisor that draws rectangle on a specifically defined bearish pinbar followed by a bullish candle. Please see the code below. It basically shows the rectangle on the timeframe displayed on the chart. How can I search for this…
TenOutOfTen
  • 467
  • 6
  • 14
3
votes
1 answer
3
votes
1 answer

How to work-around the misdesigned OrderSendAsync() -function [mql5]

Background: As long as you never use the OrderSendAsync() -function, and always use the OrderSend() -function instead, there is no problem. But if you want to speed up things and use OrderSendAsync() -function, there is a problem: At the time the…
AHiismak
  • 119
  • 6
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
1 answer

Create Client side socket (Winsock, MQL5, MT5) and Server side Socket using (NodeJS + Socket.io)

I have a windows server 2016 and I am trying to send data from Meta Trader 5 using EA to the specific port (777) in localhost and I am using NodeJS, Socket.io on the other hand to capture that data. I would like to pass data from MT5 to a…
Murlidhar Fichadia
  • 2,589
  • 6
  • 43
  • 93
3
votes
0 answers

How to create custom symbols and feed it's chart data from a remote server in real time?

I'm trying to learn how to create an MQL5 library for MT5 (I think it should be a library, but not so sure) to create new symbols and feed these symbols chart data from public exchanges APIs in real time. I tried searching for some tutorial or…
Sassa
  • 1,673
  • 2
  • 16
  • 30
3
votes
2 answers

How to pull +DI and -DI values from an iADX() indicator in MQL4 / MQL5?

I'm a noob at MQL4 and I am writing my first EA. My goal is to get the variables of the +DI and -DI of the ADX Indicator. I used the iADX() function as shown here: double a; int OnInit() { a = iADX( NULL, 0, 0, PRICE_CLOSE, MODE_PLUSDI, 0 ); …
3
votes
1 answer

MQL4 - ERROR 4111 when calling OrderSend() method

I am trying to place order, but my call to OrderSend() method ( https://docs.mql4.com/trading/ordersend )is failing: 2016.08.01 00:51:09.710 2016.07.01 01:00 s EURUSD,M1: OrderSend error 4111 void OnTick() { if ( OrdersTotal() == 0 ){ …
user285594
2
votes
0 answers

how to code multiple values of an indicator into new custom indicator?(MQL5)

Let's use MACD as an example. It has 2-3 values(1st for the MACD line, 2nd for the signal line, and 3rd if it has a histogram). I'm trying to incorporate those values into a new indicator. I figured I would need multiple buffers and SetIndexBuffer…
enterjcs
  • 21
  • 2
1
2
3
26 27