Questions from Beginners MQL5 MT5 MetaTrader 5 - page 391
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi, can you tell me why my debugging buttons in metaeditore are not active????source has been inserted
Most likely, the functions mentioned are custom functions and ME does not need to know them. It is up to you to declare and call them correctly.
The functions are not user-defined. Answer, if you don't mind, the question of what language to write software in in the mt4 terminal?
Vitalie Postolache:
А где он сохранён? Чтобы отладка была возможна, код должен быть сохранён в каталоге данных, а не где-то в темпе.
the advisor is located in the programme folder as usual in the Expert folder and is on the chart
These functions are not user-defined. If you don't mind, what language should be used for writing a soft in the mt4 terminal?
Yes, not custom, these are functions from MQL5. For MQL4 you will need to find other ones, or write similar, but custom ones.
For example, OrderGetTicket() MQL5 -> OrdetTicket() MQL4.
Hi all!
A few questions from a newcomer.
1. The difference between Mql4 and Mql5 (website and programming language itself). There is Metatrade 4 and Metatrader 5 with Mql4 and Mql5 embedded respectively. There are also two different corresponding websites. At the same time, all those Expert Advisors I looked at in MT4 lead to that site. Which one is more relevant? Which forum is "livelier"? Where is the best place to post questions? Is there a backward compatibility between different versions of MT and Mql? I personally am currently writing my MT4 Expert Advisor on Mql4 respectively. This is due to the fact that the broker I'm using for testing the demo with is using MT4. How can I identify the language in which my Expert Advisor is written? I mean by extension only (.mq4 and .mq5). If I rename a file, will it compile (again, about compatibility)?
2. Dynamic External Expert Advisor Parameters. Is it possible to dynamically change adjustable parameters of an Expert Advisor? Let me explain... For example, there is an external parameter extern bool a. If it is true, an additional parameter extern int b shall be set. If a=false, the parameter b is not needed. Is there any way to display/not display it depending on the current value of a selected? Taking into account that I could not find any external parameter change handlers and there is no #if ... #endif, I suspect it cannot be done... If so, but could you suggest the best way to proceed in this situation, so as not to overload the process of setting external parameters? For example, I may put a=false, forget that the parameter b is not used, but still include it into optimization (although there would be no point, it would only waste extra time). And it's one thing when there is only one such parameter b. But if, for example, I make an enum external parameter and there are several drop-down variants of TC. They have a common part (therefore it is logical to implement them inside one EA, rather than write several), but there are also different ones with many different parameters. Then it's very easy to confuse which parameters are relevant to the selected TS.
Automatic optimization of Expert Advisor. IMHO, it's very useful and useful. I found this article. However, as far as I understand, the second instance of MT is used that is run for optimization from outside (from a running instance of MT) and the optimization results are read from the report in the form of html. This is not very convenient and crooked. Logically I should write my own optimization function/dll and run it directly from the Expert Advisor. So here is the question. As far as I understood, a genetic optimization algorithm was programmed into the strategy tester. I know about these algorithms very briefly. But they have been known for a long time, hence the question - why reinvent the wheel?) Is there a ready-made algorithm that is used directly in MT? Maybe it already exists somewhere in the libraries of the terminal itself... Maybe there is a separate source code or ready dll. In general, please share your experiences in this matter.
That's all for now...). I hope I didn't put too much stress on the amount of words).
Thanks in advance for replies!
How can I write in my EA so that the total volume in lots for sell and buy is displayed on the screen?
Please advise how to spell it so that the total volume in lots for buy and sell is displayed on the screen
I'm not sure exactly, as I'm still a beginner myself. But it seems that there is a command Comment, which displays any information in the upper left corner of the EA chart. The volume of lots can be calculated in the cycle like this:
int totalOrders = OrdersTotal();
double totalLots = 0;
for(int i=0; i<totalOrders; i++)
if ( (OrderSelect(i, SELECT_BY_POS)) && (OrderMagicNumber() == myMagicNumber) )
totalLots += OrderLots();
Comment("totalLots=", totalLots);
This is a common code for all trades. For buy and sell, you create separate variables and make a switch using OrderType()