how to write code mql4, TP 1st 50% position at price_1, and TP 2nd 50% at price_2.

 

Hi,

Im new doing mql4, 

for instance, i have opened a Buy, willing to TP 50% of position when price going up to price_1, and TP the rest of 50% when price going higher to price_2. but if the price not reaching price_2, coming back to price_1, then TP 2nd 50% at price_1.


please help. 


many thanks.

 
zeeyeetee:

for instance, i have opened a Buy, willing to TP 50% of position when price going up to price_1, and TP the rest of 50% when price going higher to price_2. but if the price not reaching price_2, coming back to price_1, then TP 2nd 50% at price_1.

This is a typically vague instruction that we get in Freelance. How far must price go beyond TP 1 before deciding that a return to TP 1 will trigger closing the remainder of the position?

The simple answer to your question is, when the price has moved beyond TP 1, set the SL at TP 1

Reason: