Help adding a take profit to EA

 

Hi, I have a EA (attached) which i want to add a take profit function to I have tried to add one myself but it either doesnt work or wont compile, i think it may be more complex than i think as i still want the other functions to work.

can anyone assist with this?

Regards

console

Files:
 

Check help in MetaEditor - it's all there.

When you open order:

OrderSend(Symbol(), OP_BUYSTOP, Lots,

Ask+Point*BuyStop_Diff, Slippage, Ask+Point*BuyStop_Diff-BuyStop_SL*Point,

0, NULL, MyMagicNumber, c_time+60*Expiration, Red);[/CODE]

You should put your take profit instead of 0. Remember to check if it is higher than open price when you buy and lower when you sell.

When you modify existing order:

[CODE]OrderModify(OrderTicket(), OrderOpenPrice(), Bid-Point*TrailingStop, 0, 0);

This 0 should be replaced with your new take profit if you want to change it or OrderTakeProfit() if you want to keep take profit as it is. But it should not be 0 - 0 means no take profit.