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

 
Andrey Sokolov #:

There have been complaints that this procedure takes a lot of CPU time.

The normalisation of the calculated SLs and TAs takes twice as long. But I wouldn't say it has that much impact on optimisation and even less on robot testing.

In any case, we have to find out the author's idea.

The documentation says in black and white to normalize the calculated levels! And what could be the "author's intent"? What is not to normalize SL and TP? I'm not going to argue with you because the facts are obvious here!

 
Порт-моне тв get the opening time of the second and subsequent orders since OpenOrderTime() gives out only the first one, and also how do I get the opening price of the second and subsequent orders since OpenOrderPrice() also gives out the price of the first one?

If this is a question, then get the ticket of the first, select the first and subsequent ones which have the ticket !=first.

 
Mihail Matkovskij #:

It takes twice as long to normalise the calculated SLs and TAs. But I wouldn't say it has that much of an impact on optimisation and even less on robot testing.

It does, and there have been questions on this forum about simplifying this procedure.

I don't know of a case where received prices that aren't normalized caused an error.

For reference:

Mihail Matkovskij#:

And what could be the "author's intention" in this case? That not to normalize SL and TP? I'm not going to argue with you because the facts are obvious!

An afterthought might be rounding. In theory this is not done, but this way in the case of rounding to fewer digits , in case the prices will be correct for SL and TP, will work. So you have to find out what is intended in any case.

 
Urman Ru get fractals from this indicator's buffer.The highest and the lowest, but not standard, and to the left i-2, and to the right 0, so that the result is not overwritten.

I tried to solve it myself, roughly add in the code of this indicator, but it doesn't work. Although it compiles and no errors.

Maybe we should use iCustom and handle indicator?

If you try to identify the problem and then describe in more detail what exactly it is that you can't do, then the probability of getting an answer will be much higher.

 
Mihail Matkovskij #:

It takes twice as long to normalise the calculated SLs and TAs. But I wouldn't say it has that much of an impact on optimisation, let alone robot testing.

Not only that, but some people neglect such simple checks as

if (name == NULL)
  return;

thinking it may consume a lot of CPU time :)

But actually it is functions like ObjectCreate and ObjectDelete that consume processor time. If a programmer has, say, an array of graphical objects and it is deleted and recreated on every tick, something must be done about it. While simple checks and calculations are of little time. This is why a lot of programmers are just looking in the wrong place.

 
Andrey Sokolov #:

It does, and there have been questions on this forum about simplifying this procedure.

I don't know who it affects or what it affects. I've never had any problems with NormaizeDouble. If anything, any code affects the speed of an application. But if everything is so critical, you may leave handlers OnTick or OnCalculate empty. In this case your application will be flying at all. :) Or rewrite functions on assembler, compile into DLL and connect them to the application.

I don't know cases when received and non-normalized prices caused an error.

But the documentation does! And you ignore the advice in the documentation. Suit yourself. That's your business. I think it's obvious and I'm not going to argue with you about it, I'll say it again!

Rounding may be an afterthought.

It's not rounding, it's cutting off everything over two decimal places.

NormalizeDouble((Ask1+StopLoss*Point1), 2)

I don't know the author's idea either. But I don't need it. I think he can figure it out on his own.

 

Good day

Can you tell me why the MQL4 compiler complains about the following array declaration?


input int trendSlowCountBar=9;

double MAslowTrend [trendFastCountBar];


it generates the following error:

'[' - invalid index value


I can't seem to find any restrictions on specifying a dimension in the language reference... (

 
Владимир Казаков array declaration?


input int trendSlowCountBar=9;

double MAslowTrend [trendFastCountBar];


it generates the following error:

'[' - invalid index value


I can't seem to find any restrictions on specifying a dimension in the language reference... (

That's because the size of static arrays cannot be defined by variables. You should use a dynamic array instead:

input int     trendSlowCountBar=9;

double  MAslowTrend[];

int OnInit() {
  ArrayResize(MAslowTrend, trendSlowCountBar, 0);
  ...
  return(INIT_SUCCEEDED);
}
 
Mihail Matkovskij #:

It's not rounding, it's cutting off anything over 2 decimal places

It's called rounding down.

Mihail Matkovskij#:

But the documentation does! And you disregard the advice in the documentation. Suit yourself. That's your business. I think it's obvious and I'm not going to argue with you about it, I'll say it again!

Especially for you on the last page is a screenshot from the edit.

 
Andrey Sokolov #:

It's called rounding down.

Well, you can call it what you like :)

Especially for you, there's a screenshot from the edit on the last page.

Why would I need your screenshot if I followed the link and read:https://docs.mql4.com/ru/trading/ordersend

Not only that, but I gave you the quote above, where it says it all. And you advise me to look at some screenshot. :)

That's it. Enough of this idle chatter.

OrderSend - Торговые функции - Справочник MQL4
OrderSend - Торговые функции - Справочник MQL4
  • docs.mql4.com
OrderSend - Торговые функции - Справочник MQL4