| / | Forum |
|
janklimo
2007.09.14 18:05
I saw this code in the MQL4 documentation:
ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green); if(ticket<0) { Print("OrderSend failed with error #",GetLastError()); return(0); } and I used it in my expert but it seems that this code opens orders in the backtest but opens no orders in live trading. My question is whether this code only sets the value for the "ticket" variable or it opens the trade as well. Thanks a lot. Jan |
|
Changing the External Parameters of MQL4 Programs without Restarting The article describes a method of changing the external parameters of MQL4 programs on-the-fly, without restarting. |
|
wackena
2007.09.14 21:45
It may be that the "allow live trading" option is not checked. On
active chart, press F7, then click common tab, then check "allow live trading"
box, then click OK.
|
|
Mike
2007.09.14 21:47
OrderSend () is a feature that commits trading operations and returns in terms of this operation is over. If the return values <0 it is a mistake opening position. If you are having difficulties, I am ready to help you, we have MQL courses, and we write custom. Please ... |
|
janklimo
2007.09.15 02:56
Thanks for your replies, guys. I'm not new to mql4, autotrading is allowed and now
that I changed
ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green);to OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green);the orders are open in forward test. What confuses me is the fact, that with the previous version of the code they were opened in a backtest but not in live trading. To ask again, do you think the line ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green);opens the order? Jan |
|
fireflies
2007.09.15 04:42
janklimo wrote: Yes it does. Have you tried to Print the GetLastError() after that OrderSend?the orders are open in forward test. What confuses me is the fact, that with the previous version of the code they were opened in a backtest but not in live trading. To ask again, do you think the line ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green);opens the order? Jan |