Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 379

 
Example2:


It doesn't matter how to rebuild it, as long as it works.


There is some difference in some cases. If for (int i = 0; i < OrdersTotal(); i++), the OrdersTotal() function is called on each loop, and if for (int i = OrdersTotal()-1; i>=0; i--), then the OrdersTotal() function is called only once. I haven't experimented with the speed of execution in mql. Once, in php, the count() function worked for 17 seconds in a forward loop and 0.01 seconds in a reverse one.
 
Measured the speed of forward and reverse cycle. 100 orders, the reverse cycle is 5 times faster. But there are never so many orders, 10 at the most. If there are 10 orders, the speed is 3 times faster. It is palpable to choose the reverse cycle.
 
Integer:
Measured the speed of forward and reverse cycle. 100 orders, the reverse cycle is 5 times faster. But there are never so many orders, 10 at the most. If there are 10 orders, the speed is 3 times faster. It is quite sensible to choose a reverse cycle.


Can you advise how to normalise the price?(My post above) .

 
Example2:


Can you tell me how to normalize the price? (My post above).

There is a NormalizeDouble() function.

NormalizeDouble(_High+Point*20,Digits);

When multiplying, it's better to put double first, then int, otherwise in some cases you may lose the fractional part.

 
if(Line_7 > Lines_1 > Line_6)
{
Alert("Сигнал на покупку");
OrderSend(Symbol(),OP_BUY,Lots_Typ,Ask,5,SL_Typ,TP_Typ);
}
return;}
Is it possible to set the opening of an order in this way?
 
Link_x:
Is it possible to set the opening of an order in this way?


No.

This is how it should be done:

if(Line_7 > Lines_1 && Lines_1 > Line_6)
 

I also checked the profit calculation speed by summing up the profits of all orders and selecting only market orders:

Prof1+=OrderProfit()+OrderSwap()+OrderCommission();

и

if(OrderType()==OP_BUY || OrderType()==OP_SELL){
 Prof2+=OrderProfit()+OrderSwap()+OrderCommission();
}
The first option is a bit faster, but not significantly. The speed ratio is about 1/1.1
 
Integer:

There is a NormalizeDouble() function.

When multiplying, it is better to put double first, then int, otherwise you may lose the fractional part in some cases.


Now I get error 3: "Incorrect parameters have been sent to the trading function, e.g., wrong symbol, unidentified trade operation, negative price tolerance, non-existing ticket number, etc. The program logic needs to be changed".

 
Example2:


I now get error 3: "Incorrect parameters have been sent to the trade function, e.g. wrong symbol, unidentified trade, negative price tolerance, non-existing ticket number, etc. The program logic needs to be changed".


Translate the cursor to the first opening parenthesis after OrderSend, delete this parenthesis, re-enter, this will open a parameter type prompt, check that all parameters are of the correct type.
 
Integer:


No.

That's the way to do it:


Right on! Thank you! ;)