try:
int start() { int Ticket; Ticket=OrderSend(Symbol(),OP_SELL,0.01,Bid,3,Ask+10*Point,Ask-20*Point); if(Ticket>0) { Print("OrderSend OK"); return(0); } Print("OrderSend failed with error #",GetLastError()); return(0); }
and se what error you get.
I prefer to catch the error number (if any) right away, as this is could be changed by anything occurring later
int start() { int Ticket, iOrderError; Ticket=OrderSend(Symbol(),OP_SELL,0.01,Bid,3,Ask+10*Point,Ask-20*Point); iOrderError = GetLastError(); if(Ticket>0) { Print("OrderSend OK"); return(0); } Print("OrderSend failed with error #", iOrderError); return(0); }
-BB-
D
ERR_TRADE_NOT_ALLOWED | 4109 | Trade is not allowed. Enable checkbox "Allow live trading" in the expert properties. |
Here's some links for error codes. bookmark it! You'll need it quite often in the beginning in your programming career =).
I did, and is still doing.
https://docs.mql4.com/constants/errors
and here's some more
https://docs.mql4.com/runtime/errors
Enotrek
Here's some links for error codes. bookmark it! You'll need it quite often in the beginning in your programming career =).
I did, and is still doing.
https://docs.mql4.com/constants/errors
and here's some more
https://docs.mql4.com/runtime/errors
Enotrek
Many thanks, very useful information!
D
ERR_TRADE_NOT_ALLOWED | 4109 | Trade is not allowed. Enable checkbox "Allow live trading" in the expert properties. |
Many thanks, can now access error codes
Here's some links for error codes. bookmark it! You'll need it quite often in the beginning in your programming career =).
I did, and is still doing.
https://docs.mql4.com/constants/errors
and here's some more
https://docs.mql4.com/runtime/errors
Enotrek
Have had first successful auto-trades, very pleased
Many thanks again to enotrek, BarrowBoy and WHRoeder for making the difference
Ben

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm a beginner in auto-trading and need assistance getting started
Have copied very simple buy (or sell) code from user manual, have successfully compiled, but cannot get it initiated after dragging to open window
Code:
int start()
{
OrderSend(Symbol(),OP_SELL,0.01,Bid,3,Ask+10*Point,Ask-20*Point);
return;
}
Platform response:
2010.07.16 16:22:52 SimpleSell3 EURJPY.,M1: loaded successfully
2010.07.16 16:22:52 SimpleSell3 EURJPY.,M1: uninit reason 0
2010.07.16 16:22:52 SimpleSell3 EURJPY.,M1: removed
Assistance very much appreciated
Ben