Questions from Beginners MQL4 MT4 MetaTrader 4 - page 177

 
Alexander Fedosov:
It is strange. I don't remember these functions in mt4 before. Have they been added to fives as well?

https://docs.mql4.com/ru/series/copytime

ZZY: MQL4 and MQL5 metaquotes are as close as possible to each other (I think the difference is 10-15 functions between the languages), someone from the developers wrote that MQL5 / MQL4 compilers are now completely the same

CopyTime - Доступ к таймсериям и индикаторам - Справочник MQL4
CopyTime - Доступ к таймсериям и индикаторам - Справочник MQL4
  • docs.mql4.com
Функция получает в массив time_array исторические данные времени открытия баров для указанной пары символ-период в указанном количестве. Необходимо отметить, что отсчет элементов от стартовой позиции ведется от настоящего к прошлому, то есть стартовая позиция, равная 0, означает текущий бар. При копировании заранее неизвестного количества...
 
Alexander Fedosov:
That's odd... I don't remember there being these features in mt4 before. Were they added to fives too?

With the arrival. How's that?

 
Artyom Trishkin:

Happy arrival. How's it going?


 

Hello!

Can you please tell me where to find documentation on plugin development?

 
Alekseu Fedotov:

Checked it, fixed it, it's working.

Please tell me where the error was?
 
Zelimhannahal00:
Please tell me where the mistake was?

The one I suggested you fix

 

how do I find the last digit of a whole number?

101 --> 1

267 --> 7

?

PS: Spun around in my head for 20 minutes, no solution ((((

 
Igor Makanu:

how do I find the last digit of a whole number?

101 --> 1

267 --> 7

?

PS: Spun around in my head for 20 minutes, no solution ((((

- convert to string and take the extreme digit
- divide by 10, take the remainder - %

 
Taras Slobodyanik:

- divide by 10, take the remainder - %.

Yes, that's it, forgot about the % thank you!

void OnStart()
  {
   srand(GetTickCount());
   for(int i=0;i<10;i++)
     {
      int x = rand();
      int y = x%10;
      printf("x = %d , y = %d",x,y);
     }
  }

2019.06.19 23:09:28.616 tst EURUSD,H1: x = 2183 , y = 3

2019.06.19 23:09:28.616 tst EURUSD,H1: x = 937 , y = 7

2019.06.19 23:09:28.616 tst EURUSD,H1: x = 4429 , y = 9

2019.06.19 23:09:28.616 tst EURUSD,H1: x = 10711 , y = 1

2019.06.19 23:09:28.616 tst EURUSD,H1: x = 277 , y = 7

2019.06.19 23:09:28.616 tst EURUSD,H1: x = 599 , y = 9

2019.06.19 23:09:28.616 tst EURUSD,H1: x = 30829 , y = 9

2019.06.19 23:09:28.616 tst EURUSD,H1: x = 31826 , y = 6

2019.06.19 23:09:28.616 tst EURUSD,H1: x = 24988 , y = 8

2019.06.19 23:09:28.616 tst EURUSD,H1: x = 27340 , y = 0

 
Igor Makanu:

how do I find the last digit of a whole number?

101 --> 1

267 --> 7

?

PS: Spent 20 minutes thinking about it, no solution ((((

the problem got more complicated... it didn't add up in my head overnight... I guess I'm not Mendeleev, so I can't do complex problems in my sleep )))


how to find the penultimate digit in the whole number!

101 --> 0

267 --> 6

?

Will it work or am I missing something?

void OnStart()
  {
   srand(GetTickCount());
   for(int i=0;i<10;i++)
     {
      int x = rand();
      int y = (x%100 )/10;
      printf("x = %d , y = %d",x,y);
     }
  }