//+------------------------------------------------------------------+
//|                                       instant information v1.mq4 |
//|                                Савельев Евгений© 2011, EVgEN_SA. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
//  Этот индюк также содержит код взятый у индикатора (BarTimer.mq4)

#property copyright "Савельев Евгений© 2011, EVgEN_SA."
#property link      "http://www.metaquotes.net"


#property indicator_separate_window  
#include <WinUser32.mqh>
#define DEALS          0
#define SYMBOLS_MAX 1024
#define BUY_LOTS       1
#define BUY_PRICE      2
#define SELL_LOTS      3
#define SELL_PRICE     4
int    ExtSymbolsTotal=0;

string ExtSymbols[SYMBOLS_MAX];
#define PROFIT         6
 double ExtSymbolsSummaries[SYMBOLS_MAX][7];
 
/////////////


extern int asd=600;
extern int asds=55;

extern int Balanc=2518; 
extern double kurs_valuta=30.86;
extern int pip= 150;

/// ****
//+------------------------------------------------------------------+
//|                                                     BarTimer.mq4 |
//|                               Copyright © 2008, Art Royal s.r.o. |
//|                                           Author: Vasyl Gumenyak |  
//|                                           http://www.jiport.com/ |
//+------------------------------------------------------------------+
extern string FontName="Arial";
extern int FontSize=24;
extern color FontColor=Red;
extern int Corner=0;// values [0-3] - опорный угол
extern int XDistance=2;// x расстояние от опорного угла
extern int YDistance=5;// y расстояние от опорного угла
int lenbase;
string s_base=":...:...:...:...:";// строка для формирования индикатора с ползунком

  extern int seckd=1;
  extern int pipss=10;
//****  

 
  
  extern bool   Bid_Colors = True; 
  extern string FontType=" Sans MS";
  extern color ColorHeading =  Gainsboro ;
  extern color ColorValue = CadetBlue ;  
  extern int  TimeFrame  = 1440;
  extern  int    Trend_Bars = 10;
  extern bool show.Trend = false ;  
  extern bool show.CTrend = true ;
  extern int price.x.offset= 20;
  extern int price.y.offset= 50;     
  color  ColorPrice = CadetBlue;
  extern int    myArrowSize  = 15 ;
  int MAP =1;
  int Spread;
  int Local_Time;
  string   labelNames;
  string   shortName;
 int RAZip;
  int      corner;
  int      totalLabels;
  int      window;    
  int nDigits;
  int pZX;
  int PTL;
  int EROS;
  int EROB;

  int Mar ;
  int ao;
  int Mar1 ;
  int Mar2 ;
 int Mar3 ;
 int Mar31 ;
 int Mar41 ;
  int Mar4 ;
  int Mars3 ;
  int Mars4 ;
 int op_op ;
 int hid_hid ;
 int Low_Low ;

  int LOTS_BUY ;
  int LOTS_SELL ;
  int RAZ_LOTS ;
  int RAZ_LOTS1 ;
  
  int SWOP_BUY ;
  int SWOP_SELL ;
  int RAZ ;
  int LOTS ;
  int LOTS1 ;
  
  int h_op ;
  int l_op ;
   int RUB ;
   int RUB_s ;
   
  int OST_RUB ;
  int tickvalue ;
 
/////////////////////////////////////////////////////////////  
  
  double       O_P;
  double       O_P1;
  double       O_P2;
  int    F_Offset=0;
  string Arrow12 = "й";  // 12 oclock 225
  string Arrow12_2 = "с"; // 12 oclock
  string Arrow6  = "к";  //  6 oclock 226
  string Arrow6_2  = "т";  // 6 oclock 
  extern color N_color  = Lime; 
  extern color S_color  = Red;
  double  xREV;
  double  xREV1;
 double  xREV2;
 
 
  int   BidDir, R77Dir; 
  string PriceDir;
  string PriceDir1;
  string PriceDir9;
  
  color  CloseColor ;
  color  CloseColor1 ; 
  int NormalSpread, NormalStopLevel; 
  color fColor( double i)
{
color rColor ;
 
    if ( i == 1 ) rColor = N_color ; else {
   
    if ( i == 0 ) rColor =  S_color  ; else {    
    rColor = S_color ; } } 
 
return ( rColor );
}
 
int fDirection( double i, double j)
{
int rColor ;
 
    if ( i > j ) rColor = 1; 
    else {
    if ( i < j )  rColor = 0; 
    else rColor = 0; }
return ( rColor );
}
 
 
string fCompass( double i )
{
string rCompass ;
 
    if ( i == 1 ) rCompass = Arrow12 ; else {    
    if ( i == 0 ) rCompass = Arrow6  ; else {    
    rCompass = Arrow6 ; } } 
    
    
return ( rCompass );
}
  
 /////////////////////////////>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.....#2 
  color tColor( double i)
{
color tColor ;
 
    if ( i == 1 ) tColor = N_color ; else {     
    if ( i == 0 ) tColor =  S_color  ; else {    
    tColor = S_color ; } } 
 
return ( tColor );
}
 
 
int gDirection( double i, double j)
{
int tColor ;
 
    if ( i > j ) tColor = 1; 
    else {
    if ( i < j )  tColor = 0; 
    else tColor = 0; }
return ( tColor );
}
 
 
 
 
string gCompass( double i )
{
string gCompass ;
 
    if ( i == 1 ) gCompass = Arrow12 ; else {    
    if ( i == 0 ) gCompass = Arrow6   ; else {    
    gCompass = Arrow6 ; } } 
    
    
return ( gCompass );
} 
  
  
  
  
  
 
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+  
   
