Script don't work - need help

 

Hi,

I am tring to run the following script on MT4 (build 196) and I get an error msg - "Invalid trade parameters".

//+------------------------------------------------------------------+

//| script "send pending order with expiration data" |

//+------------------------------------------------------------------+

int start()

{

int ticket,expiration;

double point;

//----

point=MarketInfo(Symbol(),MODE_POINT);

expiration=CurTime()+PERIOD_M1*5;

//----

while(true)

{

ticket=OrderSend(Symbol(),OP_SELLSTOP,1,Bid-20*point,3,Bid-10*point,0,"some comment",1234,expiration,Green);

if(ticket<=0) Print("Error = ",ErrorDescription(GetLastError()));

else { Print("ticket = ",ticket); break; }

//---- 10 seconds wait

Sleep(10000);

}

//----

return(0);

}

//+------------------------------------------------------------------+

I don't understand the problem .

Can someone help ?

10X !

 

expiration=CurTime()+PERIOD_M1*5;

the constant value of PERIOD_M1 is 1

this means that you want the order to expire if 5 second later?

 

Expiration time should be at least 15 minutes

 

Still don't work ...

ever where I set the expiration variable to 60 (1 minute)

 

what about the other parameters

dose your broker not allow TP and SL to be too close

like they need 15 pips up

Reason: