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

How to create a detailed Report with MQL4?

In MetaTrader Terminal 4, there is an option to create a detailed Report. You get results of your account history in an html-format. I am searching for a function which generates this html-file automatically.
user6266369
  • 183
  • 1
  • 15
2
votes
2 answers

Calculate PipSize for Symbols in MT4

My Question is How can I calculate Pip Size in MT4 (without checking symbol name)? My first Answer is based on checking symbol name: Use the Digits variable for 5 or 4 digits symbols and set PipSize = 0.0001. if Symbols are JPY fractions, use…
MohaMad
  • 2,575
  • 2
  • 14
  • 26
2
votes
2 answers

How to export more than 63 parameters using a FileWrite() function in MQL4?

Below I have the full code that allows me to download the data of one currency pair, the USDJPY #property copyright "" #property link "" #property version "1.00" #property strict datetime…
NOIX
  • 23
  • 7
2
votes
1 answer

MQL4 - How to set a "today"-datetime to an extern variable in MQL4 script?

I have an MQL4 script ( a script that runs on MetaTrader4 Terminal platform ) and I need to define an extern variable, named extractionDate of type datetime, so that the user can change its input value before the script starts. I tried the…
Andrea Caronello
  • 217
  • 2
  • 11
2
votes
3 answers

How to get a variable value from a Custom Indicator in MQL4 in Expert Adviser?

If I have an indicator ( myIndi ) which generates a variable ( Var1 ), how can I access the Var1 from an EA, please? I've tried iCustom() but not getting the results.
stackit
  • 21
  • 1
  • 3
2
votes
1 answer

Creating a one standard deviation upper and lower band

I am trying to create a one standard deviation upper and lower band on an array called ATREx. The first while loop below creates the array ATREx. I believe this section is correctly coded. However, the second while loop which is used to create the…
chweet
  • 35
  • 1
  • 7
2
votes
2 answers

How to use DLLs to exchange values between MQL4 programs?

First of all I need to say I don't know much about DLLs. I am trying to send data from one program to another, using functions from kernel32.dll. My programs are coded in MQL4. This is the code I use for the server part, which is supposed to save…
user3425561
  • 79
  • 1
  • 10
2
votes
4 answers

How to do a backtesting with tick-level data in MetaTrader Terminal?

Say I have an EA that executes based on tick-level ( Bid, Ask ) information, is there a way to backtest it with tick-level information in MetaTrader Terminal's Strategy Tester? There are two problems: a. it seems MetaTrader only supports 1 min…
william007
  • 17,375
  • 25
  • 118
  • 194
2
votes
2 answers

Wrapper for slow indicator for backtesting

If a technical indicator works very slow, and I wish to include it in an EA ( using iCustom() ), is there a some "wrapper" that could cache the indicator results to a file based on the particular indicator inputs? This way I could get a better speed…
william007
  • 17,375
  • 25
  • 118
  • 194
2
votes
3 answers

How to integrate a News-feed indicator for an MT4 StrategyTester backtesting?

I need a news indicator that shows me news starts from 2016, and the impact(big, medium, small), the outcome (positive, negative news). Are they such indicators available? I am aware of FFCal and FFC (https://www.mql5.com/en/code/15931), but seems…
william007
  • 17,375
  • 25
  • 118
  • 194
2
votes
1 answer

Is there any existing implementation of List/Vector

Is there any existing implementation of list of string, integer etc. where we can add element, remove element directly, without caring of the size of the arrays?
william007
  • 17,375
  • 25
  • 118
  • 194
2
votes
2 answers

How to know the new ticket number after partial closed a position

When we OrderClose a position partially (say you buy at 2 lots but only close for 1 Lot), it will open a new ticket number, but how do we know that ticket number specifically?
william007
  • 17,375
  • 25
  • 118
  • 194
2
votes
2 answers

How to loop through all Symbols and check the current bar and the previous one's High?

The problem is that when the i in the for loop reaches 15, I get an Array out of range error. What I want to achieve is on every tick to check every Symbol in the MarketWatch and in each Symbol to check the current bar ( PERIOD_M5 ) and the previous…
Expressingx
  • 1,480
  • 1
  • 14
  • 39
2
votes
2 answers

How to find the number of days in the current month using MQL4?

Is there a built-in function or some elegant way to get the number of days in the current month using MQL4? Or alternatively, is there a way to detect the last Monday of the current month?
2
votes
2 answers

For a particular pair, how to get a total volume of open Long and Short positions on The Exchage?

In MQL4 ( MT4, MT5 ), how do I get the total volume of open Short and Long positions on the Exchange, for a current pair at the current time?
Amber More
  • 131
  • 1
  • 15