Questions from Beginners MQL5 MT5 MetaTrader 5 - page 391

 
smetantn1980:
Hi, can you tell me why my debugging buttons in metaeditore are not active????source has been inserted
Where is it saved? For debugging to be possible, the code must be saved in the data directory, not somewhere in the temp.
 
Vitalie Postolache:
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 about what language to write software in the mt4 terminal?
 
Kira27:
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?
Now the developers are trying to minimize the differences between the terminals. However, there are some differences, and some functions in MQL5 may not work correctly in MQL4. The "soft" for the MT4 terminal must be written in MQL4 and only in MQL4. It simply looks very similar to MQL5 now. Refer to the help for the language.
 

Vitalie Postolache:
А где он сохранён? Чтобы отладка была возможна, код должен быть сохранён в каталоге данных, а не где-то в темпе.

the advisor is located in the programme folder as usual in the Expert folder and is on the chart

 
Kira27:
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.

 
thanks a lot I didn't open this EA from the terminal so the debugging was not active
 
advise how to set the EA to show the total volume in lots on the screen for sell and buy
 

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!

Автоматическая оптимизация торгового робота в процессе реальной торговли
Автоматическая оптимизация торгового робота в процессе реальной торговли
  • 2007.04.16
  • Igor Malcev
  • www.mql5.com
В статье описана и представлена библиотека функций, позволяющая проводить оптимизацию входных параметров советника, запуская оптимизацию непосредственно из советника.
 
smetantn1980:
How can I write in my EA so that the total volume in lots for sell and buy is displayed on the screen?
If you get the total number of orders in the terminal, go through all orders (I think this is a question about mql4) and select those that satisfy the conditions (symbol, magik and type) and sum them up in variables for buy and sell. Then you create two OBJ_LABEL objects (I think so). Set their position, colour and other properties (see documentation). Change the description of these objects with the values received in the sell and buy variables. That's it.
 
smetantn1980:
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()

Reason: