return value of 'OrderClose' should be checked

Post Reply
apnihost
Posts: 2
Joined: Wed Jun 04, 2014 10:15 am

return value of 'OrderClose' should be checked

Post by apnihost »

need help fix this

return value of 'OrderClose' should be checked PipsClick-v1.5.mq4 167 14
return value of 'OrderClose' should be checked PipsClick-v1.5.mq4 170 14


Code: Select all

int TradeStart=0;
int start()
  {Comment("");startto();
//  indicator();
  

  if (Hour()>=(StartHour+GMT)&&Minute()>=StartMinute) 
  TradeStart=1;
  
  if (Hour()>=(EndHour+GMT  )&&Minute()>=EndMinute  )
  TradeStart=0;

if (StartHour==0&&StartMinute==0&&EndHour==0&&EndMinute==0)
TradeStart=1;

if (TradeStart==0)
{
   for(int zz=OrdersTotal()-1; zz>=0; zz--)
      if(OrderSelect(zz,SELECT_BY_POS))
         if(OrderSymbol()==Symbol() )
         if(OrderMagicNumber()==Magic)
           {
            if(OrderType()==OP_BUY)
             OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),Slip,Red);
            //---------------------------------      
            if(OrderType()==OP_SELL)
             OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),Slip,Red);
           }


}
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

return value of 'OrderClose' should be checked

Post by milanese »

apnihost » Wed Jun 04, 2014 10:28 am wrote:need help fix this

return value of 'OrderClose' should be checked PipsClick-v1.5.mq4 167 14
return value of 'OrderClose' should be checked PipsClick-v1.5.mq4 170 14

...
Just do it this way:

Code: Select all

int TradeStart=0;
int start()
  {Comment("");startto();
//  indicator();
  

  if (Hour()>=(StartHour+GMT)&&Minute()>=StartMinute) 
  TradeStart=1;
  
  if (Hour()>=(EndHour+GMT  )&&Minute()>=EndMinute  )
  TradeStart=0;

if (StartHour==0&&StartMinute==0&&EndHour==0&&EndMinute==0)
TradeStart=1;

if (TradeStart==0)
{
   for(int zz=OrdersTotal()-1; zz>=0; zz--)
      if(OrderSelect(zz,SELECT_BY_POS))
         if(OrderSymbol()==Symbol() )
         if(OrderMagicNumber()==Magic)
           {
            if(OrderType()==OP_BUY)
             bool order_closeBUY=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),Slip,Red);
            //---------------------------------      
            if(OrderType()==OP_SELL)
               bool order_closeSELL=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),Slip,Red);
           }


}
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
apnihost
Posts: 2
Joined: Wed Jun 04, 2014 10:15 am

return value of 'OrderClose' should be checked

Post by apnihost »

Thanks So much :yahoo:
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

return value of 'OrderClose' should be checked

Post by SteveHopwood »

Tommaso is dead right - he always is. :clap:

Having said that, you will save yourself a lot of Crqpql4/5/x angst by learning the difference between an 'error' which will stop your compilation, and a 'warning' which will not.


:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
Post Reply

Return to “Know your MT4 platform”