I need a function to add orders when pass a number of ticks determined by my.

 
I need a function to accumulate orders, for example if I have a purchase order, and the market is going up, and up 20 pips above my active order, I have to enter another order. If again after 20 pips above this last another order, another order released. So until I get the state to close all orders. This means I need to accumulate orders until the market turns
How I can do?
 
So go through the orders, find the highest one. I already gave you the code in a PM. If the market is above the highest by 20 pips, open another.
Since there are no slaves here, there are only two choices: learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you.
Reason: