Maruf Talukdar:
Just trying to place a buy market order. I am following this https://book.mql4.com/trading/ordersend documentation
Just trying to place a buy market order. I am following this https://book.mql4.com/trading/ordersend documentation
These are the errors I get.
The first one is a warning
The second is an error
Thanks
input double Lots=0.01; input int SL=500; input int Magic=99243; int start() { t bool Sonuc= OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-2*SL*Point,Bid+SL*Point,"My order",Magic,0,clrBlue); return; } }
Mehmet Bastem:
input double Lots=0.01; input int SL=500; input int Magic=99243; int start() { t bool Sonuc= OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-2*SL*Point,Bid+SL*Point,"My order",Magic,0,clrBlue); return; } }
That will not compile. I guess that the "t" is a typo.
OrderSend returns an int, not a bool.
If the compiler issues a warning don't ignore it, fix it.
OrderSend();
may give you the error that the return value of OrderSend should be checked. The minimum that should be done is to print the error if it fails
preferably also print the open price, TP, SL.
int ticket=OrderSend(_Symbol,OP_BUY,0.1,Ask,20,0,0,NULL,12345,0,clrNONE); if(ticket==-1) { Print("OrderSend for Buy order failed with error code ",GetLastError()); }
return; //should return a value.
return(0);
Thank you everyone but I still get the same error although the warning is now gone. I have tried both reccomandations above.
Maruf Talukdar:
Thank you everyone but I still get the same error although the warning is now gone. I have tried both reccomandations above.
Thank you everyone but I still get the same error although the warning is now gone. I have tried both reccomandations above.
If you are still getting the same error then you did not pay attention to my post.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
These are the errors I get.
The first one is a warning
The second is an error
Thanks