[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 479

 
IgorM:

Sorry, I'm writing without checking, I've got it wrong here, it should work like this:

Sell:(OrderOpenPrice()-Bid)*MarketInfo(Symbol(),MODE_TICKVALUE)*lot/Point

Buy: (Ask-OrderOpenPrice())*MarketInfo(Symbol(),MODE_TICKVALUE)*lot/Point

I got it, sorry, the reason is elsewhere in the code. Thanks, anyway, for the response and help
 
demlin:
I get it, sorry, it's elsewhere in the code for the cause. Thanks, anyway, for the response and help

for(i=(OrdersTotal()-1); i>=0; i--) // перебор ордеров 
{ 
   if (!OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) continue;
   if (OrderSymbol()!=Instr||OrderMagicNumber()!=MN)  continue;
   if(OrderType()==OP_BUY)
       if (Ask-OrderOpenPrice()>BezUbytok*Point)
           return(77);   
   if(OrderType()==OP_SELL)
       if (OrderOpenPrice()-Bid>BezUbytok*Point)
           return(77);   
}   
return(0);
 
Vinin:


Thank you so much!!! Your code worked absolutely and 100%!!!!!
 

Help me deal with this EA

When compiling no errors, but when tested in the strategy tester, there are errors
the first error waiting for the string order did not open the code containing the string from compiled no errors run in the strategy tester
works, but opens only positions on the Sell on Buy does not want

Could you pleasecheck and tell us what is wrong in the code

Files:
all.mq4  2 kb
 
novicek:

Help with the advisor

this text could do with punctuation marks and clear thought.
 

Good day to all.


Do you know if it makes sense to use

if(IsConnected())

For example, do we check if an order has been set and if not, then set it (but we do NOT need two such orders, and categorically not)?

If there is no link, no ticks, IsConnected does not work. am i mistaken? who uses which methods to check critical areas of a program?

 
Pyro:

Good day to all.


Do you know if it makes sense to use

For example, do we check if an order has been set and if not, then set it (but we do NOT need two such orders, and categorically not)?

If there is no link, no ticks, IsConnected does not work. am i mistaken? who uses which methods to check critical areas of a program?


I wouldn't use it, it's a very suspicious function, I read somewhere that it glitches, I think Kim was talking about it, google the thread about it.
 
Martingeil:
I wouldn't use it very suspicious function, I read somewhere that it's glitchy, I think Kim was talking about it, google the thread about this function.

yeah i saw that too, https://www.mql5.com/ru/forum/128436, i think here https://www.mql5.com/ru/forum/131859
 

Thanks colleagues! Another thing is that it's strange that they haven't corrected this case in 4 years... I have a real situation where Expert Advisor (apparently) when checking an order in the pool, loses connection and somehow gives fallse instead of true and puts extra orders. The way out was found in additional testing of the pool for dupes with deletion of such. At least that way.


The problem is that errors like "no connection" do not appear when checking the pool, only when orders are set. And I really need to check the pool.

 
sergeev:
this text could do with punctuation marks and clear thought.

Let there be no doubt about my literacy (education)
Not punctuation is my binge, that's all.


Reason: