Adding multiple Take Profits and Stops on one trade

 
I'm not a newbe on MT4 but I have a new requirement ot set up a list of Take Profits for partial close outs when you first trade. For example, buy 10 lots, TP 3 lost at +50, 3 lots at +100, and the final 4 at +200. I know I can do it manually but it was pointed out to me that it can be done automatically on other systems like GTS Pro. Is there any coding out there that will accomplish this?
 

you can use OrderSend() to close part of a position.

 
phy:

you can use OrderSend() to close part of a position.


hi phy,

i know you are a great coder,but can you help me with an ea on parabolic sar? my e-mail is yemiojes@fastermail.com. Thanks.

 
phy:

you can use OrderSend() to close part of a position.

Is there a script that is already written to take partial profit on orders that are active?

 
TommyM:
I'm not a newbe on MT4 but I have a new requirement ot set up a list of Take Profits for partial close outs when you first trade. For example, buy 10 lots, TP 3 lost at +50, 3 lots at +100, and the final 4 at +200. I know I can do it manually but it was pointed out to me that it can be done automatically on other systems like GTS Pro. Is there any coding out there that will accomplish this?

TommyM

Did you ever get an answer to your question? I find it hard to believe that you just can't attach a sell order to modify your buy order by the number of lots...

 
forexbomb wrote >>

TommyM

Did you ever get an answer to your question? I find it hard to believe that you just can't attach a sell order to modify your buy order by the number of lots...

extern double Lot=10;
extern int TP=200;
extern int TP1=50;
extern double Close1=3;
extern int SL1=10;

extern int TP2=100;
extern double Close2=3;
extern int SL2=50;

********************

double CP=0;

//here loop throw your open orders

//for buy orders:

CP=((Bid-OrderOpenPrice())/Point);

if (CP>TP1&&TP1>0)
{
if (OrderLots()==Lot)
{
OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice()+SL1*Point, OrderTakeProfit(), 0, Blue);
OrderClose(OrderTicket(),Close1,Bid,3,CLR_NONE);
}
}

if (CP>TP2&&TP2>0)
{
if (OrderLots()==Lot-Close1)
{
OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice()+SL2*Point, OrderTakeProfit(), 0, Blue);
OrderClose(OrderTicket(),Close2,Bid,3,CLR_NONE);
}
}

//sell orders

CP=((OrderOpenPrice()-Ask)/Point);

if (CP>TP1&&TP1>0)
{
if (OrderLots()==Lot)
{
OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice()-SL1*Point, OrderTakeProfit(), 0, Blue);
OrderClose(OrderTicket(),Close1,Ask,3,CLR_NONE);
}
}

if (CP>TP2&&TP2>0)
{
if (OrderLots()==Lot-Close1)
{
OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice()-SL2*Point, OrderTakeProfit(), 0, Blue);
OrderClose(OrderTicket(),Close2,Ask,3,CLR_NONE);
}
}

more nice will be to include the "NormaliceDouble" also, i know :-)

Reason: