#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window

extern int DailyRangePeriod=13;
extern int WeeklyRangePeriod=13;
extern int OpenTime=7;

int init()
  {
   return(0);
  }
int deinit()
  {
   Comment("");
  }
int start()
  {
   int i = 0; double RAvg = 0, WAvg = 0, todaysHigh, todaysLow, todaysRange, decimals;
   if(Point == 0.0001) decimals = 4;
   if(Point == 0.001) decimals = 3;
   if(Point == 0.01) decimals = 2;
   if(Point == 0.1) decimals = 1;
   if(Point == 1) decimals = 0;
   for(i=1;i<=DailyRangePeriod;i++){
      RAvg = RAvg + (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point;
   }
   for(i=1;i<=WeeklyRangePeriod;i++){
      WAvg    =    WAvg  +  (iHigh(NULL,PERIOD_W1,i)-iLow(NULL,PERIOD_W1,i))/Point;
   }
   RAvg = RAvg/DailyRangePeriod;
   WAvg = WAvg/WeeklyRangePeriod;
   todaysHigh = iHigh(NULL,PERIOD_D1,0);
   todaysLow = iLow(NULL,PERIOD_D1,0);
   todaysRange = (todaysHigh - todaysLow)/Point;
   string sComment   = "";
   string sp         = "-----------------------------------------------------\n";
   string NL         = "\n";
   sComment = sComment + sp;
   sComment = sComment + "Tick Value = " + DoubleToStr(MarketInfo(Symbol(), MODE_TICKVALUE)*0.1, 2) + "$/MiniLot";
   sComment = sComment + " || Spread = " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD), 0) + "pips = " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD)*0.1*MarketInfo(Symbol(), MODE_TICKVALUE),2) + "$/MiniLot";
   sComment = sComment + " || SwapLong = " + DoubleToStr(MarketInfo(Symbol(), MODE_SWAPLONG),2);   
   sComment = sComment + " || SwapShort = " + DoubleToStr(MarketInfo(Symbol(), MODE_SWAPSHORT),2);
   sComment = sComment + " || ADR (" + DoubleToStr(DailyRangePeriod,0) + " days) = " + DoubleToStr(RAvg,0);
   sComment = sComment + " || AWR (" + DoubleToStr(WeeklyRangePeriod,0) + " weeks) = " + DoubleToStr(WAvg,0);
   sComment = sComment + NL + sp;
   sComment = sComment + "Todays High = " + DoubleToStr(todaysHigh,decimals);
   sComment = sComment + " || Todays Low = " + DoubleToStr(todaysLow,decimals);
   sComment = sComment + " || Left To Move = " + DoubleToStr(RAvg-todaysRange,0) + "pips || Todays move is = " + DoubleToStr((todaysRange/RAvg)*100,0) + "% of ADR";  
   sComment = sComment + NL + sp;
   int h = TimeHour(TimeCurrent()), d = TimeDayOfWeek(TimeCurrent());
   double DayChange, WeekChange;
   DayChange = 100*(MarketInfo(Symbol(), MODE_BID)/iOpen(Symbol(),PERIOD_H1,h-OpenTime)-1);
   WeekChange = 100*(MarketInfo(Symbol(), MODE_BID)/iOpen(Symbol(),PERIOD_H1,24*(d-1)+h-OpenTime)-1);
   sComment = sComment + "DayChange = " + DoubleToStr(DayChange,2) + 
            "% || WeekChange = " + DoubleToStr(WeekChange,2) +
    	      "% || MonthChange = " + DoubleToStr(100*(MarketInfo(Symbol(), MODE_BID)/iOpen(NULL,PERIOD_MN1,0)-1),2) + "%";
   Comment(sComment);
   return(0);
  }
//+------------------------------------------------------------------+