from what I see 2 parameters are missing in your OrderSend function, stoploss, and takeprofit and at least in what you put there is a space in "GB(space)PUSD" but that maybe comes from Copy Paste
int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE)
An what error do you get in the log file when you execute the script?
Hi jipl.
Thanks for your reply its very much appreciated.
Firstly yes that is due to copy paste.
I do not get any error, it says script loaded ok and then script removed ok
If i use this it works
int start()
{
//----
int ticket=OrderSend("EURUSD",OP_BUY,1.0,MarketInfo("EURUSD",MODE_ASK),0,"expert comment",255,0,CLR_NONE);
if(ticket<1)
{
int error=GetLastError();
Print("Error = ",ErrorDescription(error));
return;
}
//----
OrderPrint();
return(0);
}
But if i change to this it doesnt
int start()
{
//----
int ticket=OrderSend("GBPUSD",OP_SELL1.0,MarketInfo("GBPUSD",MODE_BID),0,"expert comment",255,0,CLR_NONE);
if(ticket<1)
{
int error=GetLastError();
Print("Error = ",ErrorDescription(error));
return;
}
//----
OrderPrint();
return(0);
}
As you can see the parameters for sl and tp are missing in the one that works so thats why i didnt put them in the one that doesnt.
I will try it though thanks
Paul
It works thanks.
jlpi, thanks i have tried adding the sl and tp parameters and it is fine now. Still dont know why the buy script works without them but hey at least its working.
Again thanks for your help
Paul
jlpi, thanks i have tried adding the sl and tp parameters and it is fine now. Still dont know why the buy script works without them but hey at least its working.
Again thanks for your help
Paulno problem, you are welcome
But if i change to this it doesnt ticket=OrderSend("GBPUSD",OP_SELL1.0,MarketInfo("GBPUSD",MODE_BID),0,"expert comment",255,0,CLR_NONE);
A comma is missing.
FerruFx
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use