//+------------------------------------------------------------------+
//|   _TRO_OHLC                           Ind-WSO+WRO+Trend Line.mq4 |
//|                    Copyright © 2004, http://www.expert-mt4.nm.ru |
//|                                      http://www.expert-mt4.nm.ru |
//| Индикатор был разработан на основе индикатора Widners Oscilator. |
//| Мною была разработана торговая стратегия, основанная на          |
//| показаниях Ind-WSO+WRO+Trend Line индикатора. Подробности        |
//| вы можете узнать в форуме на моем сайте                          |
//| http://www.expert-mt4.nm.ru/forum.dhtml                          |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, http://www.expert-mt4.nm.ru"
#property link      "http://www.expert-mt4.nm.ru"

#property indicator_chart_window
//---- input parameters

extern int nPeriod=1;


///---- int Widners Oscilator
int cnt,nCurBar=0;

int ChartPeriod ;

bool sH0, sH1, sL0, sL1 ;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
  
  ChartPeriod = Period();



      ObjectCreate("WSO-Mid",OBJ_HLINE,0,0,0);
      ObjectSet("WSO-Mid",OBJPROP_COLOR,Aqua); 
      ObjectSet("WSO-Mid",OBJPROP_STYLE,STYLE_DASH); 
              
      ObjectCreate("WSO-pMid",OBJ_HLINE,0,0,0);
      ObjectSet("WSO-pMid",OBJPROP_COLOR,Magenta);  
      ObjectSet("WSO-pMid",OBJPROP_STYLE,STYLE_DASH); 


      ObjectCreate("WSO-Close",OBJ_HLINE,0,0,0);
      ObjectSet("WSO-Close",OBJPROP_COLOR,Yellow); 
      ObjectSet("WSO-Close",OBJPROP_STYLE,STYLE_DASH); 
              
      ObjectCreate("WSO-Open",OBJ_HLINE,0,0,0);
      ObjectSet("WSO-Open",OBJPROP_COLOR,White);  
      ObjectSet("WSO-Open",OBJPROP_STYLE,STYLE_DASH); 
      
      ObjectCreate("WSO-0",OBJ_HLINE,0,0,0);
      ObjectSet("WSO-0",OBJPROP_COLOR,Red);
      ObjectSet("WSO-0",OBJPROP_STYLE,STYLE_DASH);       
      

      ObjectCreate("WRO-0",OBJ_HLINE,0,0,0);
      ObjectSet("WRO-0",OBJPROP_COLOR,Green);
      ObjectSet("WRO-0",OBJPROP_STYLE,STYLE_DASH); 

    ObjectCreate("Trend DN-0",OBJ_TREND,0,0,0,0,0);    
    ObjectSet("Trend DN-0",OBJPROP_COLOR,Aqua);
    
    ObjectCreate("Trend UP-0",OBJ_TREND,0,0,0,0,0);
    ObjectSet("Trend UP-0",OBJPROP_COLOR,Magenta);
    
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
      ObjectDelete("WSO-Mid");
      ObjectDelete("WSO-pMid");  
      ObjectDelete("WSO-Close");
      ObjectDelete("WSO-Open");
      ObjectDelete("WRO-0");
      ObjectDelete("WSO-0");
      ObjectDelete("Trend UP-0");
      ObjectDelete("Trend DN-0");
      
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  

//---- TODO: add your code here
   double OP,CL;
 
   double L1,H1, MD, PM ;
 

 H1 = iHigh(NULL,PERIOD_D1, 1) ;
 L1 = iLow(NULL,PERIOD_D1, 1) ;
 OP = iOpen(NULL,PERIOD_D1, 1) ;
 CL = iClose(NULL,PERIOD_D1, 1) ; 
 
 MD = (iHigh(NULL,PERIOD_D1,0) + iLow(NULL,PERIOD_D1, 0) ) * 0.50 ;
 PM = (H1 + L1) * 0.50 ; 
 
      
//---- Move Object in Chart 


ObjectMove("WSO-0",0,Time[47],L1);
ObjectMove("WRO-0",0,Time[47],H1);

ObjectMove("WSO-Open",0,Time[47],OP);
ObjectMove("WSO-Close",0,Time[47],CL);

ObjectMove("WSO-Mid",0,Time[47],MD);
ObjectMove("WSO-pMid",0,Time[47],PM);
   
         
Comment( "Mid=" , MD, " pMid=", PM ) ;         
         
return(0);
}

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