# Repeating process at different prices?

At the moment I have some very overly convoluted code which is repeating a process at different prices with different ticket numbers etc. I am a bit lost as to finding out a way to get the code to repeat, but at a new price (if this is possible?) Hopefully it is clear from what I have posted. The idea is simple, there is a Buy Stop above an open Buy, and when the Buy Stop is reached, the two -now open- positions share the same stop loss. When the stop loss is hit, a new Buy is opened and the process repeats from here. At the moment I am manually writing all new code for each part which is confusing and will not be very useful when I am trying to figure out the next steps of this module.

Any help or guidance is greatly appreciated.

```int ticket,ticket2,ticket3, ticket4,ticket5,ticket6, ticket7;

double SLP;
double price= 1.78600;
double price2 = price + 0.0050;
double lotsize1= 0.1;
//double price2 = SLP +0.0002

extern int StopLoss = 200;

int OnInit()
{
SLP = price2 - StopLoss*Point;

return(INIT_SUCCEEDED);
}

void OnTick()
{

// double newlevel= SLP + 0.0032;
//double newlevel2 = newlevel + 0.003;
// double newlevelb = SLP-0.0022;

double price3 = SLP+0.0002;
double price4 = price3+0.0050;
double SLP2 = price4-0.0020;
double price5 = SLP2+0.0002;
double price6 = price5+0.0050;
double SLP3 = price6-0.0020;
double price7 = SLP3+0.0002;

{
static bool checked=false;
{
checked=true;

bool res = OrderModify(ticket,0,SLP,0,0,clrNONE);

}}
{
static bool checked2=false;
if(!checked2 && OrderSelect(ticket3,SELECT_BY_TICKET) && OrderType() == OP_BUY)
{
checked2=true;

}}

{
static bool checked3=false;
if(!checked3 && OrderSelect(ticket4,SELECT_BY_TICKET) && OrderType() == OP_BUY)
{
checked3=true;

bool res = OrderModify(ticket3,0,SLP2,0,0,clrNONE);

}}

{
static bool checked4=false;
if(!checked4 && OrderSelect(ticket5,SELECT_BY_TICKET) && OrderType() == OP_BUY)
{
checked4=true;

}}
{
static bool checked5=false;
if(!checked5 && OrderSelect(ticket6,SELECT_BY_TICKET) && OrderType() == OP_BUY)
{
checked5=true;

bool res = OrderModify(ticket5,0,SLP3,0,0,clrNONE);