OrderSend with 130 Error

 

Hi all,

I have the following code in start() function of a Script:

String Symb=Symbol();
double StopLoss =200; // SL for an opened order
double TakeProfit =100; // ТР for an opened order
double SL=Bid - StopLoss*Point; // Calculating SL of opened
double TP=Bid + TakeProfit*Point; // Calculating TP of opened
int Ticket=OrderSend(Symb,OP_BUY,0.01,Ask,2,SL,TP);//Opening Buy
Alert("Ticket: ", Ticket," ", GetLastError(), " ", Bid, " ",SL," ",TP," ",MarketInfo(Symb,MODE_STOPLEVEL));

when I attached the script to AUDUSD, it failed to book a new deal.

Ticket: -1 130 1.0785 1.0765 1.0795 0

I know that 130 is an error of invalid stop order, and the STOPLEVEL is zero, would you please tell how can I set the SL and TP correctly? thanks.

 
StopLevel=0 .... Woah. Is this some kind of ECN broker or Bridged-broker. Anyways some brokers don't allow the stoploss and take-profit to be sent along with the order. Those brokers are usually ECN or Bridged-brokers. Try sending the order with SL & TP = 0. Then try your script again with some ridiculously big SL & TP. Or you can provide the name of the broker here and someone might be familiar with em.
 
ubzen:
StopLevel=0 .... Woah. Is this some kind of ECN broker or Bridged-broker. Anyways some brokers don't allow the stoploss and take-profit to be sent along with the order. Those brokers are usually ECN or Bridged-brokers. Try sending the order with SL & TP = 0. Then try your script again with some ridiculously big SL & TP. Or you can provide the name of the broker here and someone might be familiar with em.

I downloaded MT4 from FXCM, and FXCM is the broker that prohibits setting SL&TP?
 
godmatrix:

I downloaded MT4 from FXCM, and FXCM is the broker that prohibits setting SL&TP?


>>broker that prohibits setting SL&TP?

Not correct, they allow SL and TP.

But you need to send the order (OrderSend(...)) without SL and TP, when order is placed you can modify and set SL or/and TP (OrderModify(...))!

 
EADeveloper:


>>broker that prohibits setting SL&TP?

Not correct, they allow SL and TP.

But you need to send the order (OrderSend(...)) without SL and TP, when order is placed you can modify and set SL or/and TP (OrderModify(...))!


make sense.

so different brokers have differenct conventions?

 
godmatrix:


make sense.

so different brokers have differenct conventions?


i know 2 types of brokers ...

"normal" brokers .. you can send orders with or without SL and TP

"ECN" brokers ... you can send orders ONLY WITHOUT SL and TP but modify existing/placed orders.

Both has advantages .. spread for example or marketprice

 

i used to use interbank. not sure if one would categorize them as normal or ecn, but they allow you to open orders with TP but you must modify the order if you wish to add a SL.

Reason: