unbalanced parantheses - page 6

 
TarasBY:

And you should also learn how to act rationally in parallel with this task. The code in both mentioned functions is identical except for ONE line - this line filters by order type. Therefore, it would be reasonable to make the check by one function. At least, in this script.

P.S. Learning is difficult, but retraining is VERY IMPORTANT... ;)))


I agree :))
 

As long as TarasBY can't see it - that's how it is for two Kim functions ;))) But it's just for understanding how to arrange brackets. But I will certainly use one from TarasBY. Thanks a lot to him!

UFFFFF - I can go and polish something. :)

int start()
 { 
//----
     if(!ExistPositions()){

             if(!ExistOrders()){

                  ticket=OrderSend(Symbol(),OP_SELL,0.1,Bid,3,Bid+40*Point,Bid-40*Point,"",magic,0,Red);  
                              }
     
                           }
//----
   return(0);
}
 
liana:

As long as TarasBY can't see it - that's how it is for two Kim functions ;))) But it's just for understanding how to arrange brackets. But I will certainly use one from TarasBY. Thanks a lot to him!

UFFFFF - I can go and polish something. :)

In your variant the order will not open as long as there is at least one order in the terminal (for any instrument). I don't think that's what you wanted! :)

If you **have* been doing anything at all... ;)))

 
int start()
 { 
//----
     if(!ExistPositions(Symbol(), -1, magic)){

             if(!ExistOrders(Symbol(), -1, magic)){

                  ticket=OrderSend(Symbol(),OP_SELL,0.1,Bid,3,Bid+40*Point,Bid-40*Point,"",magic,0,Red);  
                              }
     
                           }
//----
   return(0);
}

I did, I did.

 

Can I add another return in your version?

And another question - what does the exclamation mark at the beginning mean? (!ExistOrders ()) Because when I removed it for the sake of curiosity - it works exactly the same.

int start()
{ 
//----
    if (!ExistOrders (Symbol(), -1, magic))
    {ticket=OrderSend(Symbol(),OP_SELL,0.1,Bid,3,Bid+20*Point,Bid-40*Point,"",magic,0,Red);}
    else 
    {return(0);}
    
//----
   return(0);
}	
 
liana:


And another question - what does the exclamation mark at the beginning mean? (!ExistOrders ())


https://docs.mql4.com/ru/basis/operations/bool
 

if(!a) Print("not 'a'");

But if we take it away, it will Print("'a' "); ?

That is, if (!ExistOrders(Symbol(), -1, magic)) - the order doesn't exist,

but if (ExistOrders (Symbol(), -1, magic)) - the order exists? Is it true ?

 

if you write

bool a = false;

if(!a){
   Print("НЕ а");
}else{
   Print("Таки да - а");
}

То есть такая запись равноценна

if(a==false){}
или
if(a!=true){}

Yes

 

Can you be more specific?

if(a){
   Print("а");
if (ExistOrders (Symbol(), -1, magic))
 
liana:

Can you be more specific?

if(true) Alert("истина");
if(!true)Alert("ложь");