Questions from Beginners MQL5 MT5 MetaTrader 5 - page 966

 
kopeyka2:


Better still, clearly state what you want to achieve. I will probably show you a complete example.

 
jdjahfkahjf:

What does this mean?


Read the Help: Optimisation modes.

 

Can you tell me please. How is an Expert Advisor re-initialized (for example, when executing ChartSetSymbolPeriod() )?

Is it correct to understand that reinitialization actually concerns only local variables in functions.

And what are the rules for global variables?

According to my observation, global variables inherit their values after OnDeinit - OnInit pass.

It should be so?

 
User_mt5:

Can you tell me please. How is an Expert Advisor re-initialized (for example, when executing ChartSetSymbolPeriod() )?

Is it correct to understand that reinitialization actually concerns only local variables in functions.

And what are the rules for global variables?

According to my observation, global variables inherit their values after OnDeinit - OnInit pass.

It should be so?

Инициализация глобальных переменных программы и другие полезные знания.
Инициализация глобальных переменных программы и другие полезные знания.
  • 2016.11.29
  • www.mql5.com
Встал на форуме недавно вопрос по поводу верной/неверной инициализации глобальных переменных в программах...
 
Artyom Trishkin:

Thank you.

The trouble with this mql is that it's intuitively unpredictable:

- not about the global-local distinction

- nor in the matter of differences between indicators and experts.

(the last copy of the correspondence with SD was also very useful in the above discussion at the link, thanks)

 
Can anyone tell me how to programmatically expose windows in the terminal? (width, height and snapping)
 
User_mt5:
Can someone tell me how to set windows in the terminal programmatically? (Width, height and positioning).

Disconnect the window from the terminal and then try (I have not personally tried to set these properties yet):

MQL5: Added new properties for binding/detaching charts to/from the main window of the terminal and controlling their position.

Added new properties inENUM_CHART_PROPERTY_INTEGERenumeration:

  • CHART_IS_DOCKED - chart window is fixed. If set to false, the chart can be dragged outside the terminal.
  • CHART_FLOAT_LEFT - left coordinate of detached chart relative to virtual screen.
  • CHART_FLOAT_TOP - upper coordinate of the chart relative to the virtual screen.
  • CHART_FLOAT_RIGHT - right coordinate of the detached chart relative to the virtual screen.
  • CHART_FLOAT_BOTTOM - lower coordinate of the detached chart relative to the virtual screen.


AddedtoENUM_TERMINAL_INFO_INTEGER enumeration:

  • TERMINAL_SCREEN_LEFT - left coordinate of the virtual screen. Virtual screen is a rectangle covering all monitors. If there are two monitors in the system and their order is set from right to left, the left coordinate of the virtual screen may be at the boundary of the two monitors.
  • TERMINAL_SCREEN_TOP - top coordinate of the virtual screen.
  • TERMINAL_SCREEN_WIDTH - width of the terminal.
  • TERMINAL_SCREEN_HEIGHT - height of the terminal.
  • TERMINAL_LEFT - left coordinate of the terminal relative to the virtual screen.
  • TERMINAL_TOP - top coordinate of the terminal relative to the virtual screen.
  • TERMINAL_RIGHT - right coordinate of the terminal relative to the virtual screen.
  • TERMINAL_BOTTOM - bottom coordinate of the terminal relative to the virtual screen.
 
Vladimir Karputov:

Detach the window from the terminal and then try (I haven't personally set these properties yet):

Thanks.

I have tried it. It works so-so (in particular, the window is minimized, when you minimize the terminal, it disappears, but when you unfold the screen, the previously minimized one opens to its size, every time you need to minimize it again, so it doesn't loom).

But that's not it. I don't need to detach the graphs, I just need to tessellate them, for example, or whatever else I see fit. There doesn't seem to be such a thing in MT5...

(the general idea is that in multicurrency Expert Advisor I need to view trades by predefined symbols;
there is a button that opens all charts on which orders and positions are open;
but windows open uncontrollable size and I have to manually arrange them on screen;
and I, lazy, would like my intellectually unattainable program to do it :)

 
User_mt5:

Thank you.

I've tried it. It works so-so (in particular, the window is minimised, disappears when you minimise the terminal, but when you unfold the screen the previously minimised one opens to its size, every time you have to minimise it again so it doesn't loom).

But that's not it. I don't need to detach the graphs, I just need to tessellate them or something else as I see fit. There seems to be no such thing in MT5.

(the general idea is that in a multi-currency Expert Advisor one needs to view trades by predefined symbols;
there is a button opening all the charts with open orders and positions;
but the windows open uncontrollably large and I have to manually arrange them on the screen;
and I, being lazy, would like my intellectually unattainable program to do that :)

How about using WinAPI? Especially, MQL5 has introduced support for

MQL5: Support for WinAPI functions has been added to the standard library. Now, to use the functions of the operating system in MQL5 programs, you do not need to manually import libraries and describe function signatures. The header file from the MQL5\Include\WinAPI directory is sufficient.

WinAPI functions are grouped in separate files according to their purposes:

  • libloaderapi.mqh - resource handling
  • memoryapi.mqh - memory handling
  • processenv.mqh - environment handling
  • processthreadsapi.mqh - work with processes
  • securitybaseapi.mqh - operation with OS security system
  • sysinfoapi.mqh - getting system information
  • winbase.mqh - general functions
  • windef.mqh - constants, structures and enumerations.
  • wingdi.mqh - operation with graphical objects
  • winnt.mqh - exception handling
  • winreg.mqh - registry manipulation
  • winuser.mqh - window and interface control
  • errhandlingapi.mqh - error handling
  • fileapi.mqh - file handling
  • handleapi.mqh - work with handles
  • winapi.mqh - connection of all functions (WinAPI header files)


Binding works only with 64-bit architecture.

 
Vladimir Karputov:

How about using WinAPI?

I suppose. But that's where my expertise ends.

It would be nice if there was a certainty for whom mql5 - for clever or for beautiful. I'm far from smart.
To use the API, I need a description and examples. Without it the gold mountain of libraries will remain unused to me.
- I'm not able and I won't look through thousands of lines of uncommented code hoping to catch something useful.

Reason: