Issue with a Sell stop order !!

Back to topics list To post a new topic, please log in or register
avatar
14
mrgoodprice144 2016.03.23 00:04
 

Hi,

I'm trying to make a very simple code that will send 2 pending orders one BUYSTOP and one SELLSTOP ORDER every thing is working fine with the BUYSTOP order but when it come to the SELLSTOP

order i get : 2016.03.22 23:56:10.883    TEST88 EURUSD,M15: Error opening SELLSTOP order : 0

i dont understand why it does that here is the code :

 if(Count==1 )
 {

ticket=OrderSend("EURUSD",OP_BUYSTOP,0.01,Ask+3*Point,0,0, clrGreen );
 
}
else
{

Print("Error opening BUYSTOP order :", GetLastError());
}
 
if (Count==1 )
 {
  ticket=OrderSend("EURUSD",OP_SELLSTOP,0.01, Bid-10*Point, 0,0,clrGreen);
 
}
else
{
 
Print("Error opening SELLSTOP order : ", GetLastError());
}

AM'i doing something wrong here i do not understand why it wont work i dont even have a special ERROR number like 130, 128 etc.. all i get is a 0 .

Any suggestion


avatar
Moderator
3407
GumRai 2016.03.23 00:26 #
 

Your print statements are executed if Count does not equal 1. They are not related to the OrderSends.

You should be getting error prints for both

avatar
12985
WHRoeder 2016.03.23 01:36 #
 
You are looking at GLE when count != 1
if (Count==1 )
 {
  ticket=OrderSend("EURUSD",OP_SELLSTOP,0.01, Bid-10*Point, 0,0,clrGreen);
 
}
else
{
 
Print("Error opening SELLSTOP order : ", GetLastError());
}
Do NOT look at GLE unless you have an error.
if (Count==1 )
 {
  ticket=OrderSend("EURUSD",OP_SELLSTOP,0.01, Bid-10*Point, 0,0,clrGreen);
  if(ticket < 0) Print("Error opening SELLSTOP order : ", GetLastError());
}
avatar
14
mrgoodprice144 2016.03.23 09:52 #
 
Now i have a 130 ERROR : 2016.03.23 09:48:06.227    TEST88 EURUSD,M15: Error opening SELLSTOP order : 130
 at least it came out with a number instead of 0.
avatar
12985
WHRoeder 2016.03.23 14:22 #
 
Now compare your call
 ticket=OrderSend("EURUSD",OP_SELLSTOP,0.01, Bid-10*Point, 0,0,clrGreen);
with the documentation
I'm pretty sure that a take profit of clrGreen is probably a

130

ERR_INVALID_STOPS

Invalid stops

int  OrderSend(
   string   symbol,              // symbol
   int      cmd,                 // operation
   double   volume,              // volume
   double   price,               // price
   int      slippage,            // slippage
   double   stoploss,            // stop loss
   double   takeprofit,          // take profit
   string   comment=NULL,        // comment
   int      magic=0,             // magic number
   datetime expiration=0,        // pending order expiration
   color    arrow_color=clrNONE  // color
   );

Back to topics list  

To add comments, please log in or register