int init()
  {

 lenbase=StringLen(s_base);


   corner     = 0;
   shortName  = MakeUniqueName("MT ","");

   IndicatorShortName(shortName);
   
   NormalSpread=MarketInfo(Symbol(),MODE_SPREAD);
   NormalStopLevel=MarketInfo(Symbol(),MODE_STOPLEVEL);
   start();
   
   
    
   string S = Symbol();
        
   if(S=="ER2" ||S=="FESX" || S=="FTSE" || S=="FDAX") nDigits = 1 ; 
  //  if(S=="ER2" ||S=="FESX" || S=="FTSE" || S=="FDAX") ao=100; 
           
   if(S=="GBPJPY" ||S=="EURJPY" || S=="USDJPY" || S=="GOLD" || S=="AUDJPY"||S=="FGBL"||   
   S=="NZDJPY"|| S=="CADJPY" ||S== "CHFJPY" || S=="BRN" ||S=="WTI" || S=="NQ" || S=="ES"|| S=="XAU") nDigits = 2;
   
   if(S=="GBPJPY" ||S=="EURJPY" || S=="USDRUR" || S=="USDJPY" || S=="GOLD" || S=="AUDJPY"||S=="FGBL"||   
   S=="NZDJPY"|| S=="CADJPY" ||S== "CHFJPY" || S=="BRN" ||S=="WTI" || S=="NQ" || S=="ES"|| S=="XAU") ao=100;
   
   if( S=="USDRUR" ) ao=1000;
      
   if(S=="GBPUSD" || S=="EURUSD"  || S=="NZDUSD" || S=="USDCHF"  ||
   S=="USDCAD" ||S=="AUDUSD" || S=="EURUSD" ||S=="EURCHF"  || S=="EURGBP"
   || S=="EURCAD" ||S=="EURAUD" || S=="AUDNZD"|| S== "GBPCHF"|| S=="EURAUD"||   
   S=="GBPAUD"|| S== "AUDCAD" || S=="AUDCHF"|| S=="NZDCHF"|| S=="NZDCAD" ||S=="NZDCHF"||    
   S=="EURNZD"|| S=="CADCHF"|| S=="EURCAD"|| S=="USDNOK"|| S=="USDDKK")  nDigits = 4;
   
   if(S=="GBPUSD" || S=="EURUSD"  || S=="NZDUSD" || S=="USDCHF"  ||  S=="GBPCAD"  ||
   S=="USDCAD" ||S=="AUDUSD" || S=="EURUSD" ||S=="EURCHF"  || S=="EURGBP"
   || S=="EURCAD" ||S=="EURAUD" || S=="AUDNZD"|| S== "GBPCHF"|| S=="EURAUD"||   
   S=="GBPAUD"|| S== "AUDCAD" || S=="AUDCHF"|| S=="NZDCHF"|| S=="NZDCAD" ||S=="NZDCHF"||    
   S=="EURNZD"|| S=="CADCHF"|| S=="EURCAD"|| S=="USDNOK"|| S=="USDDKK")  ao=10000;
   
   
   
     
  int result;
 
   if (TimeFrame == 0) 
      result = Period();   
   else
   {
  switch(TimeFrame) 
      {
         case 1    : result = PERIOD_M1;  break; 
         case 5    : result = PERIOD_M5;  break;
         case 15   : result = PERIOD_M15; break;
         case 30   : result = PERIOD_M30; break;
         case 60   : result = PERIOD_H1;  break;
         case 240  : result = PERIOD_H4;  break;
         case 1440 : result = PERIOD_D1;  break;
         case 7200 : result = PERIOD_W1;  break;
         case 28800: result = PERIOD_MN1; break;
         default  : result = Period(); break; 
      }
   }
   return(result);
}
 
 
 
int deinit() 
{ 

if (ObjectFind("BarTimer") != -1) ObjectDelete("BarTimer");



   while (totalLabels>0) { ObjectDelete(StringConcatenate(labelNames,totalLabels)); totalLabels--;}
   return(0);  
}  
 
        
 //+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+ 
 
