EventSetTimer(1);
LANGUAGE=TerminalInfoString(TERMINAL_LANGUAGE)=="Russian";
if(IsTesting()) ObjectsDeleteAll(0);
val=AccountCurrency();
string GVn=StringConcatenate("cm mg ",AN," ",Symbol());
if(IsTesting()) GVn=StringConcatenate("Test ",GVn);
GV_kn_BS=StringConcatenate(GVn," BS");
GV_kn_SS=StringConcatenate(GVn," SS");
GV_kn_BL=StringConcatenate(GVn," BL");
GV_kn_SL=StringConcatenate(GVn," SL");
GV_kn_TrP=StringConcatenate(GVn," TrP");
GV_kn_CBA=StringConcatenate(GVn," CBA");
GV_kn_CSA=StringConcatenate(GVn," CSA");
GV_kn_CA=StringConcatenate(GVn," CA");
GV_kn_TR=StringConcatenate(GVn," TR");
RectLabelCreate(0,"cm F",0,229,2,220,304,clrIvory);
DrawLABEL("cm шт",Text(LANGUAGE,"шт","pcs"),95,10,clrBlack,ANCHOR_CENTER);
DrawLABEL("cm шаг",Text(LANGUAGE,"шаг","step"),40,10,clrBlack,ANCHOR_CENTER);
int y=40;
DrawLABEL("cm fs",Text(LANGUAGE,"расстояние до первого Stop","distance to the first Stop"),220,26,clrBlack,ANCHOR_LEFT);
ButtonCreate(0,"cm Trailing Stop",0,225,y,100,20,"Trailing Stop","Arial",8,clrBlack,clrLightGray,clrLightGray,clrNONE,GlobalVariableCheck(GV_kn_TR));y+=22;
ButtonCreate(0,"cm Buy Stop",0,225,y,100,20,"Buy Stop","Arial",8,clrBlack,clrLightGray,clrLightGray,clrNONE,GlobalVariableCheck(GV_kn_BS));y+=22;
ButtonCreate(0,"cm Sell Stop",0,225,y,100,20,"Sell Stop","Arial",8,clrBlack,clrLightGray,clrLightGray,clrNONE,GlobalVariableCheck(GV_kn_SS));y+=22;
DrawLABEL("cm fl",Text(LANGUAGE,"расстояние до первого Limit","distance to the first Limit"),220,y+10,clrBlack,ANCHOR_LEFT);y+=22;
ButtonCreate(0,"cm Buy Limit",0,225,y,100,20,"Buy Limit","Arial",8,clrBlack,clrLightGray,clrLightGray,clrNONE,GlobalVariableCheck(GV_kn_BL));y+=22;
ButtonCreate(0,"cm Sell Limit",0,225,y,100,20,"Sell Limit","Arial",8,clrBlack,clrLightGray,clrLightGray,clrNONE,GlobalVariableCheck(GV_kn_SL));
y=40;
EditCreate(0,"cm TrailingStop",0,120,y,50,20,IntegerToString(OrdersBuyStop),"Arial",8,ALIGN_CENTER,false);y+=22;
EditCreate(0,"cm OrdersBuyStop",0,120,y,50,20,IntegerToString(OrdersBuyStop),"Arial",8,ALIGN_CENTER,false);y+=22;
EditCreate(0,"cm OrdersSellStop" ,0,120,y,50,20,IntegerToString(OrdersSellStop),"Arial",8,ALIGN_CENTER,false);y+=44;
EditCreate(0,"cm OrdersBuyLimit" ,0,120,y,50,20,IntegerToString(OrdersBuyLimit),"Arial",8,ALIGN_CENTER,false);y+=22;
EditCreate(0,"cm OrdersSellLimit",0,120,y,50,20,IntegerToString(OrdersSellLimit),"Arial",8,ALIGN_CENTER,false);
y=40;
EditCreate(0,"cm FirstLevelStop",0,65,y,50,20,IntegerToString(FirstLevelStop),"Arial",8,ALIGN_CENTER,false);y+=22;
EditCreate(0,"cm StepBuyStop",0,65,y,50,20,IntegerToString(StepBuyStop),"Arial",8,ALIGN_CENTER,false);y+=22;
EditCreate(0,"cm StepSellStop",0,65,y,50,20,IntegerToString(StepSellStop),"Arial",8,ALIGN_CENTER,false);y+=22;
EditCreate(0,"cm FirstLevelLimit",0,65,y,50,20,IntegerToString(FirstLevelLimit),"Arial",8,ALIGN_CENTER,false);y+=22;
EditCreate(0,"cm StepBuyLimit",0,65,y,50,20,IntegerToString(StepBuyLimit),"Arial",8,ALIGN_CENTER,false);y+=22;
EditCreate(0,"cm StepSellLimit",0,65,y,50,20,IntegerToString(StepSellLimit),"Arial",8,ALIGN_CENTER,false);y+=22;
DrawLABEL("cm lot",Text(LANGUAGE,"Лот","Lot"),220,y+10,clrBlack,ANCHOR_LEFT);
EditCreate(0,"cm Lot",0,175,y,50,20,DoubleToString(Lot,2),"Arial",8,ALIGN_CENTER,false);
EditCreate(0,"cm LotPlus",0,120,y,50,20,DoubleToString(LotPlus,2),"Arial",8,ALIGN_CENTER,false);
EditCreate(0,"cm K_Lot",0,65,y,50,20,DoubleToString(K_Lot,2),"Arial",8,ALIGN_CENTER,false);
DrawLABEL("cm +","+",125,y+10,clrBlack,ANCHOR_LEFT);
DrawLABEL("cm x","x",70,y+10,clrBlack,ANCHOR_LEFT);y+=22;
DrawLABEL("cm prof",Text(LANGUAGE,"Взятие прибыли","Profit taking"),220,y+10,clrBlack,ANCHOR_LEFT);
DrawLABEL("cm val",val,95,y+10,clrBlack,ANCHOR_CENTER);y+=22;
ButtonCreate(0,"cm Close Buy",0,225,y,100,20,"Close Buy");
EditCreate(0,"cm CloseProfitB",0,120,y,50,20,DoubleToString(CloseProfitB,2),"Arial",8,ALIGN_CENTER,false);
ButtonCreate(0,"cm Close Buy A",0,65,y,50,20,"auto","Arial",8,clrBlack,clrLightGray,clrLightGray,clrNONE,GlobalVariableCheck(GV_kn_CBA));y+=22;
ButtonCreate(0,"cm Close Sell",0,225,y,100,20,"Close Sell");
EditCreate(0,"cm CloseProfitS",0,120,y,50,20,DoubleToString(CloseProfitS,2),"Arial",8,ALIGN_CENTER,false);
ButtonCreate(0,"cm Close Sell A",0,65,y,50,20,"auto","Arial",8,clrBlack,clrLightGray,clrLightGray,clrNONE,GlobalVariableCheck(GV_kn_CSA));y+=22;
ButtonCreate(0,"cm Close",0,225,y,100,20,"Close");
EditCreate(0,"cm ProfitClose",0,120,y,50,20,DoubleToString(ProfitClose,2),"Arial",8,ALIGN_CENTER,false);
ButtonCreate(0,"cm Close A",0,65,y,50,20,"auto","Arial",8,clrBlack,clrLightGray,clrLightGray,clrNONE,GlobalVariableCheck(GV_kn_CA));y+=22;
ButtonCreate(0,"cm Tral Profit",0,225,y,100,20,Text(LANGUAGE,"Трал профита","Tral profit"),"Arial",8,clrBlack,clrLightGray,clrLightGray,clrNONE,GlobalVariableCheck(GV_kn_TrP));
EditCreate(0,"cm TralStart",0,120,y,50,20,DoubleToString(TralStart,2),"Arial",8,ALIGN_CENTER,false);
EditCreate(0,"cm TralClose",0,65,y,50,20,DoubleToString(TralClose,2),"Arial",8,ALIGN_CENTER,false);y+=22;
ButtonCreate(0,"cm off",0,225,y,210,20,Text(LANGUAGE,"Отключение после взятия профита","Shutdown after taking profit"),"Arial",8,clrBlack,clrLightGray,clrLightGray,clrNONE);
ButtonCreate(0,"cm Clear",0,75-X,25-Y,70,20,Text(LANGUAGE,"Очистка","Clear"),"Times New Roman",8,clrBlack,clrGray,clrLightGray,clrNONE,false,CORNER_RIGHT_LOWER);
return(INIT_SUCCEEDED);
}