Before posting please read some of the other threads . . . then you would have seen numerous requests like this one:
Please use this to post code . . . it makes it easier to read.
please help me with this warning.. i've tried so hard to fix it but
still no use.. the warning is expression on the global scope not
allowed... :-(
also 1 more question what are:
*unbalanced left or right parentheses?
*end program/unbalanced parentheses?
*unbalanced parentheses?
You are confusing the compiler by missing ; here . .
if(type="buy") OrderSend(Symbol(),OP_BUYLIMIT,volume*2,stoploss,2,stoploss-(price-stoploss),price,"buy",martin_level++) // <---- missing ; if(type="sell") OrderSend(Symbol(),OP_SELLLIMIT,volume*2,stoploss,2,stoploss+(stoploss-price),price,"sell",martin_level++) // <---- missing ;
Unbalance parentheses happen when you don't have matching numbers of braces . . . ( and ) or { and }
You are confusing the compiler by missing ; here . .
Unbalance parentheses happen when you don't have matching numbers of braces . . . ( and ) or { and }
still the warning showed
also there is a negative sign beside this text like this
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES)=true)
-{ <<<---------------- the warning or negative sign is located beside the brace...
this is wrong ...
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES)=true)
You need two equal signs for a comparison
if( dog==true )
but in this case the return value of OrderSelect is a bool in any case so this simplifies the code down to
if( OrderSelect(0,SELECT_BY_POS,MODE_TRADES) )
Now compiler error free
int start(){ int max_martin =2; string type; double price; double volume; double stoploss; if( OrderSelect(0,SELECT_BY_POS,MODE_TRADES) ){ int martin_level=OrderMagicNumber(); if( martin_level<=max_martin && !OrderSelect(1,SELECT_BY_POS,MODE_TRADES) ){ if( OrderSelect(0,SELECT_BY_POS,MODE_TRADES) ){ type=OrderComment(); price=OrderOpenPrice() ; volume=OrderLots() ; stoploss=OrderStopLoss(); } if(type=="buy"){ OrderSend(Symbol(),OP_BUYLIMIT,volume*2,stoploss,2,stoploss-(price-stoploss),price,"buy",martin_level); martin_level++; } if(type=="sell"){ OrderSend(Symbol(),OP_SELLLIMIT,volume*2,stoploss,2,stoploss+(stoploss-price),price,"sell",martin_level); martin_level++; } } } return(0); }
You have more assignments rather than comparisons (= rather than ==)
and MQL4 doesn't like the ++ in the OrderSend.
Now compiler error free
You have more assignments rather than comparisons (= rather than ==)
and it doesn't like ++ in the OrderSend.
thanks..... sorry for the trouble...
but if i want the condition in if there is no a second order in the trading pool/mode_trades then perform the order send... is it like this?
if(OrderSelect(1,SELECT_BY_POS,MODE_TRADES)==false)
OrderSend . . . . . .
thanks..... sorry for the trouble...
but if i want the condition in if there is no a second order in the trading pool/mode_trades then perform the order send... is it like this?
if(OrderSelect(1,SELECT_BY_POS,MODE_TRADES)==false)
OrderSend . . . . . .
but if i want the condition in if there is no a second order in the trading pool/mode_trades then perform the order send... is it like this?
if(OrderSelect(1,SELECT_BY_POS,MODE_TRADES)==false)
OrderSend . . . . . .
int nOrders=0; for(int iPos = OrdersTotal()-1; iPos >= 0; iPos--) if( OrderSelect(iPos, SELECT_BY_POS) ) if( // Only my orders w/ OrderMagicNumber() == magic.number ) if( // my magic number OrderSymbol() == chart.symbol // and my pair. ){ nOrders++; } if (nOrders == 0){ :
ok.. thanks for the advice everyone... but i have a LOT of questions ... and i don't think i should make a lot of new threads... should i collect all my different type questions and make one new thread or is there one thread to ask-answer...? -_-
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
please help me with this warning.. i've tried so hard to fix it but still no use.. the warning is expression on the global scope not allowed... :-(
also 1 more question what are:
*unbalanced left or right parentheses?
*end program/unbalanced parentheses?
*unbalanced parentheses?
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES)=true)
{
martin_level=OrderMagicNumber();
if(martin_level<=max_martin&&OrderSelect(1,SELECT_BY_POS,MODE_TRADES)=false)
{
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES)=true)
{
type=OrderComment() ;
price=OrderOpenPrice() ;
volume=OrderLots() ;
stoploss=OrderStopLoss();
}
if(type="buy")
OrderSend(Symbol(),OP_BUYLIMIT,volume*2,stoploss,2,stoploss-(price-stoploss),price,"buy",martin_level++)
if(type="sell")
OrderSend(Symbol(),OP_SELLLIMIT,volume*2,stoploss,2,stoploss+(stoploss-price),price,"sell",martin_level++)
}
}