Code for stop trading after target pips reached

 
Hi,

This might have been asked before. If so please kindly point me to the particular thread as forum search did not turn up any relevant result. I would like to add a code to my ea so that the ea will stop trading after reaching a certain number of target pips (e.g. 50 pips) for one trading day; then the next trading day the ea will start anew.

Your help is very much appreciated.
 
Here. I just coded this the recently. Take out the parts you don't need if you like.
 
ubzen:
Here. I just coded this the recently. Take out the parts you don't need if you like.

Hi Ubzen, Thank you very much. It's quite complicated for my standard but I'll work on it.