Help with a script for grid trading

 
If I use the "grid trading" technique and open sell or buy postions in EURUSD and USDJPY and pending limit sell or buy with TP every 5,6,..30 pips (variable). Can somebody help me to make a script that automatically closes the positions and pending orders, when the pips difference is 5,6..30 (variable) in profit or -5,-6,...-30 (variable) in loss.
 
There is a script, published on this forum some time back, which does this, i think! It is called Makegrid.

Regards,

Hugh