# 3 position Stop Loss moving with difference parameters(BE, SL2, SL3)

5

Hello,

At the outset, I apologize for my English, most of the work done by google translator. Thank you for your patience with this text :)

Problem description:
I need after the first Target profit were offset any remaining orders to break even

In this code after the first profit Target is moved only order 2, but the order is still 3 initial stop loss.

I need to get to breakeven and 3 order

Modify order 3 -2014.6.17-1:28 , together with order 2. This is missing

Check screen>

Order 1 and 2 is OK, but order 3 missing shift to BE

```#property copyright "Copyright 2015"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//|                      GLOBALNE PREMENNE                           |
//+------------------------------------------------------------------+
//Money management and position sizing
extern double Profit_Target1_v_pipoch  = 100; //PT1
extern double Stop_Loss_v_pipoch1      = 100; //SL1
extern double Velkost_pozicie1         = 0.50;//LOT1
//
extern double Profit_Target2_v_pipoch  = 200; //PT2
extern double Stop_Loss_v_pipoch2      = 100; //SL2
extern double Velkost_pozicie2         = 0.30;//LOT2
//
extern double Profit_Target3_v_pipoch  = 350; //PT3
extern double Stop_Loss_v_pipoch3      = 100; //SL3
extern double Velkost_pozicie3         = 0.20;//LOT3
//
extern double Posun_na_BE_v_pipoch     = 100;//
//
//STRATEGY
extern double SMA_Period               = 24;//
//
//********************************************************************
int start()
{
//+------------------------------------------------------------------+
//|                 DEFINICIA PREMENNYCH NA STARTE                     |
//+------------------------------------------------------------------+

//------
int Magic_number1 = 1001;                             //ID strategie
int ticket1, ticket2, ticket3, q, p, modify;   //Premenna pre zadanie prikazu, Pocitadlo
double SL1 = Stop_Loss_v_pipoch1 * Point;
double SL2 = Stop_Loss_v_pipoch2 * Point;
double SL3 = Stop_Loss_v_pipoch3 * Point;
double PT1 = Profit_Target1_v_pipoch * Point;
double PT2 = Profit_Target2_v_pipoch * Point;
double PT3 = Profit_Target3_v_pipoch * Point;
double BE  = Posun_na_BE_v_pipoch * Point;
double SMA = iMA(Symbol(), PERIOD_CURRENT, SMA_Period, 0, MODE_SMA, PRICE_CLOSE, 1);//Hodnota SMA
double C   = iClose(NULL, PERIOD_CURRENT, 0);  //Zisti hodnotu close aktualnej sviecky
double H   = iHigh(NULL, PERIOD_CURRENT, 0);   //Zisti hodnotu high aktualnej sviecky
double L   = iLow(NULL, PERIOD_CURRENT, 0);    //Zisti hodnotu low aktualnej sviecky
double H1  = iHigh(NULL,PERIOD_CURRENT, 1);
double L1  = iLow(NULL,PERIOD_CURRENT, 1);

string Text1 = "Position 1";        //Komentar
string Text2 = "Position 2";
string Text3 = "Position 3";

//+------------------------------------------------------------------+
//|                          Move on BE                              |
//+------------------------------------------------------------------+
&& OrderMagicNumber()==Magic_number1 && OrderStopLoss()!=OrderOpenPrice())
{modify=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(), 0, Blue);}
&& OrderMagicNumber()==Magic_number1 && OrderStopLoss()!=OrderOpenPrice())
{modify=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(), 0, Red);}

//+------------------------------------------------------------------+
//|                   Obmedzovac poctu vstupov                       |
//+------------------------------------------------------------------+
for (q=0;q<OrdersTotal();q++)
{return(0);}}

//+------------------------------------------------------------------+
//+------------------------------------------------------------------+

if ((C>SMA)  )
{
//First position/Open 3 position with fix stop loss... 10 pips
//If profit 1 is achieved, position 2 is move on breakeven BE

// This is my problem...
//*******************************************************************************************
//*******************************************************************************************
//Problem is>
// when you reach the profit target_1, so the BE is moved only position 2,
// third position but remains at -10 pips stop loss
// and I will need to get to BE with position two
// so if I reach profit on position 1, the remaining positions need to move to breakeven

}

return(0);
}```

Mat

Moderator
10614

`if (OrderSelect(p, SELECT_BY_POS, MODE_TRADES) && OrderType()==OP_BUY && Bid >= OrderOpenPrice()+BE`
I don't see that p is initialised with a value anywhere.