Questions from Beginners MQL5 MT5 MetaTrader 5 - page 849

 
Vladislav Andruschenko:
Thank you very much, very helpful.
 

Can anyone help to fix EA code on MT5?

I've read the manuals, but I can't beat 2 varnings when compiling.

declaration of 'xxxx ' hides global declaration

и

possible loss of data due to type conversion

EA attached
Files:
r1rvcc.mq5  32 kb
 
ilyav:

Can anyone help to fix EA code on MT5?

I've read the manuals, but I can't beat 2 varnings when compiling.

declaration of 'xxx ' hides global declaration

possible loss of data due to type conversion

EA application

I haven't looked at the code, but it's simple and straightforward. The warning says that the local variable in the function has exactly the same name as the global variable in such and such line (the line number is written in the warning). Set a different name for the local variable in the function. Or rename the global variable - there will be errors in the code pointing to all occurrences of the renamed global variable - just replace its name in all places in your code.

 
ilyav:

Can anyone help to fix EA code on MT5?

I've read the manuals, but I can't beat 2 varnings when compiling.

declaration of 'xxxx ' hides global declaration

и

possible loss of data due to type conversion

Appendix Appendix tip

declaration of 'xxxx ' hides global declaration

tells me that this variable has already been declared globally. rename it to a function so it doesn't get varnished

possible loss of data due to type conversion

indicates that the "left" type is not the same as the "right" type.

e.g:

        Ticket = HistoryOrderGetTicket(i);  // получим тикет очередного ордера

Ticket = long

and HistoryOrderGetTicket = ulong

 
Experts, please explain:ChartRedraw(0) function and update in the context menu of the chart is the same action? I thought it was the same, but the chart updates from the context menu, but I can't do it with the function.
 
khorosh:
Experts, please explain: ChartRedraw(0) function and update in the context menu of the chart is the same action? I thought it was the same, but the chart updates from the context menu, but I can't do it with the function.
ChartRedraw() redraws graphical objects of the specified chart, but does not update data from server.
 
Artyom Trishkin:
ChartRedraw() redraws the graphical objects of the specified chart rather than updating the data from the server.

And the indicator curves that are drawn using buffers, should it update? I have a homemade curve indicator that doesn't update until I make a chart update via the context menu. How can I automate such an update which takes place using context menu?

 
khorosh:

And the indicator curves that are drawn using buffers, should it update? I have a homemade curve indicator that doesn't update until I make a chart update via the context menu. How can I automate such an update that happens when I use the context menu?

Edit the curve indicator. You can only draw a line when it is fully recalculated, which is done using the context menu command.
 
Artyom Trishkin:
Fix the curve indicator. It can draw a line only at full re-calculation, which is performed by the context menu command.

So it turns out that there is no function similar to "refresh"? Another question: how to make the function of removing objects placed in deinit() be executed only when removing the indicator from the chart?

 
khorosh:

So it turns out that there is no function similar to "refresh"? Another question: how to make the deinit() functions run only when the indicator is deleted from the chart?

There is also mql4.

Документация по MQL5: Стандартные константы, перечисления и структуры / Именованные константы / Причины деинициализации
Документация по MQL5: Стандартные константы, перечисления и структуры / Именованные константы / Причины деинициализации
  • www.mql5.com
//| get text description                                             | //| Expert deinitialization function                                 |
Reason: