Download MetaTrader 5

return value of 'OrderSelect' should be checked

To add comments, please log in or register
Francesco Sgarbossa
893
Francesco Sgarbossa  

hello

i have got this worning back :return value of 'OrderSelect' should be checked   

i have to make a SP and SL in a order...the code is:

 {
         TheStopLoss=0;
         TheTakeProfit=0;
         if(TakeProfit>0) TheTakeProfit=Bid-TakeProfit*MyPoint;
         if(StopLoss>0) TheStopLoss=Bid+StopLoss*MyPoint;
         OrderSelect(result,SELECT_BY_TICKET);
         OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green);
        }
       

where i do wrong?

thanks

Marco vd Heijden
Moderator
5523
Marco vd Heijden  

Here

OrderSelect(result,SELECT_BY_TICKET);
you need to check the returned value.

‌If you dont know how to do that, just wait ‌for the response from our automated robot.

whroeder1
15917
whroeder1  
    Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it

  1. Check your return codes (OrderModify and OrderSelect) What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
  2. Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong
Francesco Sgarbossa
893
Francesco Sgarbossa  
thanks
To add comments, please log in or register