int start()
  {
  


   
   
 window = WindowFind(shortName);   
  ObjectsDeleteAll( window, 21);
  ObjectsDeleteAll( window, 22);
  ObjectsDeleteAll( window, 23);
     

   int iip=0,sec=0;
   double pc=0.0;
   string time="",s_end="",s_beg="";


     
  int i=0;
  int R77=0,CD=0,AM=0,Mval=0;
  double CC7,CC71,CC72,CC2,CC3,CC4,CC5,CC6,CC8,CC9,C91;
  double HY1,HY2,HZ1,HZ2,SC1;
  double C7_7,C7_71,C7_72,C2_2,C3_3,C4_4,C5_5,C6_6,C7_8,C7_9,C7_91;
  double HD,DL,BTX1,BTX1_1,BTX2,BTX2_2,BTX3,BTX3_3,BTX4,BTX4_4,BTX5,BTX5_5;
  double BTX6,BTX6_6,BTX7,BTX7_7,BTX8,BTX8_8,BTX9,BTX9_9,BTX10,BTX10_10,DC,DO;
  double PercentUp,Perc,Per;
  double R77T,R77T1, R77T2;
  string FX_T="Verdana Bold";  
  string T= TimeFrame;
  if (TimeFrame==0) TimeFrame=Period();
  int yPos = 24, xPos = 10;
  int xSpacer = 140;
  string SpacerText1 = "__________________________";
  string SpacerText2 = "__________________________________________________________________________________________________________";
  if(F_Offset>0) F_Offset=0;
  if(Trend_Bars>15) Trend_Bars=15;
  if(price.y.offset<10) price.y.offset=10;   
  if(price.y.offset>20) price.y.offset=20;
  if(price.x.offset<0) price.x.offset=0;
  if(myArrowSize>15) myArrowSize=15;
  
  if ( show.Trend == true) show.CTrend = false ;
  
   string S = Symbol();
 
  
   if( S=="ES"|| S=="WTI" || S=="XAU" || S=="GOLD") {EROS=13;}else {EROS=16;}
   
   if( S=="ES"||S=="WTI"||S=="XAU"||S=="GOLD") {EROB=12;}else {EROB=13;}
     
   if(S=="ER2" ||S=="FESX" || S=="FTSE" || S=="FDAX") {pZX =1000000 ;}    
   if(S=="GBPJPY" ||S=="EURJPY" || S=="USDJPY" || S=="GOLD"|| S=="AUDJPY"||S=="FGBL"||   
   S=="NZDJPY"|| S=="CADJPY" ||S== "CHFJPY" || S=="BRN" ||S=="WTI" || S=="NQ" || S=="ES"||
   S=="XAU"||S=="XAG") {pZX = 100000;}
   
   if(S=="GBPUSD" || S=="EURUSD" ||S=="NZDUSD" || S=="USDCHF"  ||
   S=="USDCAD" ||S=="AUDUSD" || S=="EURUSD" ||S=="EURCHF"  || S=="EURGBP"
   || S=="EURCAD" ||S=="EURAUD" || S=="AUDNZD"|| S== "GBPCHF"|| S=="EURAUD"||   
   S=="GBPAUD"|| S== "AUDCAD" || S=="AUDCHF"|| S=="NZDCHF"|| S=="NZDCAD" ||S=="NZDCHF"||    
   S=="EURNZD"|| S=="CADCHF"|| S=="EURCAD"|| S=="USDNOK"|| S=="USDDKK"){pZX = 1000;}
       
   CC2 =iClose(NULL,PERIOD_M5,0);
   C2_2= iOpen(NULL,PERIOD_M5,0);
   CC3 =iClose(NULL,PERIOD_M15,0);
   C3_3= iOpen(NULL,PERIOD_M15,0);
   CC4 =iClose(NULL,PERIOD_M30,0);
   C4_4= iOpen(NULL,PERIOD_M30,0);
   CC5 =iClose(NULL,PERIOD_H1,0);
   C5_5= iOpen(NULL,PERIOD_H1,0);
   CC6 =iClose(NULL,PERIOD_H4,0);
   C6_6= iOpen(NULL,PERIOD_H4,0);
   CC7 =iClose(NULL,PERIOD_D1,0);
   C7_7= iOpen(NULL,PERIOD_D1,0);
   CC71 =iClose(NULL,PERIOD_W1,0);
   C7_71= iOpen(NULL,PERIOD_W1,0);
   CC72 =iClose(NULL,PERIOD_MN1,0);
   C7_72= iOpen(NULL,PERIOD_MN1,0);
   
   CC8 =iClose(NULL,0,0);
   C7_8= iOpen(NULL,0,0);
     
     CC9 =iClose(NULL,0,0);
   C7_9= iOpen(NULL,0,0);
     
     
     

                           
   R77 =(iClose(NULL,PERIOD_D1,0)-iOpen(NULL,PERIOD_D1,0))/Point;   
   if(R77<-99) {Mval=242;}else {Mval=246;}
   DO  =  iOpen(NULL,PERIOD_H1,0);
   DC =iClose(NULL,PERIOD_H1,0);
   HD = iHigh(NULL,PERIOD_H1,0);
   DL = iLow(NULL,PERIOD_H1,0);

   PercentUp = ((R77)/(DC))/100;    
   Per = PercentUp*pZX; 
   Perc  = Per/1000;
   
   RefreshRates();
   int ActualSpread=(Ask-Bid)/Point;
   int ActualStopLevel=MarketInfo(Symbol(),MODE_STOPLEVEL);
   if (ActualSpread>NormalSpread) {SC1=2;}else  {SC1=0; }
   color ColorCH7044;
   if(SC1 >1 ) { ColorCH7044 =Red ;}  else  { ColorCH7044 =ColorHeading;}                           
  
   
   
   
   Spread=NormalizeDouble((Ask-Bid)/Point,0);   
   if(Spread<0) Spread=0;   
   

 
  R77 =(iClose(NULL,PERIOD_D1,0)-iOpen(NULL,PERIOD_D1,0))/Point;   
  if(R77<-99) {Mval=242;}else {Mval=246;}
  
            
   if (Bid_Colors == True)
   {
    if (Close[i] > O_P) ColorPrice = DodgerBlue;
    if(Close[i] > O_P ) {HY1=2;}
    if (Close[i] < O_P) ColorPrice = Silver;
     if(Close[i] < O_P) {HY2=0;}
    O_P = Close[i];
   }   
   color ColorCT709;
   if( Close[i]  < O_P2 ) { ColorCT709 =Red;} 
   O_P2 = Close[i];
    if(Close[i]  < O_P2 ) //{BP1=False;}
     
   color ColorCT708;
   if( Close[i]  > O_P1  ) { ColorCT708 =Lime;} 
   
 
 
   string Market_Price = DoubleToStr((Low[i]-Close[i])*ao,0); //+пипс-//
   string Market_Price0 = DoubleToStr((High[i]-Low[i])*ao,0); //макс бар//
   string Market_Price1 = DoubleToStr((High[i]-Close[i])*ao,0); 
   Mar=  AccountLeverage();

   string Mar1=DoubleToStr(((AccountEquity()-Balanc)*100)/(Balanc),   Digits );
   Mar2=AccountBalance()-Balanc;
  string Mar3=DoubleToStr(((asd*Point)+Low[i])-Spread*Point, Digits);
 string Mar4=DoubleToStr((High[i]-(asd*Point))+Spread*Point, Digits);
  
  string Mar31=DoubleToStr(((((asd*Point)+Low[i])-Close[i])*ao)-Spread,0);
string Mar41=DoubleToStr(((Close[i]-(High[i]-(asd*Point)))*ao)+Spread,0);

string Mars3=DoubleToStr((Open[0]+Spread*Point+(asds*Point)), Digits);
string Mars4=DoubleToStr((Open[0]-(asds*Point)), Digits);


string op_op=DoubleToStr(Open[0], Digits);
string hid_hid=DoubleToStr(High[0], Digits);
string Low_Low=DoubleToStr(Low[0], Digits);



//////////////////2линия ///////////////////////////// 
 string symbol=Symbol();
  
  string type="Реал"; if(IsDemo()) type="Демо";
   string сurrency=AccountCurrency();
   string base=StringSubstr(symbol,0,3);
   double freemargin=AccountFreeMargin();
   double lotsize_base=MarketInfo(symbol,MODE_LOTSIZE);
   double lotmargin_base=0;
   double lotmargin_сurrency_buy =0;
   double lotmargin_сurrency_sell=0;
   double ask=MarketInfo(symbol,MODE_ASK);
   double bid=MarketInfo(symbol,MODE_BID);
 double minlot=MarketInfo(symbol,MODE_MINLOT);
 double tickvalue=MarketInfo(symbol,MODE_TICKVALUE);

 double leverage=0;
 if (leverage>0) lotmargin_base=lotsize_base/leverage;
   lotmargin_сurrency_buy =lotmargin_base*ask;
   lotmargin_сurrency_sell=lotmargin_base*bid;
   
      lotmargin_base=FuturesLotMargin(symbol);
      lotmargin_сurrency_buy =lotmargin_base;
      lotmargin_сurrency_sell=lotmargin_base;
      


double swap_buy =0; if (minlot>0) swap_buy =MarketInfo(symbol,MODE_SWAPLONG )/minlot;
double swap_sell=0; if (minlot>0) swap_sell=MarketInfo(symbol,MODE_SWAPSHORT)/minlot;
double swap_buy_ticks =0; if (tickvalue>0) swap_buy_ticks =swap_buy /tickvalue;
double swap_sell_ticks=0; if (tickvalue>0) swap_sell_ticks=swap_sell/tickvalue;

string RAZ=DoubleToStr(tickvalue,2)+" "+сurrency+" (1 pips)";
string SWOP_BUY=DoubleToStr(swap_buy_ticks,2)+" "+сurrency+" (pips)";
string SWOP_SELL=DoubleToStr(swap_sell_ticks,2)+" "+сurrency+" (pips)";


double RAZip=tickvalue;

string kurss_valuta=  DoubleToStr(kurs_valuta,2);


         double buy_lots=ExtSymbolsSummaries[i][BUY_LOTS];
         double sell_lots=ExtSymbolsSummaries[i][SELL_LOTS];
         double buy_price=0.0;
         double sell_price=0.0;
         if(buy_lots!=0)  buy_price=ExtSymbolsSummaries[i][BUY_PRICE]/buy_lots;
         if(sell_lots!=0) sell_price=ExtSymbolsSummaries[i][SELL_PRICE]/sell_lots;
        
       
         double profit;
   int    iu,index,types,total=OrdersTotal();
//----+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   for(i=0; i<total; i++)
     {
     //**//останавливаем счёт buy_lots
      if(buy_lots>0) break;
      if(sell_lots>0) break;

      
     //**//
      if(!OrderSelect(i,SELECT_BY_POS)) continue;
      types=OrderType();
      if(types!=OP_BUY && types!=OP_SELL) continue;

      if(index<0 || index>=SYMBOLS_MAX) continue;
      //----
      ExtSymbolsSummaries[index][DEALS]++;
      profit=OrderProfit()+OrderCommission()+OrderSwap();
      ExtSymbolsSummaries[index][PROFIT]+=profit;
      if(types==OP_BUY)
        {
         ExtSymbolsSummaries[index][BUY_LOTS]+=OrderLots();
         ExtSymbolsSummaries[index][BUY_PRICE]+=OrderOpenPrice()*OrderLots();
        }
      else
        {
         ExtSymbolsSummaries[index][SELL_LOTS]+=OrderLots();
         ExtSymbolsSummaries[index][SELL_PRICE]+=OrderOpenPrice()*OrderLots();
        }
        
     }
//----++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   total=0;
   for(i=0; i<ExtSymbolsTotal; i++)
      {
      if(ExtSymbolsSummaries[i][DEALS]>0) total++;
    
     }
 



string LOTS_BUY=DoubleToStr(buy_lots,2);
string LOTS_SELL=DoubleToStr(sell_lots,2);
string RAZ_LOTS=DoubleToStr((buy_lots-sell_lots),2);

double dx=buy_lots-sell_lots, dy;
  
  dy=MathAbs(dx);
 
string RAZ_LOTS1=DoubleToStr((dy),2);
string LOTS=  DoubleToStr(AccountEquity()/(pip*RAZip)-dy, Digits );
string LOTS1=  DoubleToStr((AccountEquity()/(pip*RAZip)-dy)/2, Digits );

 



string h_op= DoubleToStr((High[i]-Open[i])*ao,0); //макс бар//
string l_op= DoubleToStr((Open[i]-Low[i])*ao,0); //макс бар//

string RUB=DoubleToStr ((AccountBalance()-Balanc+AccountProfit())/100*kurs_valuta, Digits );
string RUB_s=DoubleToStr (AccountProfit()/100*kurs_valuta, Digits );
string OST_RUB=DoubleToStr (AccountEquity()/100*kurs_valuta, Digits );
 
   color ColorCH704 ;  
   if(R77 >= 0 ) { ColorCH704 =LimeGreen ; }
   if(R77 >= 0 ) {HZ1=2;}
   color ColorCH705 ;  
   if(R77 < 0 ) { ColorCH705 =Silver ; }else { ColorCH705 =ColorValue ; } 
   if(R77 >= 0 ) {HZ2=0;}
   
   
    BidDir  = fDirection( HY1,HY2 ) ;
    R77Dir   = gDirection( HZ1,HZ2) ;
   xREV   =  (CC9 >= C7_9);
    xREV2   =  BidDir  ;
    xREV1   =  R77Dir  ;
    
    CloseColor = fColor(  xREV  ) ;
    CloseColor1 = tColor( xREV1 ) ;
 
 
 PriceDir = fCompass(  xREV  ) ;
    PriceDir9 = fCompass(  xREV1  ) ;
    PriceDir1 = gCompass(  xREV1  ) ;
   
  
     
 
  setObject(next(),PriceDir,1+price.x.offset, 4+price.y.offset,CloseColor ,"Wingdings",myArrowSize+F_Offset,0);
   setObject(next(),PriceDir1,110+price.x.offset, 4+price.y.offset,CloseColor ,"Wingdings",myArrowSize+F_Offset,0);

   setObject(next(),PriceDir1,210+price.x.offset, 4+price.y.offset,CloseColor1 ,"Wingdings",myArrowSize+F_Offset,0);//

  
  
  
   color ColorCX105 ;  
   if(CC2 >= C2_2 ) { ColorCX105 =LimeGreen ; }else { ColorCX105 =Red ; }   
   color ColorCX106 ;  
   if(CC3 >= C3_3 ) { ColorCX106 =LimeGreen ; }else { ColorCX106 =Red ; }
   color ColorCX107 ;  
   if(CC4 >= C4_4 ) { ColorCX107 =LimeGreen ; }else { ColorCX107 =Red ; }
   color ColorCX108 ;  
   if(CC5 >= C5_5 ) { ColorCX108 =LimeGreen ; }else { ColorCX108 =Red ; }
   color ColorCX109 ;  
   if(CC6 >= C6_6 ) { ColorCX109 =LimeGreen ; }else { ColorCX109 =Red ; }   
   color ColorCX110 ;  
   if(CC7 >= C7_7 ) { ColorCX110 =LimeGreen ; }else { ColorCX110 =Red ; }
   color ColorCX111 ;
   if(CC71 >= C7_71 ) { ColorCX111 =LimeGreen ; }else { ColorCX111 =Red ; }
   color ColorCX112 ;
   if(CC72 >= C7_72 ) { ColorCX112 =LimeGreen ; }else { ColorCX112 =Red ; }
   
  // color ColorCX100 ;
   
   color ColorCX100 ;
   if(CC8 <= C7_8 ) { ColorCX100 =LimeGreen ; }else { ColorCX100 =Red ; }
   color ColorCX101 ;
  if(CC9 >= C7_9) { ColorCX101 =LimeGreen ; }else { ColorCX101 =Red ; }
  
  color ColorCX1011 ;
   if(Mar<1 ) { ColorCX1011 =Red ; }else { ColorCX1011 =Yellow ; }
 

///данные столбцов  1_ярус 
   
  setObject(next(),Market_Price,22+price.x.offset, 5+price.y.offset,ColorCX100  ,FX_T,-2+EROS+F_Offset);
  setObject(next(),Market_Price0 ,128+price.x.offset, 5+price.y.offset,ColorPrice ,FX_T,-2+EROS+F_Offset);
  setObject(next(),Market_Price1 ,228+price.x.offset, 5+price.y.offset,ColorCX101 ,FX_T,-2+EROS+F_Offset);
  setObject(next(),TimeToStr(CurTime(),TIME_SECONDS),320+price.x.offset, 5+price.y.offset,LimeGreen ,FX_T,EROS+F_Offset);
  setObject(next(),DoubleToStr(Spread ,MathMax(0,Digits-3)),430+price.x.offset, 5+price.y.offset,Red ,FX_T,EROS+F_Offset);
  setObject(next(),Mar ,480+price.x.offset, 5+price.y.offset,ColorCX101 ,FX_T,EROS+F_Offset);
 setObject(next(),Mar1 ,840+price.x.offset, 5+price.y.offset,ColorCX1011 ,FX_T,EROS+F_Offset);
 setObject(next(),Mar2 ,550+price.x.offset, 5+price.y.offset,ColorCX1011 ,FX_T,EROS+F_Offset);

///данные столбцов  2_ярус 
  setObject(next(),h_op,20+price.x.offset, 53+price.y.offset,ColorCX100  ,FX_T,-2+EROS+F_Offset);
  setObject(next(),Market_Price0 ,128+price.x.offset, 53+price.y.offset,ColorPrice ,FX_T,-2+EROS+F_Offset);
  setObject(next(),l_op ,228+price.x.offset, 53+price.y.offset,ColorCX101 ,FX_T,-2+EROS+F_Offset);
  
  setObject(next(),"("+hid_hid+")",10+price.x.offset, 69+price.y.offset,Yellow  ,FX_T,-2+EROS+F_Offset);
  setObject(next(),"("+op_op+")" ,118+price.x.offset, 69+price.y.offset,Yellow ,FX_T,-2+EROS+F_Offset);
  setObject(next(),"("+Low_Low+")" ,218+price.x.offset, 69+price.y.offset,Yellow ,FX_T,-2+EROS+F_Offset);
  
  
  setObject(next(),kurss_valuta +сurrency,320+price.x.offset, 55+price.y.offset,LimeGreen ,FX_T,EROS+F_Offset);
  setObject(next(),DoubleToStr(Spread ,MathMax(0,Digits-3)),430+price.x.offset, 55+price.y.offset,Red ,FX_T,EROS+F_Offset);
  setObject(next(),type ,480+price.x.offset, 55+price.y.offset,ColorCX101 ,FX_T,EROS+F_Offset);
  setObject(next(),RUB+ ".руб",825+price.x.offset, 53+price.y.offset,ColorCX1011 ,FX_T,-2+EROS+F_Offset);
  setObject(next(),"("+RUB_s+".р сеанс)" ,825+price.x.offset, 69+price.y.offset,ColorCX1011 ,FX_T,-2+EROS+F_Offset);
  setObject(next(),OST_RUB ,630+price.x.offset, 55+price.y.offset,ColorCX1011 ,FX_T,EROS+F_Offset);
setObject(next(),LOTS ,550+price.x.offset, 55+price.y.offset,ColorCX1011 ,FX_T,EROS+F_Offset);
setObject(next(),"*/2* "+LOTS1 ,550+price.x.offset, 74+price.y.offset,ColorCX1011 ,FX_T,-3+EROS+F_Offset);

 
 
// изменить 
  setObject(next(),Mar4 ,140+price.x.offset, 90+price.y.offset,ColorCX1011 ,FX_T,-2+EROS+F_Offset);
  setObject(next(),"("+Mar41+")" ,220+price.x.offset, 90+price.y.offset,ColorCX1011 ,FX_T,-2+EROS+F_Offset);
  setObject(next(),Mar3 ,350+price.x.offset, 90+price.y.offset,ColorCX1011 ,FX_T,-2+EROS+F_Offset);
  setObject(next(),"("+Mar31+")" ,430+price.x.offset, 90+price.y.offset,ColorCX1011 ,FX_T,-2+EROS+F_Offset);
  //2полоса
  setObject(next(),Mars3 ,190+price.x.offset, 120+price.y.offset,ColorCX1011 ,FX_T,-2+EROS+F_Offset);
  setObject(next(),"---(buy)" ,250+price.x.offset, 120+price.y.offset,Red ,FX_T,-2+EROS+F_Offset);
  setObject(next(),Mars4 ,310+price.x.offset, 120+price.y.offset,ColorCX1011 ,FX_T,-2+EROS+F_Offset);
  setObject(next(),"---(sell)" ,370+price.x.offset, 120+price.y.offset,Red ,FX_T,-2+EROS+F_Offset);
  //

setObject(next(),RAZ ,860+price.x.offset, 90+price.y.offset,Yellow ,-5+EROS+F_Offset);
setObject(next(),SWOP_BUY ,860+price.x.offset, 110+price.y.offset,Yellow ,-5+EROS+F_Offset);
setObject(next(),SWOP_SELL ,860+price.x.offset, 130+price.y.offset,Yellow ,-5+EROS+F_Offset);
setObject(next(),LOTS_BUY ,860+price.x.offset, 150+price.y.offset,Yellow ,-5+EROS+F_Offset);
setObject(next(),LOTS_SELL ,860+price.x.offset, 170+price.y.offset,Yellow ,-5+EROS+F_Offset);
setObject(next(),RAZ_LOTS ,860+price.x.offset, 190+price.y.offset,Red ,-5+EROS+F_Offset);
//setObject(next(),RAZ_LOTS1 ,900+price.x.offset, 190+price.y.offset,Yellow ,-5+EROS+F_Offset);


/// подпись столбцов 1_ярус
   setObject(next(),"+ ПИПС -",10+price.x.offset, -12+price.y.offset,Yellow ,FX_T,-5+EROS+F_Offset);
   setObject(next(),"МАКС БАР",120+price.x.offset, -12+price.y.offset,Yellow ,-5+EROS+F_Offset);
   setObject(next(),"ОСТАТОК",220+price.x.offset, -12+price.y.offset,Yellow ,FX_T,-5+EROS+F_Offset);  
   setObject(next(),"время брокера",315+price.x.offset, -12+price.y.offset,Yellow ,-5+EROS+F_Offset);  
   setObject(next(),"спред",425+price.x.offset, -12+price.y.offset,Yellow ,FX_T,-5+EROS+F_Offset);  
   setObject(next(),"ПЛЕЧО",484+price.x.offset, -12+price.y.offset,Yellow ,FX_T,-5+EROS+F_Offset);  
   setObject(next(),"приб цент",550+price.x.offset, -12+price.y.offset,Yellow ,FX_T,-5+EROS+F_Offset);
   setObject(next(),"ПРИБЫЛЬ В %",830+price.x.offset, -12+price.y.offset,Yellow ,-5+EROS+F_Offset);
 
 /// подпись столбцов 2_ярус
setObject(next(),"ОТК_ВЕРХ",10+price.x.offset, 33+price.y.offset,Yellow ,FX_T,-5+EROS+F_Offset);
   setObject(next(),"МАКС БАР",120+price.x.offset, 33+price.y.offset,Yellow ,-5+EROS+F_Offset);
   setObject(next(),"ОТКР_НИЗ",220+price.x.offset, 33+price.y.offset,Yellow ,FX_T,-5+EROS+F_Offset);  
   setObject(next(),"введи курс-"+сurrency,315+price.x.offset, 33+price.y.offset,Yellow ,-5+EROS+F_Offset);  
   setObject(next(),"спред",425+price.x.offset, 33+price.y.offset,Yellow ,FX_T,-5+EROS+F_Offset);  
   setObject(next(),"тип счета",474+price.x.offset, 33+price.y.offset,Yellow ,FX_T,-5+EROS+F_Offset);  
   setObject(next(),"LOT-"+pip,550+price.x.offset, 33+price.y.offset,Yellow ,FX_T,-5+EROS+F_Offset);
   setObject(next(),"ОСТАТОК В RUB",630+price.x.offset, 33+price.y.offset,Yellow ,FX_T,-5+EROS+F_Offset);
   setObject(next(),"ПРИБЫЛЬ В RUB",830+price.x.offset, 33+price.y.offset,Yellow ,-5+EROS+F_Offset);
   setObject(next(),"Шаг изменения цены лота",650+price.x.offset, 90+price.y.offset,Yellow ,-5+EROS+F_Offset);
   setObject(next(),"Своп за лот для BUY",650+price.x.offset, 110+price.y.offset,Yellow ,-5+EROS+F_Offset);
   setObject(next(),"Своп за лот для SELL",650+price.x.offset, 130+price.y.offset,Yellow ,-5+EROS+F_Offset);
   setObject(next(),"Открыто лотов BUY",650+price.x.offset, 150+price.y.offset,Yellow ,-5+EROS+F_Offset);
   setObject(next(),"Открыто лотов SELL",650+price.x.offset, 170+price.y.offset,Yellow ,-5+EROS+F_Offset);
   setObject(next(),"Разница лотов",650+price.x.offset, 190+price.y.offset,Yellow ,-5+EROS+F_Offset);
   
   
   
   setObject(next(),asd+" ПИПСОВ=",5+price.x.offset, 90+price.y.offset,ColorHeading ,FX_T,-2+EROS+F_Offset);
 setObject(next(),asds+" ПИПСОВ от откр=",5+price.x.offset, 120+price.y.offset,ColorHeading ,FX_T,-2+EROS+F_Offset);
   setObject(next(),"до низа",270+price.x.offset, 90+price.y.offset,ColorHeading ,FX_T,EROS+F_Offset);
   setObject(next(),"до верха",480+price.x.offset, 90+price.y.offset,ColorHeading ,FX_T,EROS+F_Offset);
   

  if(show.Trend){
   setObject(next(),"1",755+price.x.offset, -10+price.y.offset,ColorHeading ,"Verdana",8+F_Offset); 
   setObject(next(),DoubleToStr(Trend_Bars ,0),630+price.x.offset, -10+price.y.offset,ColorHeading ,"Verdana",8+F_Offset);
   setObject(next(),"Trend",695+price.x.offset, -10+price.y.offset,ColorHeading ,FX_T,9+F_Offset);
   setObject(next(),StringSubstr((T),0),655+price.x.offset, -10+price.y.offset,ColorHeading ,FX_T,9+F_Offset);}
  
 /////////////МЕНЯЕМ ГРАНИЦА СТОЛБЦА
 ////////////вертикаль лини 1_ярус
   
   setObject(next(),SpacerText1,80+price.x.offset, 90+price.y.offset,DarkGray ,FX_T,17+F_Offset,90);  
   setObject(next(),SpacerText1,180+price.x.offset, 90+price.y.offset,DarkGray ,FX_T,17+F_Offset,90);
   setObject(next(),SpacerText1,285+price.x.offset, 90+price.y.offset,DarkGray ,FX_T,17+F_Offset,90);
   setObject(next(),SpacerText1,400+price.x.offset, 90+price.y.offset,DarkGray ,FX_T,17+F_Offset,90);
   setObject(next(),SpacerText1,445+price.x.offset, 90+price.y.offset,DarkGray ,FX_T,17+F_Offset,90);
   setObject(next(),SpacerText1,520+price.x.offset, 90+price.y.offset,DarkGray ,FX_T,17+F_Offset,90);
   setObject(next(),SpacerText1,600+price.x.offset, 90+price.y.offset,DarkGray ,FX_T,17+F_Offset,90);
   setObject(next(),SpacerText1,800+price.x.offset, 90+price.y.offset,DarkGray ,FX_T,17+F_Offset,90);
 
 
  ////////////горизонталь лини 1_уровень
   setObject(next(),SpacerText2,0+price.x.offset,   -5+price.y.offset,  DarkGray ,FX_T,6+F_Offset);
   setObject(next(),SpacerText2,250+price.x.offset, -5+price.y.offset,DarkGray ,FX_T,6+F_Offset);
   setObject(next(),SpacerText2,450+price.x.offset, -5+price.y.offset,DarkGray ,FX_T,6+F_Offset);
   setObject(next(),SpacerText2,650+price.x.offset, -5+price.y.offset,DarkGray ,FX_T,6+F_Offset);
  
   
   ////////////горизонталь лини 2_уровень
   setObject(next(),SpacerText2,650+price.x.offset, 21+price.y.offset,DarkGray ,FX_T,6+F_Offset);
   setObject(next(),SpacerText2,380+price.x.offset, 21+price.y.offset,DarkGray ,FX_T,6+F_Offset);
   setObject(next(),SpacerText2,100+price.x.offset, 21+price.y.offset,DarkGray ,FX_T,6+F_Offset);
   setObject(next(),SpacerText1,0+price.x.offset, 21+price.y.offset,DarkGray ,FX_T,6+F_Offset);
 ////////////горизонталь лини 3_уровень
   setObject(next(),SpacerText2,0+price.x.offset,   45+price.y.offset,  DarkGray ,FX_T,6+F_Offset);
   setObject(next(),SpacerText2,250+price.x.offset, 45+price.y.offset,DarkGray ,FX_T,6+F_Offset);
   setObject(next(),SpacerText2,450+price.x.offset, 45+price.y.offset,DarkGray ,FX_T,6+F_Offset);
   setObject(next(),SpacerText2,650+price.x.offset, 45+price.y.offset,DarkGray ,FX_T,6+F_Offset);
   ////////////горизонталь лини 4_уровень
   setObject(next(),SpacerText2,650+price.x.offset, 82+price.y.offset,DarkGray ,FX_T,6+F_Offset);
   setObject(next(),SpacerText2,380+price.x.offset, 82+price.y.offset,DarkGray ,FX_T,6+F_Offset);
   setObject(next(),SpacerText2,100+price.x.offset, 82+price.y.offset,DarkGray ,FX_T,6+F_Offset);
   setObject(next(),SpacerText1,0+price.x.offset, 82+price.y.offset,DarkGray ,FX_T,6+F_Offset);
 
   ///почасовой график  
   if(show.CTrend){ 
   setObject(next(),"-",616+price.x.offset, 24+price.y.offset,ColorCX105 ,FX_T,30+F_Offset,90);
   setObject(next(),"-",639+price.x.offset, 24+price.y.offset,ColorCX106 ,FX_T,30+F_Offset,90);
   setObject(next(),"-",660+price.x.offset, 24+price.y.offset,ColorCX107 ,FX_T,30+F_Offset,90);
   setObject(next(),"-",683+price.x.offset, 24+price.y.offset,ColorCX108 ,FX_T,30+F_Offset,90);  
   setObject(next(),"-",708+price.x.offset, 24+price.y.offset,ColorCX109 ,FX_T,30+F_Offset,90);
   setObject(next(),"-",730+price.x.offset, 24+price.y.offset,ColorCX110 ,FX_T,30+F_Offset,90);
   setObject(next(),"-",758+price.x.offset, 24+price.y.offset,ColorCX111 ,FX_T,30+F_Offset,90);
   setObject(next(),"-",790+price.x.offset, 24+price.y.offset,ColorCX112 ,FX_T,30+F_Offset,90);
     
   setObject(next(),"5",630+price.x.offset, 13+price.y.offset,ColorHeading ,"Verdana",8+F_Offset);
   setObject(next(),"15",648+price.x.offset, 13+price.y.offset,ColorHeading ,"Verdana",8+F_Offset);
   setObject(next(),"30",670+price.x.offset, 13+price.y.offset,ColorHeading ,"Verdana",8+F_Offset);
   setObject(next(),"H1",692+price.x.offset, 13+price.y.offset,ColorHeading ,"Verdana",8+F_Offset);
   setObject(next(),"H4",715+price.x.offset, 13+price.y.offset,ColorHeading ,"Verdana",8+F_Offset);
   setObject(next(),"D1",739+price.x.offset, 13+price.y.offset, ColorHeading ,"Verdana",8+F_Offset);
   setObject(next(),"W1",760+price.x.offset, 13+price.y.offset, ColorHeading ,"Verdana",8+F_Offset);
   setObject(next(),"MN1",790+price.x.offset, 13+price.y.offset, ColorHeading ,"Verdana",8+F_Offset);
   setObject(next(),"Candle Color",657+price.x.offset, -10+price.y.offset,ColorHeading ,FX_T,9+F_Offset);}
      
 
  
      
   color LabelColor;     
   int SpX = 615, SpX2=7;
   for(i=Trend_Bars; i>=0; i--)
   {
   
   
   
      BTX1 =iMA(S, TimeFrame,MAP,0,1,1,i);
      BTX1_1 =iMA(S, TimeFrame,MAP,0,0,0,i);       
       
      LabelColor =Red;
      if(BTX1_1 > BTX1) LabelColor =Lime;
      SpX = SpX+ SpX2;
      if(show.Trend){
      setObject(next(),"-",SpX+price.x.offset, 25+price.y.offset,LabelColor ,FX_T,30,90);}
      
      
      
    
   }  

     if (ObjectFind("BarTimer") == -1) {// если объект не найден - создаем и задаем параметры
     ObjectCreate("BarTimer" , OBJ_LABEL,0,0,0);
     ObjectSet("BarTimer", OBJPROP_XDISTANCE, XDistance);
     ObjectSet("BarTimer", OBJPROP_YDISTANCE, YDistance);
     ObjectSet("BarTimer", OBJPROP_CORNER, Corner);
   }
   sec=TimeCurrent()-Time[0];// время в секундах от начала бара
   i=(lenbase-1)*sec/(Period()*60);// позиция ползунка
   pc=100.0*sec/(Period()*60);// время от начала бара в процентах
   if(i>lenbase-1) i=lenbase-1;// возможно излишний контроль границы
   if(i>0) s_beg=StringSubstr(s_base,0,i);
   if(i<lenbase-1) s_end=StringSubstr(s_base,i+1,lenbase-i-1);
   time=StringConcatenate(s_beg,"|",s_end,"  ",DoubleToStr(pc,0),"%");
      
   ObjectSetText("BarTimer", time, FontSize, FontName, FontColor);
  
 //  return(0);
  }








string next() { totalLabels++; return(totalLabels); }  
 
string MakeUniqueName(string first, string rest)
{
   string result = first+(MathRand()%1001)+rest;
 
   while (WindowFind(result)> 0)
          result = first+(MathRand()%1001)+rest;
   return(result);
}
 
void setObject(string name,string text,int x,int y,color theColor, string font = "Arial",int size=10,int angle=0)
{
   string labelName = StringConcatenate(labelNames,name);
 
      if (ObjectFind(labelName) == -1)
          {
             ObjectCreate(labelName,OBJ_LABEL,window,0,0);
             ObjectSet(labelName,OBJPROP_CORNER,corner);
             if (angle != 0)
                  ObjectSet(labelName,OBJPROP_ANGLE,angle);
          }               
       ObjectSet(labelName,OBJPROP_XDISTANCE,x);
       ObjectSet(labelName,OBJPROP_YDISTANCE,y);
       ObjectSetText(labelName,text,size,font,theColor);
 
     
    }
double FuturesLotMargin (string symbol)
{

   return(0);
  
  }