Partially Closing ONE trade with different TP levels

To add comments, please log in or register
kaleb
161
kaleb  

Dear Forum,

 

I have a question I hope you can help me:

Is there any possibility that I can open ONE trade and close it partially in different levels with MT4?

For example:

I open a trade with 1 lot.

-0.4 will be closed with TP of +10 pips. Remaining 0.6 lots

-0.3 will be closed with TP of +20 pips. Remaining 0.3 lots

-0.3 will be closed with TP of +30 pips. Remaining 0.0 lots

 

 I'd like to avoid opening 3 trades with different volumes (0.4, 0.3, 0.3)

I'd appreciate your feedback.

 

Kind Regards

 

Thomas 

GreenMoney
369
GreenMoney  
kaleb:

Is there any possibility that I can open ONE trade and close it partially in different levels with MT4?

Yes.  Try using OrderClose().  For example, open 1 lot order with TP of +30; then use OrderClose() to close 0.4 lots at +10 and to close 0.3 lots at +20.  The remaining 0.3 lots will close when +30 TP is reached.
Alain Verleyen
37479
Alain Verleyen  
Where is the problem, do it exactly as you describe it.
whroeder1
17952
whroeder1  

The only 'problem' is remembering that you did the partial close on a restart.

Fixed initial lot size no problem.  One partial close (just move SL to BE, then close) no problem.

Otherwise you'll have to find the high since the order open so you know if you've done none, one, or two. (Third can be done auto by TP)

How hard is it to open three orders at three sizes:

   double   size  = NormalizeLots(lotsNew / 9.);
   if(size > 0) if(  OpenNew(Magic.Number.Base+MN.TP3, size))  lotsNew -= size;
            size  = NormalizeLots(lotsNew / 3.);
   if(size > 0) if(  OpenNew(Magic.Number.Base+MN.TP2, size))  lotsNew -= size;
                     OpenNew(Magic.Number.Base+MN.TP1, lotsNew);
To add comments, please log in or register