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

 
Hi all, the question is this:
I'm doing a netmaker with martin, but not one at a time, but a general one (all orders and grids open as signals, not one at a time)! I ran into a problem .... when one order or its grid triggers, everything works fine, but when an order or its grid opens and then at the same time (or later) another order and its grid opens, the martin starts to continue the first grid! What could be the problem?
 
Artyom Trishkin:

Okay. But I can only look at it in my spare time - work, home, family, cat and children/grandchildren... Mother-in-law, yes...

Yes, cats...

I've gone off somewhere today to do a litter.

A beautiful little Scottish girl who likes to sleep on her back :)

 
Artyom Trishkin:

Well, look at the code - Vitaly posted it directly

My question had nothing to do with Vitaly's code. Now I figured it out myself... it turns out that the code in the library controls the recalculation depth itself. That is, the first run recalculates the entire buffer, and on subsequent ones just the right amount... That's what I wanted to hear from you. I'm lazy like that. It's easier to ask than to figure it out myself... But sometimes I have to............

 
Alexey Viktorov:

My question had nothing to do with Vitaly's code. Now I figured it out myself... it turns out that the code in the library controls the recalculation depth itself. That is, the first run recalculates the entire buffer, and on subsequent ones just the right amount... That's what I wanted to hear from you. I'm lazy like that. It's easier to ask than to figure it out myself... But sometimes I have to............

So, Vitali's code duplicated this function from SB, which you asked - and everything is right there in plain sight - one look is enough to understand the answer to your question.

 
Artyom Trishkin:

So Vitaly's code duplicated this function from the SB you asked about - and everything is right there in plain sight - just a glance is enough to understand the answer to your question.

Did you see the tininess in the original?

 
Vitaly Muzichenko:

Did you see how tough the original is?

I didn't really compare it. In my opinion, there is tininess in both files. And the logic is not clear at all - when the condition is empty and filling the buffer with an empty value is taken out of brackets of the condition. Well, my job is to make it to an A. I don't care how it works - let it be as it is.

 
Artyom Trishkin:

I haven't done much comparing. I think it's a mess in both files. And the logic is not clear at all - when the condition is empty and filling the buffer with an empty value is taken out of brackets of the condition. Well, my job is to make it to an A. I'll leave it as it is.

My task is to understand from this code how to replaceiMAOnArray

That is, make as few changes to the existing code as possible and make
 
Artyom Trishkin:

So in Vitaly's code this function was duplicated from SB that you were asking about - and everything is right there in plain sight - it only takes one look to understand the answer to your question.

Well, you grabbed it... I don't know how to do that. I have to go through all the code thoroughly with understanding.

 
Vitaly Muzichenko:

My task is to understand how to replaceiMAOnArray in this code.

That is, make as few changes to the existing code as possible and use it to

Trying to understand this question, I see the following situation.

In your code it says this

buf_3[i] = iMAOnArray(Array_1, 0, per, 0, MODE_SMMA, i);

and in the documentation

double  iMAOnArray( 
   double       array[],          // массив 
   int          total,            // количество элементов 
   int          ma_period,        // период 
   int          ma_shift,         // сдвиг средней 
   int          ma_method,        // метод усреднения 
   int          shift             // сдвиг 
   );
iMAOnArray

total

[in] Number of elements to calculate. 0 means all elements of the array.

It turns out that every time the function is called, the entire array is recalculated. This is exactly what I asked Artem about... But it turns out that mql5 provides everything for acceleration, while in mql4 you have to take care of it yourself. But I don't see any information on how to do it properly.


As for redoing it with minimal changes, you're wrong. It's easier to take the algorithm and redo it.

 

Good afternoon, please help me to understand...

   HighForFutureSession=MathMax(high[rates_total-1],high[rates_total-2]);

MathMax returns the maximum of two numeric values, i.e. it returns the maximum numeric value from two identical arrays high[rates_total] with a difference of -1 and -2 bars?

In simple words: in the first array 12345 and in the second 1234 the function will return 5?

Reason: