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

How to define global macro pointing to the static class method of the same name?

I've the following MQL4/5 code: class MQL4 { public: static double Ask() { MqlTick _tick; SymbolInfoTick(_Symbol, _tick); return _tick.ask; // Overriding Ask variable to become a function call. #define Ask MQL4::Ask() …
kenorb
  • 155,785
  • 88
  • 678
  • 743
0
votes
1 answer

Is it possible to undefine or replace the existing enum?

For example there is a ENUM_INDICATOR type which I'd like to undefine and replace with my own, e.g. #undef ENUM_INDICATOR #undef IND_AC #undef IND_AD #undef IND_AC #ifndef ENUM_INDICATOR enum ENUM_INDICATOR { IND_AC, IND_AD, …
kenorb
  • 155,785
  • 88
  • 678
  • 743
0
votes
1 answer

Where does MQL4 / MQL5 implementation of originally C++ AVL Tree Parent node exhibit an issue?

I dont know where I am having an issue, but I am getting a strange error in my AVL implementation, translated into MQL4/MQL5 language. In failed case, I am getting into either recursively pointing to same node problem or a detached node without…
VyshuRam
  • 93
  • 1
  • 10
0
votes
1 answer

Alternative to MQL5

I am starting with Expert Advisors on MetaTrader Terminal software and I have many algorithms to use with it. These algorithms were developed in MATLAB using its powerfull built in functions ( e.g. svd, pinv, fft ). To test my algorithms I have…
ViniciusArruda
  • 970
  • 12
  • 27
0
votes
1 answer

OnTesterInit works too long

When running an optimization on Metrader 5 I get the following error message : OnTesterInit works too long... This error occurs 5 times and is then followed the following : OnTesterInit works too long. Tester cannot be initialized. There are…
Freek Nortier
  • 780
  • 1
  • 13
  • 27
0
votes
2 answers

Can't make iteration with #property strict

I have this code working without error. Basically, this code is to show value of Moving Averages on five previous bars per 5 minutes. MA's current value is omitted. int TrendMinDurationBar = 5, SlowPeriod = 14, …
R. Silver
  • 1
  • 2
0
votes
1 answer

How to calculate a streak duration?

I have made a code to calculate a streak duration (ConnorsRSI) in MQL5. But it doesn't work. The MQL code is: ///////////////////////////////////////////////////////// int OnCalculate(const int rates_total, const int prev_calculated, const int…
0
votes
1 answer

How to draw a trend line on the chart?

I want to draw a trend line on the chart in MQL5. I tried it with this method: ChartIndicatorAdd(0,0,handle); However, it did not work and getting below error:- runtime error (4107)
Martin Koner
  • 3
  • 1
  • 2
0
votes
6 answers

How to put spaces in variable names?

I want to learn how to add spaces in variable names. I know that a lot languages prevent me from doing this, but I believe that there is a trick to do this because I saw someone did it in MQL5 A MetaTrader Terminal allows to show a UI-Dialogue Panel…
Yassin Mokni
  • 354
  • 1
  • 6
  • 16
0
votes
2 answers

MQL5: how do I automatically delete all un-triggered pending orders before placing new orders?

I am working on a Project that requires me to place a BUYSTOP and a SELLSTOP pair of orders and then on the next bar if those orders are not triggered, then delete them and place fresh ones. Here is my code: if(logic == true && OrdersTotal() == 0) …
mmdel
  • 1,279
  • 4
  • 21
  • 30
0
votes
1 answer

how do i declare variables, compare them and then use them inside a function

i am developing an ea that requires me to compare the high of previous 2 bars and whichever one is higher, use that as a stop loss value. same for opposite side trades, i need to compare previous 2 lows and use the lower one as stop loss value. what…
mmdel
  • 1,279
  • 4
  • 21
  • 30
0
votes
1 answer

mql4 : coding empty buffer in line

so I make some coding and now have empty buffer I want to ask how to feel EMPTY_BUFFER so if use IF line == EMPTY BUFFER then FILL IT..i already try some coding but still not fill the empty buffer #property strict #property indicator_level1…
Reza Rahmad
  • 13
  • 1
  • 6
0
votes
1 answer

Calculate the everyday difference between the highest and lowest price

I have a simple task: Calculate the daily difference between highest price and lowest difference and print the result in the console. So far I can only successfully do: void OnTick() { //--- SymbolInfoTick("EURUSD", tickInfo); …
Nicolas S.Xu
  • 13,794
  • 31
  • 84
  • 129
0
votes
1 answer

annotate charts using mql4 or mql5

In the near future I will begin trading. Looking at all the different brokers the trading platform used is MetaTrader 4 or 5, which is fine. I believe it is possible to carry out back testing using mql 4 or 5. However to save time I intend to…
mHelpMe
  • 6,336
  • 24
  • 75
  • 150
0
votes
1 answer

Finding last wave in mql4/5

I was wondering if there's an efficient and easy way to determine waves in MQL4, just like zigzag indicator does it. I was asked to help automate indicator, for that I need to determine 'waves', essentially max and min of a graph over some period of…
akalikin
  • 1,071
  • 12
  • 35
1 2 3
26
27