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

Modifying order returns error 130

I'm trying to modify an order, but I keep Error modifying order!, error#130. I'm using an ECN broker, so I need to modify the order to set a stoploss/takeprofit. What I am doing wrong? int digits = MarketInfo( Symbol(), MODE_DIGITS ); if ( …
Filipe Ferminiano
  • 8,373
  • 25
  • 104
  • 174
2
votes
1 answer

How to make a Metatrader Terminal on VPS use a c# DLL?

Status: I've written a DLL in C#, which is ment to be called from a code written in a MQL4 ( basically a C-alike language ) and sends back some data ( unmanaged to managed and back ). In general, the DLL sends queries to a MySQL-host and when…
gingnoa
  • 21
  • 4
2
votes
1 answer

How to download data from an SQL-database and annotate an MT4-chart

I have recently download the MetaTrader Terminal platform ( MT4 ). I have my own back testing engine which stores some output in my SQL-server database. The output depends on the model I am testing. However, the output can just be as simple as the…
mHelpMe
  • 6,336
  • 24
  • 75
  • 150
2
votes
2 answers

Structure have objects and cannot be copied

I'm trying to start with my first MQL4 expert advisor, I've created a struct to handle my orders: struct Order { int pair; int command; double quantity; double entry; double …
Don Giulio
  • 2,946
  • 3
  • 43
  • 82
2
votes
2 answers

MT4 Time based entry signal in MetaTrader4

Does anyone have any example code for how to generate a time of day based entry signal in Metatrader 4? e.g. at a particular hour and minute of each day
acheo
  • 3,106
  • 2
  • 32
  • 57
2
votes
2 answers

How to send data to a PHP page without using browsers?

My other two questions didn't go down too well (here and here), due to my confusion and noob-ness; I'll have a final bash to clarify my problem. I need to send historical trades and signals from my trading terminal. The code is in MQL (C variant)…
Data46
  • 31
  • 8
2
votes
2 answers

MQL4 Indicator passing signal to EA

the problem is, I want to open order when my indicator gives signal. How can I do that? I have been trying to do with iCustom() but it is not satisfying. I tried to use GlobalVariableSet() in indicator and GlobalVariableGet() method in EA but it is…
Ergin Ersoy
  • 890
  • 8
  • 28
2
votes
2 answers

How can I call OrderSend inside custom indicator?

I've got an indicator that signals an action by sound and alert: PlaySound("news.wav"); Alert(Symbol()," make an action"); I wanted to add there the OrderSend function to auto buy-sell and it looks this way: int ticket; …
Kamil
  • 1,456
  • 4
  • 32
  • 50
2
votes
1 answer

How to protect DLL functionality, or getting where it has been imported?

I would like to limit who/what can use my C++ DLL. I have an .mq4 script ( or it can be anything else I guess ) and I use DLL-#import-ed functions in it. How I want to do the limitation is: there is a static filepath in the DLL, and at the begining…
rdanee
  • 109
  • 1
  • 1
  • 9
1
vote
1 answer

MQL4 offset returning different time

I have folowing code in MQL4: #property copyright "Copyright 2023, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict MqlRates bar_main_pair[]; MqlRates bar_H1[]; string main_pair…
1
vote
1 answer

Cannot get python to connect with MQL4 via ZMQ

Screenshot ofDirectory and Errors here I'm trying to built an algorithmic trading bot. First step is to establish a connection between Python and MQL4 EA. I have the dir set up correctly. As shown below and my scripts are as follows. My Python…
1
vote
0 answers

How can I enhance the ZigZag-Indicator in MetaTrader Terminal 5 to include bars and points for visualizing ranges?

Title :Enhancing ZigZag-Indicator in MetaTrader Terminal 5: Visualizing Range with Bars and Points Question : I'm looking to enhance the functionality of the ZigZag indicator in MetaTrader Terminal 5 by visualizing the range between the highest and…
1
vote
1 answer

'Hour' - wrong parameters count - mql4

I am attempting to restrict the hours during which trading can occur, but I have not been successful with my attempts so far. I would appreciate any input or suggestions on how to accomplish this. // Function to Check if Trade Time is Valid bool…
user1582596
  • 503
  • 2
  • 5
  • 16
1
vote
0 answers

Intercepting all orders with full data in MT4

I'm trying to write a trade copier for MT4. I have already written one for MT5, but the issue I'm having with translation is in intercepting active orders. In MT5, this is relatively simple: void OnTradeTransaction(const MqlTradeTransaction &trans,…
Woody1193
  • 7,252
  • 5
  • 40
  • 90
1
vote
2 answers

Weekly profit per symbol

I have created a function to calculate my weekly profit and loss. It worked as per below and I would to break it down to have the only per symbols/pairs. I have been stucked on this aggregation. Any hints are appreciated. string…
mraniki
  • 21
  • 1
  • 6