Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1393

 

I have this question.

There is a class in the standard CButton library - a button. Is it possible to set its appearance? For example, is it possible to make it three-dimensional (so it won't be a simple rectangle that changes colour, but looks like a button)?

 
MQL_User #:

I have this question.

There is a class in the standard CButton library - a button. Is it possible to set its appearance? For example, is it possible to make it three-dimensional (so that it won't be a simple rectangle that changes colour, but looks like a button)?

You can use another class:CBmpButton- you can set your own image in it. Draw a picture for the state of the button and it will be beautiful.

Документация по MQL5: Стандартная библиотека / Панели и диалоги / CBmpButton
Документация по MQL5: Стандартная библиотека / Панели и диалоги / CBmpButton
  • www.mql5.com
CBmpButton - Панели и диалоги - Стандартная библиотека - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Vladimir Karputov #:

Another class is suitable for you:CBmpButton- you can set your own picture in it. Draw a picture for the state of the button and it will be beautiful.

Vladimir, thank you. That would be an interesting variant.

But it would require having two bmp-files at hand - one for the pressed button and the other for the released one. And the right size. If more than one button is used and all of them have different size, then I have to have 2 bmp-files for all of them. And all this should be stored somewhere...

So, the idea is certainly interesting, but it's not without its drawbacks.

I thought that the CButton class had some sort of property that would define whether the button was bulky or flat...

 
Hello, could you please tell me where and how I can get M1 historical data for a long period (since 2015) to use in the MT5 tester for instruments such as indices, commodity futures, energy, metals?
 
Rost17 #:
Hi! Can you please tell me where and how I can get M1 historical data for a long period (since 2015) to use in the MT5 tester for instruments such as indices, commodity futures, energy, metals?

In MetaTrade 5 you don't need to "take anything from somewhere" - as soon as you connect to the trading server, all the history is available to you.

The other issue - and this is a do-it-yourself assignment: you have to find a broker that provides that history.

 
How do I get the number of sessions (trading/quoting sessions)? I see SymbolInfoSessionQuote() and SymbolInfoSessionTrade() methods where session index is the parameter. But how to get the number of sessions?
 

How do I know that the Bars() function has returned the correct (final) value?

The peculiarity is as follows.

If the indicator remains in the window when the terminal is switched off, at next switching on at initial execution period

the Bars() function returns the current number of bars, for example, 5000 bars out of 20000 specified in the settings.

How do I know that the approximation process has already been completed?

 
leonerd #:
How many sessions (trading / quote) to get? I see SymbolInfoSessionQuote() and SymbolInfoSessionTrade() methods where session index is the parameter. But how to get the number of sessions?

It's not clear how to use these methods at all, if it's impossible to know exactly which session to request, how many there are, etc.

4307 error when requesting a session that doesn't exist. It turns out that in order to find out the number of sessions, you have to go through all indexes, starting from 0 and up to this error.

 

Hello.

Question about the documentation.

example from there:

//--- бесконечный цикл 
void OnStart() 
  { 
   uchar  u_ch;
 
   for(char ch=-128;ch<128;ch++) 
     { 
      u_ch=ch; 
      Print("ch = ",ch," u_ch = ",u_ch); 
     } 
  }

Result:

   ch= -128  u_ch= 128 
   ch= -127  u_ch= 129 
   ch= -126  u_ch= 130 
   ch= -125  u_ch= 131 
   ch= -124  u_ch= 132 
   ch= -123  u_ch= 133 
   ch= -122  u_ch= 134 
   ch= -121  u_ch= 135 
   ch= -120  u_ch= 136 
   ch= -119  u_ch= 137 
   ch= -118  u_ch= 138 
   ch= -117  u_ch= 139 
   ch= -116  u_ch= 140 
   ch= -115  u_ch= 141 
   ch= -114  u_ch= 142 
   ch= -113  u_ch= 143 
   ch= -112  u_ch= 144 
   ch= -111  u_ch= 145 
    ... 

Please explain why

   ch= -127  u_ch= 129 

instead of

   ch= -127  u_ch= 127 

?

 
Sergey #:

Hello.

Question about the documentation.

example from there:

Result:

Please explain why

instead of

?

Representation of negative numbers in supplementary code. https://ru.wikipedia.org/wiki/%D0%94%D0%BE%D0%BF%D0%BE%D0%BB%D0%BD%D0%B8%D1%82%D0%B5%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9_%D0%BA%D0%BE%D0%B4_(%D0%BF%D1%80%D0%B5%D0%B4%D1%81%D1%82%D0%B0%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5_%D1%87%D0%B8%D1%81%D0%BB%D0%B0)