OrderSend overzealous in rejecting pending orders?

 
Hi,

I have the following piece of code that tries to insert a pending order with an opening price away from the market,
but with stop levels that are (at that time!) possibly close to the market.

   double stopLevel = MarketInfo(symbol, MODE_STOPLEVEL);
   double pointSize = MarketInfo(symbol, MODE_POINT);
   double orderDigits = MarketInfo(symbol, MODE_DIGITS); 
   double currBid = MarketInfo(symbol, MODE_BID); 
   double currAsk = MarketInfo(symbol, MODE_ASK); 
   double orderPrice = NormalizeDouble(price, orderDigits);
   double orderStopLoss = NormalizeDouble(stoploss, orderDigits);
   double orderTakeProfit = NormalizeDouble(takeprofit, orderDigits);
 
   Print("--- New Order -----------------");
   Print("sendOrder: " + symbol + ", " + cmd + ", " + volume + ", " + orderPrice + ", " + orderStopLoss + ", " + orderTakeProfit + " (" + currBid + "/" + currAsk + ")");
The following line is from an actual backtest I performed.
  • 2007.11.17 23:41:23 2007.10.30 22:24 MPlib DOWJONES,M1: sendOrder: DOWJONES, 2, 0.10000000, 13856.00000000, 13827.00000000, 13935.00000000 (13822. 00000000/13827. 00000000)
This setup gets rejected with the well-known error code: 130.

I fully understand that I cannot place an opening order close to the market, but hey this pending order is not active immediately and when it becomes active at 13856 its SL (13827) and TP (13935) are perfectly OK and not to close to the market!
Is there any reason for not allowing such pending orders to be set up in advance?

Thanks in advance!

Max Payne
Reason: