Download MetaTrader 5
To add comments, please log in or register
Log in to MQL5.community using OpenID. It is convenient!
richo
191
richo 2014.11.03 12:39 

Hi

 I am using the following command in a script and it is working correct with one of my broker account.  Today I opened a new demo account with another broker but the same script is not sending the order and I am also not getting any error code.  I have checked the options in mt4 Allow DLL and Live trading.  Both the mt4 versions are same 4.00 built 745.  I can't figure out what am I missing. Please help. 

 result = false;
      result = OrderSend("USDJPY",OP_BUY, orderlot-ujlot, MarketInfo("USDJPY", MODE_BID), 5, 0, 0);
      if(result == false)
        {
          Alert("Order USDJPY" , orderlot-ujlot , " failed to BUY. Error:" , GetLastError() );
        }
Agent86
915
Agent86 2014.11.03 18:02  
ECN brokers do not allow OrderSend() with sl and tp

So you must OrderModify to set the sl and tp separately

Is your demo an ECN broker ?
richo
191
richo 2014.11.03 18:19  

Hi Agent

 

Thanks,  Actually the script is working fine with an ECN Broker.  The new account I am trying with is not an ECN. where the order has not been executed, and also not throwing an error. 

Agent86
915
Agent86 2014.11.03 18:41  
richo:

Hi Agent

 

Thanks,  Actually the script is working fine with an ECN Broker.  The new account I am trying with is not an ECN. where the order has not been executed, and also not throwing an error. 

 

 

use the SRC to post the entire code ?
Agent86
915
Agent86 2014.11.03 19:04  
Let me ask this

Does the demo broker allow you to send a sl and tp along with your OrderSend() ?

If they do allow tp and sl,  then the sl and tp of 0 won't place orders and also may not error as far as I know

However, without the rest of the code and knowing this it's hard to tell, but you could try setting a sl and tp just to see.

whroeder1
13644
whroeder1 2014.11.03 19:25  
Agent86: ECN brokers do not allow OrderSend() with sl and tp
IIRC that was fixed prior to build 600
Keith Watford
Moderator
7990
Keith Watford 2014.11.03 19:39  
int ticket;;
      ticket = OrderSend("USDJPY",OP_BUY, orderlot-ujlot, MarketInfo("USDJPY", MODE_ASK), 5, 0, 0);
      if(ticket==-1)
        {
          Alert("Order USDJPY" , orderlot-ujlot , " failed to BUY. Error:" , GetLastError() );
        }
OrderSend does not return a bool. You are getting the error, but your print is not reporting it. See revision above
richo
191
richo 2014.11.04 00:48  

Hi GumRai

 

Thanks a lot, I have rectified and its working fine.   

/
To add comments, please log in or register