[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 657

 
IgorM:

thanks yes this is what i was looking for, has anyone measured the speed of the same type of code for mt4 and mt5 ?

I would add. Most interested in the difference in speed of testing/optimisation of the same type EAs.
 
ToLik_SRGV:

Yuri, for the future, if the code repeats at least twice, it should be allocated to a method, and you won't need heaps of arrays cluttering up the code...


Anatoly, thank you very much. It is a pity that you cannot insert an icon in this article like in Skype with a bow. Everything is simple and elegant. I understand from communication with other technical analysis tools, it should be that way, but I'm still out of practice in working with mql. Thanks for a tip on marking it as a method - I'll try to figure it out.

On a final note, can you tell me how to avoid multiple placing orders on the same bar by this EA? Good people have already given some hints, but they did not stick.

 
granit77:
I would add. Most interested in the difference in testing/optimisation speed of the same type of EAs.


You see MT4 and MT5 optimization should be very different at least because of the fact that MT5 already implements incomplete condition checking - for MT4 to achieve this you need to do a lot of nested if statements - and this reduces the readability of the code and leads to logical errors
 
IgorM:


Thanks a lot, it is what I was looking for, who has measured the speed of the same type of code for MT4 and MT5 ?


2010.06.29 16:29:56 Test_Speed (EURUSD,M1: time 1641 msec MT-4

2010.06.29 16:28:56 Test_Speed (EURUSD,M1) time 359 msec MT-5

this code does not need to be translated as you see it fits for 5 and 4

 int start_=GetTickCount();
 int d=0;
 for(int i=0;i<100000000;i++)d+=11;
 Print("время ",GetTickCount()-start_," мсек");

i can't believe it's just a simple addition, imagine what the developers have done to speed up complex functions.

 
Urain:

And this is on the elementary addition, imagine what the developers have screwed up there to speed up complex functions.


Let's hope so, in MT4 EA code processing is very similar to Java - built-in functions are very fast, but user functions are not so fast, even the most basic actions

When it comes to optimization, I am very confused by the full check of conditions - I haven't heard of such a thing for about 20 years - school Basics :)

 

I can't find a multi-currency indicator that has GoldUSD in it. Poke me with the link, please.

upg upg indexes which

 
IgorM:


Be more specific with your question.

If you are interested in the current price at the time of placing an order, you can add a call to the code that will be responsible for storing the current price in a global array with changing the counter index of the array, which you can then view from any point in the code


I.e., I need all prices starting from the order open price to be written to the array, so that I can then extract the maximum and minimum elements of the array.

Can you tell me how to implement it in the code?

 
zelek:


i.e. I need all prices starting from the opening price of the order to be written to an array, so that I can then extract the maximum and minimum element of the array.

Could you tell me how to implement it in the code?


I just don't understand the problem. You've opened an order and want to write current prices into the array , why? You have bars that will give you minimum and maximum prices. If you write prices by tick, I can't even imagine how much data the array will contain - ticks from 20 to 80 units/min.

or do you need prices at which orders were opened? - it is possible to view closed and open orders in the terminal

 
IgorM:


I just don't understand the problem. You have opened an order and want to save current prices in the data array. Why?

or do you need the prices at which the orders were opened? - it is possible to view closed and open orders in the terminal


I want to implement something similar to a virtual trailing stop from one pip

you need to know the maximal value on every new tick

 
zelek:


I want to implement something similar to virtual trailing stop from one point

for this purpose I need to know the maximum value at each new tick


You don't need to record and store the entire array. It is enough to store only two figures - the maximum and minimum from the order opening. But to do this - in fact - we only need to monitor the price on the first minute bar at which the order was opened. Thereafter the maximum and minimum are quite determined by the minute bars without constantly storing the price.
Reason: