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

 
novichok2018:

Hello!

I have found on forum a functionthat calculates how many points a price has passed for a certain number of seconds int ItemsPerSecond(const int seconds,MqlTick&tick). I put it into code and compiled it - everything is OK, but when I try to call it, the compiler generates wrong parameters count.

What am I doing wrong?

You don't:

Документация по MQL5: Основы языка
Документация по MQL5: Основы языка
  • www.mql5.com
Язык MetaQuotes Language 5 (MQL5) является объектно-ориентированным языком программирования высокого уровня и предназначен для написания автоматических торговых стратегий, пользовательских технических индикаторов для анализа разнообразных финансовых рынков. Он позволяет не только писать разнообразные экспертные системы, предназначенные для...
 
novichok2018:

What happened?

Is everyone asleep, or are they extinct?

Laughing :)

 
Artyom Trishkin:

You don't read:

Igor Makanu:writing answers to absurd questions is lazy

Gentlemen "smart guys"!

You keep forgetting which forum thread you are in. I can remind: the branch is called"Any questionsof newbies...". And if you think you can help newbies (you're not here to show off, are you?), then there's no need to squeamishly answer questions that seem silly and absurd to you, and which are difficult for a newbie to understand without your help.

It's no use - even if I read "function call" in Language Fundamentals twenty times, I still don't understand what parameters should be entered in this particular case.

So, maybe someone will rise above the squeamishness and give me some specific advice?

Thank you.

 
novichok2018:

Gentlemen "clever people" !

You keep forgetting which forum thread you are in. I can remind you: the thread is called"Any questions from newbies...". And if you think you can help newbies (you're not here to show off, are you?), then there's no need to squeamishly answer questions that seem silly and absurd to you, and which are difficult for a newbie to understand without your help.

It's no use - I read "function call" in Language Studies at least twenty times, and I still don't understand what parameters should be entered in this particular case.

So, maybe someone will rise above the squeamishness and give me some specific advice?

Thank you.

How could I forget if this is my branch? :)

"Anything" doesn't mean we can talk about the strength of the drinks... Any, rather "meaningful" questions. And what you're asking is the basics of any programming language, and you've just stumped people with your question - should I start teaching you the basics? But that's beyond the scope of both this thread and the forum itself.

I gave you a link to help - you turn your nose up. Accordingly, with this attitude to those who show you the way leading to knowledge, rather than "just to do everything for you", you'll long shake people saying "why are you silent, no one knows or what?

The Help is all about functions and their formal parameters. And, sorry, there are tons of examples in CodeBase. Open any code and look for definition of any function that has formal parameters and see how it is called...

Well, it's easy - just do not be lazy and do not wait for manna from heaven, and at least stir your own gray matter.

I didn't graduate from the academy... I got out of the army and got interested in writing programs for XZ Spectrum. In BASIC... and I got to the point where I was writing programs for it in assembler, and then it went on and on.

And there were no forums, and we shared the internet between the three of us (one today, the other tomorrow, and me the day after tomorrow). And the Internet was expensive, and also via a modem over telephone wires.
I bought programming books at a radio flea market. Now my brother, who graduated with a degree in programming, is asking me for advice on how and what to do.
But I wanted to learn, I was passionate about it. What about you? And you, in my opinion, need someone to do everything for you.

 
Artyom Trishkin:

I didn't graduate from academia... I got out of the army and got interested in writing programs for XZ Spectrum. In BASIC... and I got to the point where I was writing programs for it in assembler, and then it just went on and on.

There were no forums and we shared the Internet between the three of us (one today, the other tomorrow, and me the day after tomorrow). And the Internet was expensive, and also via a modem over telephone wires.
I bought programming books at a radio flea market. Now my brother, who graduated with a degree in programming, is asking me for advice on how and what to do.
But I wanted to learn, I was passionate about it. What about you? And you, in my opinion, need someone to do everything for you.

Kudos to you for your persistence and determination. All you said is certainly worthy of respect, but to demand the same from everyone else is senseless. Moreover, not everyone who wants to write their own robot tries to learn programming language. As I said above, I don't have such a goal. If you have a question how to do this or that, you look for a solution in reference books, textbooks, forums, without going too deep into the subject. Perhaps that is why situations like this arise, when seemingly elementary things are suddenly not clear. Of course, by "wiggling the grey matter" I will still find a solution. Yes, perhaps having dug through "tons of examples inCodeBase" and wasting much time. But it becomes unclear why you created this thread and why you called it that way if instead of stated help to newbies you make them dig deep into studying the language. You should have called it that - "learning MKL4 and MKL5 together". I think no one wants to be helped, it's enough to explain what's what or give a concrete hint, not a link to a textbook. If a person needs someone to do something for him/her, he/she should specifically say: please write me something and so on.

Well, he should have done it for nothing. Good luck in your further development.

 
novichok2018:

Kudos to you for your tenacity and determination. All you have said is certainly worthy of respect, but I think it makes no sense to demand the same from everyone. Moreover, not everyone who wants to write their own robot tends to learn programming language. As I said above, I don't have such a goal. If you have a question how to do this or that, you look for a solution in reference books, textbooks, forums, without going too deep into the subject. Perhaps that is why situations like this arise, when seemingly elementary things are suddenly not clear. Of course, by "wiggling the grey matter" I will still find a solution. Yes, perhaps having dug through "tons of examples inCodeBase" and wasting much time. But it becomes unclear why you created this thread and why you called it that way if instead of the stated help to newbies you make them dig deep into studying the language. You should have called it that - "learning MKL4 and MKL5 together". I think no one wants to be helped, it's enough to explain what's what or give a concrete hint, not a link to a textbook. If a person needs someone to do something for them, they specifically say: please write me so-and-so.

Well, he should have done it for nothing. Good luck in your further development.

There is a lot of resentment in your words. But you haven't even shown your function.
 
Artyom Trishkin:
There's a lot of resentment in the words. But you haven't even shown your function.

It's not resentment, it's frustration. It's a long time since I was a child to be offended. And no one asked for the feature, you got all sarcastic.

Well, here's the function:

int ItemsPerSecond(const int seconds,MqlTick &tick)
{
//---
   static MqlTick rates[];
   datetime time_start;
   int count=0,size;
   bool insert=false;
   double price_start=0;
   long msc=0;
//---
   time_start=TimeCurrent()-seconds;
   
   for(int i=0;i<ArraySize(rates);i++)
   {
      if(rates[i].time>0 && rates[i].time<time_start)
      {
         ZeroMemory(rates[i]);
      }
      else if(!insert && rates[i].time==0)
      {
         rates[i]=tick;
         insert=true;
      }
      if(rates[i].time_msc>0 && (rates[i].time_msc<msc || msc==0))
      {
         price_start=rates[i].bid;
         msc=rates[i].time_msc;
      }
      
   }
   if(!insert)
   {
      size=ArraySize(rates);
      ArrayResize(rates,size+1,300);
      rates[size]=tick;
   }
   if(price_start>0)count=(int)((tick.bid-price_start)/Point);
   
   Comment("size: "+IntegerToString(ArraySize(rates))+"\r\n"+"count: "+IntegerToString(count));
//---
   return(count);   
} 

and here's how I'm trying to call it:

void OnTick()
  { 
  ItemsPerSecond(3); 
  }

3 is three seconds (I think).

 
novichok2018:

I found a function on the forum,which counts how many points the price passed for a certain number of seconds int ItemsPerSecond(const int seconds,MqlTick&tick), put it in the code, compiled it - everything is fine, but when I try to call it, the compiler gives me a wrong parameters count.

What am I doing wrong?


novichok2018:

Here's how I'm trying to call it:

void OnTick()
  { 
  ItemsPerSecond(3); 
  }

read the helpat https://www.mql5.com/ru/docs/basis/function andhttps://www.mql5.com/ru/docs/basis/variables/formal

How many parameters do you have in the function you call?

int ItemsPerSecond(const int seconds,MqlTick &tick)



novichok2018:

Moreover, not everyone who wants to write their own robot tends to learn the programming language. As I said above, I don't have such a goal. If you have a question how to do this or that, you just look for a solution in reference books, textbooks, forums, without going too deep into the subject. Perhaps that is why situations like this arise, when seemingly elementary things are suddenly not understood. Of course, by "wiggling the grey matter", I will still find a solution.

Unfortunately you haven't mastered the MQL stuff, it's not even about writing programs by yourself, unfortunately you haven't learned anything.... on your fingers... You've learned the English alphabet "Hey, B, C, D...". and now you try to write on the forum in english, "Horosho", you are told that this is not knowledge of english, this is about nothing at all.... and you're back to being offended, here's a forum, here's a topic with support for newbies, and I've read it all!!! and again in a circle, hey you clever! and why this thread! I'm not the offending kind!!!

 
Igor Makanu:


read helphttps://www.mql5.com/ru/docs/basis/function and https://www.mql5.com/ru/docs/basis/variables/formal

How many parameters do you have in the function you call?



Unfortunately you haven't even mastered the MQL stuff, it's not even about writing programs on your own, unfortunately you haven't learned anything.... on your fingers... You have learned the English alphabet "Hey, B, C, D..." and now you try to write on the forum in english, "Horosho", you are told that this is not knowledge of english, this is about nothing at all.... and you're offended again, here's a forum, here's a topic with support for newcomers, and I've read it all!!! and again in a circle, hey you smart guys! and why this thread! I'm not the offending kind!!!

A lot of letters and nothing but narcissism and humiliation of the interlocutor. And in what form should the second parameter be inserted? I asked the second parameter as a number with the same result. Why so many "words"? Show the solution on my example, pre-compiled and tested. Or your bloated self-respect doesn't allow?

 
novichok2018:

Or does your bloated self-respect prevent you from doing so?

OK, I exercise my right not to communicate with you (fortunately you cannot force me to it), you exercise the right to write on the forum, but not to read the material offered to you for study?

void OnTick()
  { 
  MqlTick t;
// судя по исходнику в t нужно скопировать тики и вызывать так:
ItemsPerSecond(3,t); 
  }

novichok2018:

I asked the second parameter by number with the same result. Why so many words? Show me the solution on my example, pre-compiled and tested.

Here's a correct call of the ItemsPerSecond() function in your example, I haven't compiled, tested, and I'm not going to run the terminal - I've answered your question

Reason: