Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.
Don't use string variables as conditionals. Use boolean variables.
// Change this ... string CondBuy1 = 1; if(MgcB1_AlreadyOpen(100) == 1) {CondBuy1 = "A trade is already opened";} if ( (iClose(_Symbol,PERIOD_W1,1) > iClose(_Symbol,PERIOD_W1,3)) && (CondBuy1 = 1)) { BUY_IT1(0.01);} /* ... */ int MgcB1_AlreadyOpen(int magicnumber) { int count = 0; int total=OrdersTotal(); for(int i=0; i<total; i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if (OrderMagicNumber()==magicnumber ); } return(1); } // To this ... bool CondBuy1 = MgcB1_AlreadyOpen( _Symbol, 100 ); if( ( iClose( _Symbol, PERIOD_W1, 1 ) > iClose( _Symbol, PERIOD_W1, 3 ) ) && !CondBuy1 ) BUY_IT1(0.01); /* ... */ bool MgcB1_AlreadyOpen( string symbol, int magicnumber ) { for( int i = OrdersTotal() - 1; i >= 0; i-- ) if( OrderSelect( i, SELECT_BY_POS, MODE_TRADES ) && ( OrderMagicNumber() == magicnumber ) && ( OrderSymbol() == symbol ) ); return( true ); return( false ); }
Also, "CondBuy1 = 1" is an assignment and not a comparison which would look like "CondBuy1 == 1".
CondBuy1 = 1)
This is an assignment (setting variable to one) and is always true (not zero).

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I am trying to use 2 conditions , but I get that error message:
&& Illegal operation use
Below is my function and the if condition ,
that line is causing issues to me: