[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 535

 
Since I got kicked out of a separate thread, I'm trying to ask it here, because I haven't found a similar question:

I'm trading an EA on MT-4. Everything was fine until this post. Today I decided to disable the EA, I pressed the appropriate button on the Toolbar and instead of smiley there was a cross on the chart. And suddenly after that a deal opened. One, two... more and more. I opened expert advisor's settings and enabled OnlyBuy in the corresponding window (EA is still disabled). The deal was done again, and it was an inverse sale! Then I reopen the settings and disable its ability to trade (unchecked). This does not work either. The Expert Advisor sort of lives its own life. I contact support and get the following reply" This is most likely a problem with your Expert Advisor. Please delete your terminal and install a new one from our site without installing any other EAs.
Dear Expert Advisors, could you please tell us your opinion on this issue, especially on the highlighted part. Especially I like the clear wording "most likely" . How can this be possible and what is the problem?
 
Alex007:
Since you got kicked out of a separate thread, I'm trying to ask you here, because I haven't found a similar question:

I trade my Expert Advisor on MT4. Everything was fine before this post. Today I decided to disable the EA, I pressed the appropriate button on the Toolbar and instead of smiley there was a cross on the chart. And suddenly after that a deal opened. One, two... more and more. I opened expert advisor's settings and enabled OnlyBuy in the corresponding window (EA is still disabled). The deal was done again, and it was an inverse sale! Then I reopen the settings and disable its ability to trade (unchecked). This does not work either. The Expert Advisor sort of lives its own life. I contact support and get the following reply" This is most likely a problem with your Expert Advisor. Please delete your terminal and install a new one from our site without installing any other EAs.
Dear Expert Advisors, could you please tell us your opinion on this issue, especially on the highlighted part. Especially I like the clear wording "most likely" . How can that be and what's the problem?

You weren't kicked out, I gently hinted that there wasn't enough data.

"My car won't start. Called the dealership where I bought it, they said to call the manufacturer" - sounds about right

 
Alex007:
Since I was kicked out of a separate thread, I will try to ask it here, because I haven't found a similar question:

I trade my Expert Advisor on MT4. Everything was fine before this post. Today I decided to disable the EA, I pressed the EA button on my Toolbar and instead of smiley there appeared cross on my chart. And suddenly after that a deal opened. One, two... more and more. I opened expert advisor's settings and enabled OnlyBuy in the corresponding window (EA is still disabled). The deal was done again, and it was an inverse sale! Then I reopen the settings and disable its ability to trade (unchecked). This does not work either. The Expert Advisor sort of lives its own life. I contact support and get the following reply" This is most likely a problem with your Expert Advisor. Please delete your terminal and install a new one from our site without installing any other EAs.
Dear Expert Advisors, could you please tell us your opinion on this issue, especially on the highlighted part. Especially I like the clear wording "most likely" . How can it be and what is the problem?
You can't tell what's wrong without reviewing the code. The first thing that comes to mind is that deinit() has a condition to open a trade after the program is shut down. Where did you get such an EA from?
 
I'm sorry - there are no miracles! I didn't notice how two MTs opened. I was trading in one of them, and the other was trading in peace. It's a bad luck for old times too - I seem to be good with computers, and here's something like this ....
 
VladislavVG:

Note - in MKL4 the priorities are slightly different from those in C, read common. Therefore - it is better to put brackets.

Thank you! Now I understand why the brackets.

Here's an old story. Finished the robot with a song of my own composition. I hope it works. And suddenly '\end_of_program' - unbalanced left parenthesis C:\TeleTRADE\experts\variantprogram.mq4 (365, 1)

As always, I've looked through the brackets and patched. I don't seem to see anything. What can it be again?

int Profit=0;                                
    for (i=0; i<OrdersHistoryTotal(); i++)
   {
    if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == true)
   {
    if(OrderSymbol()!= Symbol()) continue;
    if(OrderType()>=2)continue;
    Profit+=OrderProfit();     }}
    
 
 
 if(Profit>AccountBalance()){  
   for(i=0;i<=OrdersTotal();i++){
   if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == true)
 { if(OrderSymbol(!= Symbol()) continue;
   if (OrderMagicNumber() != 450) continue;
   if(OrderType()==OP_SELL) 
  OrderClose(OrderTicket(),OrderLots(),Ask,6,Red);
   if(OrderType()==OP_BUY)
  OrderClose(OrderTicket(),OrderLots(),Bid,6,Red);}}} 
//----
   return(0);
  }
//+------------------------------------------------------------------+

//------- :  Коды ошибок
string ErrorDescript(int error_code){string error_string;switch(error_code){
      //---- Коды ошибок, возвращаемые торговым сервером:
      case 0:   error_string="Нет ошибок";                               
 

Ugh! ! I think I got the extra parenthesis out of the way.

 
Dimka-novitsek:

Thank you! [Laughs] Now I know why the brackets.

...

Folks, can you tell me if this is allowed or did I miss something?

if(OrderType()>=2)continue;
 
paladin80:

Folks, can you tell me if this is allowed or did I miss something?


Why not, it's a regular int

Another thing is that in any next build the codes for BUY and SELL may change and the code will stop working abruptly

 
ilunga:

Why not, it's a normal int

Another matter is that in any next build the codes for BUY and SELL may change and the code will stop working abruptly

Yes, that is logical. That's better:

if(OrderType()=OP_BUY || OrderType()=OP_SELL) continue;
Dimych, if the compiler shows a place where it is missing a parenthesis, it doesn't mean that this is the place to look. Sometimes if a parenthesis is incorrectly placed (or missing) at the beginning of code, the error will pop up at the end. So you may look for it in the comment /* ... */.
 
paladin80:

Yes, that makes sense. It's better this way, then:

Dimy, if the compiler shows a place where it misses a parenthesis, it does not mean we should look there. Sometimes if a parenthesis is incorrectly placed (or missing) at the beginning of code, the error will pop up at the end. So look for it by commenting on the code /* ... */.

Just not like that-) "=" is not a condition, but an assignment operation.

Then it should be like this:

if(OrderType()!=OP_BUY && OrderType()!=OP_SELL) continue;

or even better like this (so that you don't have to use it twice)

int type = OrderType(); 
if(type!=OP_BUY && type!=OP_SELL) continue;