Coding Error

To add comments, please log in or register
MThomp
210
MThomp  

Please , not sure where the error is on the code....... Thank you


void OpenBuyStop() 

{
 
  //------
  while(true)
  {
   ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,price,0,0,price+TakeProfit1*Point,"OpenBuyStop", MagicNumber3,expiration,clrGreenYellow);
    if(ticket<0)Print("Error= ",GetLastError());
    else
    {
       Print("ticket:",ticket);break;}
   /
 }
Flavio Jarabeck
6592
Flavio Jarabeck  
MThomp:

Please , not sure where the error is on the code....... Thank you


void OpenBuyStop() 

{
 
  //------
  while(true)
  {
   ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,price,0,0,price+TakeProfit1*Point,"OpenBuyStop", MagicNumber3,expiration,clrGreenYellow);
    if(ticket<0)Print("Error= ",GetLastError());
    else
    {
       Print("ticket:",ticket);break;}
   /
 }
What error?
Mehrdad Jeddi
26178
Mehrdad Jeddi  
void OpenBuyStop() 
{
 
  //------
  while(true)
  {
   while(IsTradeContextBusy())Sleep(1000);
   ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,price,0,0,price+TakeProfit1*_Point,"OpenBuyStop", MagicNumber3,expiration,clrGreenYellow);
    if(ticket<=0)Print("Error= ",GetLastError());
    else
    {
      Print("ticket:",ticket);
      break;
    }
  }
}
MThomp
210
MThomp  
Mehrdad Jeddi:

compilation error,. no error message and no output after compiling.

Mehrdad Jeddi
26178
Mehrdad Jeddi  

So the other variables would be modified and initialized on your side,No compilation error now !

void OpenBuyStop() 
{
 int ticket=-1;
 double Lots=MarketInfo(_Symbol,MODE_MINLOT);
 double price=MarketInfo(_Symbol,MODE_ASK)+500*_Point;
 double TakeProfit1=200;
 int MagicNumber3=12345;
 int expiration=0;

  //------
  while(true)
  {
   while(IsTradeContextBusy())Sleep(1000);
   ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,price,0,0,price+TakeProfit1*_Point,"OpenBuyStop", MagicNumber3,expiration,clrGreenYellow);
    if(ticket<=0)Print("Error= ",GetLastError());
    else
    {
      Print("ticket:",ticket);
      break;
    }
  }

 return;
}
To add comments, please log in or register