Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 809

 
Seric29:

Can you show me how to expand a loop without creating variables?

Unwrap, i.e. do it backwards - do not start from zero but froman ArrayRange

and decrease the counter

for(int i=ArrayRange(arr2,0)-1; i>=0; i--)
 

Where can I find information on creating trading panels with examples etc.?

Help with writing code for a panel like this:

***
 
Oligarhi2016:

Where can I find information on creating trading panels with examples etc.?

Help with writing code for a panel like this:

***

Use the message editor functions:

Use themessage editor commands to format text and insert images/codes/tables:

 
Vladimir Karputov:

Use the message editor functions:

Use themessage editor commands to format text and insert images/codes/tables:

where "form" is the name of the panel itself and text_field_1 to text_field_10 is the place where different data will be displayed ( average price for a certain period of time, maximum price, minimum price, SL, TP and so on...) which will change periodically depending on the market situation

For better understanding of what I'm talking about, please reserve these names:

for the panel name (form): imya_paneli

names for displayed data in text fields: teckstovoe_pole_1 to teckstovoe_pole_10

names of text fields (leave them as they are (EURUSD, GPBUSD, SL, TP, M1, M2, M3, M4, M5, M6))

And perhaps the most important point: the form should not be transparent, i.e. in the place where the form will be displayed, you can not see candles inside the form itself.


PS apologies, I had to attach a picture, because I can't insert it into messages using message editor functions

I tried all variants, BB codes and html variant, I must be doing something wrong... A button to insert an image somehow is not displayed in the function panel of message editor. I attached a screenshot just in case

Files:
 
Does debugging work in MQL4, I'm tired of putting the Print function on every second line, and if so, where can I find out how to use it?
 
Is it true that prefix increment ++i is faster than postfix i++ rumoured to be up to 10% different?
 
There is a current date (15.04.2019) and a manually entered date, e.g. 26.04.2019.... how do i calculate the number of days with days off to make 10 days?
 
ponochka:
There is a current date (15.04.2019) and a manually entered date, e.g. 26.04.2019.... how to calculate the number of days with the weekend to get 10 days???
int  Bars(
   string           symbol_name,     // имя символа
   ENUM_TIMEFRAMES  timeframe,       // период PERIOD_D1
   datetime         start_time,      // с какой даты
   datetime         stop_time        // по какую дату
   );

Check if it will work with the time in the future. Otherwise only by checking on the day of the week and adding up without days off.

Bars - Доступ к таймсериям и индикаторам - Справочник MQL4
Bars - Доступ к таймсериям и индикаторам - Справочник MQL4
  • docs.mql4.com
Если указаны параметры start_time и stop_time, то функция возвращает количество баров в диапазоне дат. Если эти параметры не указаны, то функция возвращает общее количество баров. Если данные для таймсерии с указанными...
 
Seric29:
Is it true that prefix increment ++i works faster than postfix i++ rumoured to be 10% difference?

check it yourself, here is a good examplehttps://www.mql5.com/ru/forum/287618/page15#comment_9810652

If you need more performance in calculations - definitely MQL5, only pure C++ can outrun it


Seric29:
Does debugging work in MQL4, I'm tired of shoving the Print function on every second line, if so where to see how to use it?

https://www.metatrader5.com/ru/metaeditor/help/development/debug

It works the same for MT4, but it seems that debugging on history does not work, but for normal tasks - breakpoint and look at variables all works in MT4 without problems

Получаем количество десятичных знаков после запятой любых чисел (не только котировок) в обход Digits() на MQL4 и MQL5
Получаем количество десятичных знаков после запятой любых чисел (не только котировок) в обход Digits() на MQL4 и MQL5
  • 2018.12.07
  • www.mql5.com
Думаю не у одного меня была редкая ситуация когда нужно было получить количество десятичных знаков после запятой, а функция Digits() работает тольк...
 

I looked through the Include folder and couldn't find how functions like ArrayResize() orArrayCopy() are arranged.As it became clear to me they are used there by default, here is an example of code

//+------------------------------------------------------------------+
//| Resizing (with removal of elements on the right)                 |
//+------------------------------------------------------------------+
bool CArrayDouble::Resize(const int size)
  {
   int new_size;
//--- check
   if(size<0)
      return(false);
//--- resize array
   new_size=m_step_resize*(1+size/m_step_resize);
   if(m_data_max!=new_size)
     {
      if((m_data_max=ArrayResize(m_data,new_size))==-1)
        {
         m_data_max=ArraySize(m_data);
         return(false);
        }
     }
   if(m_data_total>size)
      m_data_total=size;
//--- result
   return(m_data_max==new_size);
  }

taken from the file ArrayDouble.mqh, there is no access to these functions and even vice versa they are used in the design of other functions or mechanisms. I looked at other files and did not understand how to get access to the internal code of functions such as ArrayResize() orArrayCopy(), who knows how to look at the internal code of these functions?

Reason: