Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1119

 
pivomoe:
Can you tell me how to make a pause of 1 millisecond? Sleep(1) is not an option because it pauses from 0 to 50 milliseconds or so. When calling with parameter 1.
In documentation it is written, that in connection with technical nuances to receive a pause less than 16-18 milliseconds is not real. This is related to hardware, OS, etc.
 
BlackTomcat:
It is written in the documentation that due to technical nuances it is not realistic to get a pause of less than 16-18 milliseconds. This is related to hardware, OS, etc.
I have about 1, sometimes 2,3, depending on the load.
 
Aliaksandr Hryshyn:
I have about 1, sometimes 2,3, depending on workload.

? google: winds system timer, for questions or misunderstandings why less than 16ms is not possible, in short - winds is not a real-time system, only the timer from winds is available to software

 
Igor Makanu:

? google: winds system timer, for questions or misunderstandings why less than 16ms is not possible, in short - winds is not a real-time system, only the timer from winds is available to software

16 is a lot, but bearable. It can be more than 50.
 
pivomoe:
16 is a lot, but bearable. Sometimes more than 50.

Once again, the wind is not a real time system, not enough resources OS, your timer will be delayed but will still be executed, use logical time intervals, I do not use less than 100 ms, and usually use 400 ms, even for a call dll with graphics and processing clicks checkboxes 400 ms is not noticeable at all, checked 500 ms - yes it is already visible that no response

imho, i wouldn't expect less than 100 ms to be guaranteed from a timer

 
Less than 100 ms is a bummer. 400 is better.
 

Can you tell me how to display an information message on the screen without waiting for the OK button to be pressed?

There is of course a MessageBox function, but it waits for a reaction and stops the execution of the program.

 
pivomoe:

Can you tell me how to display an information message on the screen without waiting for the OK button to be pressed?

There is of course a MessageBox function, but it waits for a reaction and stops the execution of the program.

Yes Alert, I think. Just be sure to read the last paragraph.

https://www.mql5.com/ru/docs/common/alert

Документация по MQL5: Общие функции / Alert
Документация по MQL5: Общие функции / Alert
  • www.mql5.com
[in]  Любые значения, разделенные запятыми. Для разделения выводимой информации на несколько строк можно использовать символ перевода строки "\n" либо "\r\n". Количество параметров не может превышать 64. Массивы нельзя передавать в функцию Alert(). Массивы должны выводиться поэлементно. Данные типа double выводятся с 8 десятичными цифрами после...
 
BlackTomcat:

Yes Alert, I think. Just be sure to read the last paragraph.

https://www.mql5.com/ru/docs/common/alert

Thank you. Just what I need.

 

Good afternoon. Please advise or provide me with a link. How to organize an indicator that would show the balance changes as a candlestick chart in a separate window. I have done the simplest thing, the indicator copies the price changes, but now how to replace the price changes with the changes in the balance, in other words, to replace the arrays used by the indicator.

If you have any ideas, please share them, I will be grateful even for a general description of the algorithm, I lack experience, I do not know where to start.

//+------------------------------------------------------------------+
//|                                                iBalans_Logic.mq5 |
//|                                              Sergei Voicehovskii |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Sergei Voicehovskii"
#property link      ""
#property version   "1.00"
//------------------------------------------------------------------
#property indicator_separate_window
#property indicator_buffers 6
#property indicator_plots   1
#property indicator_label1  "iBalans_Logic"
#property indicator_type1   DRAW_COLOR_CANDLES
#property indicator_color1  clrGray,clrDodgerBlue,clrSandyBrown
//--- indicator buffers
//--- индикаторный буфер
double opn[],hi[],lo[],cls[],clr[],lot[],type[];
//------------------------------------------------------------------
// Custom indicator initialization function
// Функция инициализации пользовательского индикатора
//------------------------------------------------------------------
int OnInit()
  {
   SetIndexBuffer(0,opn,INDICATOR_DATA);
   SetIndexBuffer(1,hi,INDICATOR_DATA);
   SetIndexBuffer(2,lo,INDICATOR_DATA);
   SetIndexBuffer(3,cls,INDICATOR_DATA);
   SetIndexBuffer(4,clr,INDICATOR_COLOR_INDEX);
   SetIndexBuffer(5,lot,INDICATOR_CALCULATIONS);
   SetIndexBuffer(6,type,INDICATOR_CALCULATIONS);
   IndicatorSetString(INDICATOR_SHORTNAME,"iBalans_Logic ("")");
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function    
//| Функция итерации пользовательского индикатора                          |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
//---
Comment("-------------------------", 
        "\n rates_total        = ",rates_total,
        "\n prev_calculated = ",prev_calculated,
        "\n ---------------------- "
       ); 
//---
int i=(int)MathMax(prev_calculated-1,0);

   for(;i<rates_total && !_StopFlag; i++)
     {
     
       opn[i] = open[i];
       cls[i] = close[i];
        hi[i] = high[i];
        lo[i] = low[i];
       clr[i] = (cls[i]>opn[i])?1:(cls[i]<opn[i])?2:0;
     }
//--- return value of prev_calculated for next call
//--- возвращаемое значение соответствует моменту prev_calculated для следующего вызова
return(rates_total);
}
//+------------------------------------------------------------------+

https://charts.mql5.com/22/192/eurusd-m1-alpari-international-2.png