Question about OrderSend()

 
Firstly thank you very much for answering my question about error codes ("Error Numbers").

Subsequently I have been receiving many 130 and 138 errors and have not found a good explanation of the process (step by step) execution process of the SendOrder() command. Thus I have a few additional questions. Hopefully they will be informative to others as well.

1) is the order expiration time paramter for OrderSend() in milliseconds, seconds from the time of "order request" (ie the issuing of the OrderSend) or does it represent the cumulative seconds from 00:00 January 1, 1970?

2) now when I receive a requote error from OrderSend() does that mean that I should just wait for ten seconds (Sleep(10000) and try again until I am successful at my required price? There are no variables/functions with which to respond to such a response?

3) Stop loses and take profit values are to be >0.0004 from the Ask and Bid prices? Is this determined by the broker or the MetaTrader server? Can these be found programmically in case of spread differences between brokers and for order prechecking beforehand? These limitations are not easily determined from available documentation as far as I can see.

Pardon if there are obvious answers about but I have searched and cannot find helpful information.

Many thanks,
Andrew
 
1. expiration time is applied to pending orders only. expiration should be counted from server time. if You set pending order for 2 hours then You shoul write expiration=CurTime() + 2 * 3600;
2. You do not need for 10 seconds waiting. requote should be processed immediately.for elimination requotes use slippage>0. to retrieve changed bid and ask use RefreshRates() function
3. nearest stoploss and takeprofit values set from server. you can see this value when send order manually
 
Thanks Slawa,

3. I had my TP and SL enough apart, but I forgot that my required price couldn't be within 5 pips of the current price either ! . . . what a dummy I am ! Anyhow, no more 130 problem!

Thanks again,
Andrew
Reason: