Please why doesnt this work?

 
 

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

 
lesaurus:
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

no problem, you are welcome

 
lesaurus:
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