ECN Broker Mystery

 

I use this OrderSend() code in ATC2007 Contest EA, MetaQuotes Demo, FXDD Live & IBFX Demo without problems (no errors). I started a Demo with a Swiss ECN Broker and I get "Error opening Sell order: 130".

Does anyone have idea as to why ??

int TakeProfit=100;
int StopLoss=100;
double tp,sl;
if(Sell1==1)
         {
         sl=0;
         tp=0;
         RefreshRates();
         if(StopLoss > 0) sl=NormalizeDouble(Bid+StopLoss*Point,Digits);
         if(TakeProfit > 0) tp=NormalizeDouble(Bid-TakeProfit*Point,Digits);
         ticket=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,3,sl,tp,"SELLSignal",MagicNumber,0,Red);
         if(ticket>0)
            {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
            }
            else Print("Error opening SELL order : ",GetLastError()); 
            return(0);
         }
 

Error code is invalid stops.

hmmm...

 

I ran the Moving Averages Ea that comes with the Platform download on the ECN Server and it opens orders OK. I ran my Contest EA in the Strategy Tester and it also opens orders without errors. This is still a Mystery to me as to; Why this Contest EA will run OK on Contest Server and other Brokers' Servers (Demo & Live) OK, but has these Error 130 on this ECN Broker. Tomorrow, I will contact ECN Broker to discuss problem.

 
Check Stoplevel - MarketInfo(Symbol(),MODE_STOPLEVEL)
Other reason - market execution, in this case StopLoss and TakeProfit levels must be 0 for market opening.
 
Rosh:
Check Stoplevel - MarketInfo(Symbol(),MODE_STOPLEVEL)
Other reason - market execution, in this case StopLoss and TakeProfit levels must be 0 for market opening.


Rosh, thanks. sl & tp =0 and EA opens orders with no errors.

1. Any ideas for the reason an ECN Broker would set StopLevel to 0 and require sl & tp=0 for market opening ??

2. Is there a known minimum delay (Sleep()) value required by MT4 platform to execute OrderModify() immediately after OrderSend() ??

 
The demo that was having error 130 (invalid stops) is from Swissnetbroker.com. I contacted them today and they replied that it is their company policy that Market Opening orders have o value for stops. Then they advise to use OrderModify() later to set stop values. They stated that it had nothing to do with being an ECN broker. They did not explain why this is company policy.
Reason: