Help Needed

 

My EA have 4 orders.

Ticket 1 and ticket_2 are executed at current price,

and ticket_3 is pending order 50 pips under the current price.

and then if ticket_3 is triggered by price I want to add a ticket_4.

Please can somebody code this logics.....

if ticket_3 is opened then open tiket_4

Thanks

 
forexflash:
My EA have 4 orders. Ticket 1 and ticket_2 are executed at current price, and ticket_3 is pending order 50 pips under the current price. and then if ticket_3 is triggered by price I want to add a ticket_4. Please can somebody code this logics.....if ticket_3 is opened then open tiket_4Thanks

The idea is to check in the trade terminal if you have a pending order. If not (the previous was triggered), jump in OrderSend(); function to open a new pending:

int CountStopLongs(){ int count=0; int trade; int trades=OrdersTotal(); for(trade=0;trade<trades;trade++) { OrderSelect(trade,SELECT_BY_POS,MODE_TRADES); if(OrderSymbol()!=Symbol() || OrderMagicNumber() != MagicNumber) continue; if(OrderType()==OP_BUYSTOP) count++; } //---- for return(count);}int CountStopShorts(){ int count=0; int trade; int trades=OrdersTotal(); for(trade=0;trade<trades;trade++) { OrderSelect(trade,SELECT_BY_POS,MODE_TRADES); if(OrderSymbol()!=Symbol() || OrderMagicNumber() != MagicNumber) continue; if(OrderType()==OP_SELLSTOP) count++; } //---- for return(count);}int start(){ if(CountStopShorts() + CountStopLongs() == 0) OrderSend(.......);}

It is just the idea. You can code it as per your style.

Hope that helps,

FerruFx

 

Thanks!!!
You are the man!

 
forexflash:
Thanks!!!
You are the man!

You're welcome.

FerruFx

Reason: