Placing Buy stop Orders on ECN Brokers.

 

Hi,I want to place buy stop after an ma cross has happened.But I also need to take into the account

my ECN brokers Stop Level (distance at which he allows me to place stop orders(sell/buy) from the current price).

Please tell me if I am doing it right because it doesnt place SL/TP on the opened order.

         double bsl=0; // If user sets SL to zero, sets its value to zero.
         double btp=0; // If user sets TP to zero, sets its value to zero.
         if(StopLoss!=0)bsl=Ask-(StopLoss*pips);     // If its set value is not zero,set the value.
         if(TakeProfit!=0)btp=Ask+(TakeProfit*pips); // If its set value is not zero,set the value.
         // Now it checks for the number of open orders on current pair,and if it doesn't exceed my preset opened order number, it opens another one.
         if(OpenOrdersThisPair(Symbol())<(MaxOpenOrders+1))int buyticket = OrderSend(Symbol(),OP_BUYSTOP,LotSize,Ask+(BrStopLevel*pips),3,0,0,NULL,MagicNumber,0,Green);
         if(buyticket>0)OrderModify(buyticket,OrderOpenPrice(),bsl,btp,0,CLR_NONE);
 
t0mbfunk:

Hi,I want to place buy stop after an ma cross has happened.But I also need to take into the account

my ECN brokers Stop Level (distance at which he allows me to place stop orders(sell/buy) from the current price).

Please tell me if I am doing it right because it doesnt place SL/TP on the opened order.

Why doesn't it ?  what error do you get ?  what are all the relevant variables when it fails ?  oh,  you aren't testing the return value or printing the error or any relevant variables . . .  why not ?

Read this:   What are Function return values ? How do I use them ?

You can set TP & SL when you place a Pending Order with an ECN "type" Broker. 

Does your Order comply with this ?   Requirements and Limitations in Making Trades

 

Thanks for the help,hope you can answer these:

Can I set the buy/sell stop orders with "Stop Loss" and "Take Profit"  right away, in one go?

Or do I have to first place them and then modify the orders?

And is this legit?:

int buyticket = OrderSend(Symbol(),OP_BUYSTOP,LotSize,Ask+(BrStopLevel*pips),3,0,0,NULL,MagicNumber,0,Green);
if(buyticket>0)OrderModify(buyticket,OrderOpenPrice(),bsl,btp,0,CLR_NONE);

I mean in the return of the buy ticket,does this work with pending orders or only with market? Thanks
 
t0mbfunk:

Thanks for the help,hope you can answer these:

Can I set the buy/sell stop orders with "Stop Loss" and "Take Profit"  right away, in one go?

Or do I have to first place them and then modify the orders?

As already said, for Pending Orders you can set your SL/TP together with your order.
 
Thank you both,I am not getting enough sleep lately thats why I didnt notice.