//+------------------------------------------------------------------+
//|                                                 Range_Trader.mq4 |
//|                                         Copyright © 2008,JP      |
//|                                      maurosandrade@yahoo.com.br  |
//| made for BELEKAS and Igroks Thread by Jupiter_Peak               |
//| modified for use with the Igrok Method                           |
//| modified in 2009 by Labais53, credits to Jupiter_Peak and FerruFx|
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Labais53"
#property link      "neverman30@navigator.lv"

#property indicator_chart_window
//---- input parameters
extern double    Risk_to_Reward_ratio= 5.0;
extern int       Stop_Loss= 1;
extern string    Change_Averages  = "=== Number of days/weeks/months for averages ===";
extern int       DailyAverage = 40;
extern int       WeeklyAverage = 26;
extern int       MonthlyAverage = 24;
int nDigits;
extern string    Change_MMText3  = "=== Skip Comment info? ===";
extern bool      SkipComment = false;
extern string    Change_MMText1  = "=== Skip MM in Comment? ===";
extern bool      SkipMainMoveText = true;
extern string    Change_MMText2  = "=== Skip SL/TP in Comment? ===";
extern bool      SkipTradeText = true;

// Timezone adjustment for Main Moves
extern string    Change_TimeShift  = "=== Hourly +/- shift of start of day/week/month/year for MM ===";
extern int       TimeShift = 0;

// label indicator part
extern string    Which_Corner_for_all  = "=== Select corner. 0=Upper Left, 1=Upper Right, 2=lower left , 3=lower right ===";
extern int       Global_Corner         =     1;

extern string    Main_move_box             = "=== Display Main Move Box? ===";
extern bool      box_main_move         =    true;
extern int       X_MM                  =     30;
extern int       Y_MM                  =     20;
extern bool      PopUp_Alert           =     true;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   if(Symbol()=="GBPJPY" || Symbol()=="EURJPY" || Symbol()=="USDJPY" || Symbol()=="GOLD")  nDigits = 3;
   else nDigits = 5;

   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   Comment( "" );
   
   if (box_main_move == true)
   {
   ObjectDelete("Main_Moves");
   ObjectDelete("line1");
   ObjectDelete("Year_text");
   ObjectDelete("Month_text");
   ObjectDelete("Week_text");
   ObjectDelete("Day_text");
   ObjectDelete("YDay_text");
   ObjectDelete("Year_Move");
   ObjectDelete("Month_Move");
   ObjectDelete("Week_Move");
   ObjectDelete("Day_Move");
   ObjectDelete("YDay_Move");
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   static bool Prev_mainMMoveUp = -1;
   static bool Prev_mainWMoveUp = -1;
   static bool Prev_mainEMoveUp = -1;
   static bool Prev_mainYMoveUp = -1;
   static bool Prev_mainMoveUp = -1;

   //----
   string PIPS="";
   int R1=0,MR25=0,WR25=0,R25=0,R40=0,RAvg=0;
   int Prevday=0,Prevwk=0,Prevmthy=0;
   int Curday=0,Curwk=0,Curmthy=0;
   double CurrentSpread=0;
   int EntryLong=0,EntryShort=0,StopLoss_Long=0,StopLoss_Short=0,today_range=0,RoomDown=0,TPLong=0,TPShort=0,TotalPips=0;
   double   SL_Long=0,SL_Short=0,ENT_Long=0,ENT_Short,TP_Long=0,TP_Short=0;
   double   low0=0,high0=0, low1=0,high1=0, lowWeek1=0,highWeek1=0, lowMonth1=0,highMonth1=0, highYear1=0,lowYear1=0;
   int LowYDaybar =0,HighYDaybar =0, LowDaybar =0,HighDaybar =0, LowWeekbar=0,HighWeekbar=0, LowMonthbar=0,HighMonthbar=0, HighYearbar=0, LowYearbar=0;
   string   Text="";

   int i=0;
   // get daily open
   double OPEN = iOpen(NULL,PERIOD_D1,0);
   // get current Close for today
   double CLOSE = iClose(NULL,PERIOD_D1,0);
   PIPS =  DoubleToStr((CLOSE-OPEN)/Point*0.1,0);
   
   // broker digits adjustment by Ankravs from www.treideri.lv
   double DecimalDigits = MarketInfo(Symbol(), MODE_DIGITS);
   double CurrencyKoefic = MarketInfo(Symbol(), MODE_POINT);
   if(DecimalDigits==3 || DecimalDigits==5)
   {
      CurrencyKoefic = CurrencyKoefic * 10;
   }
   
   // Calculate today's range   
   R1 =  (iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1))/CurrencyKoefic;
   
   // Calculate total ranges for 25 days 26 wks 25 months
   for(i=1;i<=DailyAverage;i++)
      R25   =    R25 +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/CurrencyKoefic;
   for(i=1;i<=WeeklyAverage;i++)
      WR25   =    WR25 +  (iHigh(NULL,PERIOD_W1,i)-iLow(NULL,PERIOD_W1,i))/CurrencyKoefic;
   for(i=1;i<=MonthlyAverage;i++)
      MR25   =    MR25 +  (iHigh(NULL,PERIOD_MN1,i)-iLow(NULL,PERIOD_MN1,i))/CurrencyKoefic;

   Prevday =  (iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1))/CurrencyKoefic;
   Prevwk =  (iHigh(NULL,PERIOD_W1,1)-iLow(NULL,PERIOD_W1,1))/CurrencyKoefic;
   Prevmthy =  (iHigh(NULL,PERIOD_MN1,1)-iLow(NULL,PERIOD_MN1,1))/CurrencyKoefic;

   Curday =  (iHigh(NULL,PERIOD_D1,0)-iLow(NULL,PERIOD_D1,0))/CurrencyKoefic;
   Curwk =  (iHigh(NULL,PERIOD_W1,0)-iLow(NULL,PERIOD_W1,0))/CurrencyKoefic;
   Curmthy = (iHigh(NULL,PERIOD_MN1,0)-iLow(NULL,PERIOD_MN1,0))/CurrencyKoefic;

   // Getting Main Move of the Day
   
   // number of M1 bars today
   int numbarsM1today = iBarShift( NULL, PERIOD_M1, iTime(NULL, PERIOD_D1, 0 ));
   // apply timeshift 
   if ( (numbarsM1today - (60*TimeShift)) > 1 ) 
   {
   numbarsM1today = numbarsM1today - (60*TimeShift);
   }
   else
   {
   numbarsM1today = numbarsM1today + iBarShift( NULL, PERIOD_M1, iTime(NULL, PERIOD_D1, 1 )) - (60*TimeShift);
   } 
   // number of lowest and highest bar today
   LowDaybar = iLowest (NULL,PERIOD_M1,MODE_LOW, numbarsM1today,0);
   HighDaybar = iHighest (NULL,PERIOD_M1,MODE_HIGH, numbarsM1today,0);
   bool mainMoveRange = true;
   bool mainMoveUp = false;
   bool NoM1HistoryDay = false;
   if ( LowDaybar == 0 || HighDaybar == 0) 
   { 
      if (iHigh (NULL, PERIOD_M1, 0) > iHigh (NULL, PERIOD_M1, 1) ) { mainMoveRange = false; mainMoveUp = true; }
      else { mainMoveRange = false; mainMoveUp = false; }
   }
   else
   if( LowDaybar < HighDaybar ) { mainMoveRange = false; mainMoveUp = false; }
   else
   if( LowDaybar > HighDaybar ) { mainMoveRange = false; mainMoveUp = true; }
   
   string dayMove = "Main move of today is ";
   if ( NoM1HistoryDay == true ) dayMove = dayMove + "No M1 History";
   else
   if( mainMoveRange == true ) dayMove = dayMove + "No M1 Bars"; 
   else
   if( mainMoveUp == true ) dayMove = dayMove + "UP"; else dayMove = dayMove + "DOWN";   
   if (PopUp_Alert){
      if (Prev_mainMoveUp != mainMoveUp){
         if (mainMoveUp == true)Alert("Day Move has changed to UP");
            else Alert("Day Move has changed to DOWN");
         Prev_mainMoveUp = mainMoveUp;
      }
   }
   // Getting Main Move of Yesterday
   // number of M1 bars Yesterday
   int numbarsM1yday = 24*60;
   // apply timeshift 
   // number of lowest and highest bar yesterday
   LowYDaybar = iLowest (NULL,PERIOD_M1,MODE_LOW, numbarsM1yday,numbarsM1today-(60*TimeShift));
   HighYDaybar = iHighest (NULL,PERIOD_M1,MODE_HIGH, numbarsM1yday,numbarsM1today-(60*TimeShift));
   bool mainEMoveRange = true;
   bool mainEMoveUp = false;
   bool NoM1EHistoryDay = false;
   
   if( LowYDaybar < HighYDaybar ) { mainEMoveRange = false; mainEMoveUp = false; }
   else
   if( LowYDaybar > HighYDaybar ) { mainEMoveRange = false; mainEMoveUp = true; }
   
   string ydayMove = "Main move of yesterday is ";
   if ( NoM1EHistoryDay == true ) ydayMove = ydayMove + "No M1 History";
   else
   if( mainEMoveRange == true ) ydayMove = ydayMove + "No M1 Bars"; 
   else
   if( mainEMoveUp == true ) ydayMove = ydayMove + "UP"; else ydayMove = ydayMove + "DOWN";   
   if (PopUp_Alert){
      if (Prev_mainEMoveUp != mainEMoveUp){
         if (mainEMoveUp == true)Alert("Y-Day Move has changed to UP");
            else Alert("Y-Day Move has changed to DOWN");
         Prev_mainEMoveUp = mainEMoveUp;
      }
   }
   // Getting Main Move of the Week
    
   // number of M1 bars this week
   int numbarsM1week = iBarShift (NULL, PERIOD_M1, iTime(NULL, PERIOD_W1, 0));
   // apply timeshift 
   if ( (numbarsM1week - (60*TimeShift)) > 1 ) 
   {
   numbarsM1week = numbarsM1week - (60*TimeShift);
   }
   else
   {
   numbarsM1week = numbarsM1week + iBarShift( NULL, PERIOD_M1, iTime(NULL, PERIOD_W1, 1 )) - (60*TimeShift);
   } 
   LowWeekbar = iLowest (NULL,PERIOD_M1,MODE_LOW, numbarsM1week,0);
   HighWeekbar = iHighest (NULL,PERIOD_M1,MODE_HIGH, numbarsM1week,0);
   bool mainWMoveRange = true;
   bool mainWMoveUp = false;
   bool NoM1HistoryWeek = false;
   if ( LowWeekbar == 0 || HighWeekbar == 0) 
      { 
      if (iHigh (NULL, PERIOD_M1, 0) > iHigh (NULL, PERIOD_M1, 1) ) { mainWMoveRange = false; mainWMoveUp = true; }
      else { mainWMoveRange = false; mainWMoveUp = false; }
      }
   else
   if( LowWeekbar < HighWeekbar ) { mainWMoveRange = false; mainWMoveUp = false; }
   else
   if( LowWeekbar > HighWeekbar ) { mainWMoveRange = false; mainWMoveUp = true; }
   
   string weekMove = "Main move of the week is ";
   if ( NoM1HistoryWeek == true ) weekMove = weekMove + "No M1 History";
   else
   if( mainWMoveRange == true ) weekMove = weekMove + "No M1 Bars"; 
   else
   if( mainWMoveUp == true ) weekMove = weekMove + "UP"; else weekMove = weekMove + "DOWN";   
   if (PopUp_Alert){
      if (Prev_mainWMoveUp != mainWMoveUp){
         if (mainWMoveUp == true)Alert("Week Move has changed to UP");
            else Alert("Week Move has changed to DOWN");
         Prev_mainWMoveUp = mainWMoveUp;
      }
   }
   // Getting Main Move of the Month

   // number of H1 bars this month
   int numbarsH1month = iBarShift (NULL, PERIOD_H1, iTime(NULL, PERIOD_MN1, 0));
   // apply timeshift 
   if ( (numbarsH1month - TimeShift) > 1 ) 
   {
   numbarsH1month = numbarsH1month - TimeShift;
   }
   else
   {
   numbarsH1month = numbarsH1month + iBarShift( NULL, PERIOD_H1, iTime(NULL, PERIOD_MN1, 1 )) - TimeShift;
   } 
   LowMonthbar = iLowest (NULL,PERIOD_H1,MODE_LOW, numbarsH1month,0);
   HighMonthbar = iHighest (NULL,PERIOD_H1,MODE_HIGH, numbarsH1month,0);
   bool mainMMoveRange = true;
   bool mainMMoveUp = false;
   bool NoH1HistoryMonth = false;
   if ( LowMonthbar == 0 || HighMonthbar == 0) 
      { 
      if (iHigh (NULL, PERIOD_H1, 0) > iHigh (NULL, PERIOD_H1, 1) ) { mainMMoveRange = false; mainMMoveUp = true; }
      else { mainMMoveRange = false; mainMMoveUp = false; }
      }
   else
   if( LowMonthbar < HighMonthbar ) { mainMMoveRange = false; mainMMoveUp = false; }
   else
   if( LowMonthbar > HighMonthbar ) { mainMMoveRange = false; mainMMoveUp = true; }
   
   string monthMove = "Main move of the month is ";
   if ( NoH1HistoryMonth == true ) monthMove = monthMove + "No H1 History";
   else
   if( mainMMoveRange == true ) monthMove = monthMove + "No H1 Bars"; 
   else
   if( mainMMoveUp == true ) monthMove = monthMove + "UP"; else monthMove = monthMove + "DOWN"; 
   if (PopUp_Alert){
      if (Prev_mainMMoveUp != mainMMoveUp){
         if (mainMMoveUp == true)Alert("Month Move has changed to UP");
            else Alert("Month Move has changed to DOWN");
         Prev_mainMMoveUp = mainMMoveUp;
      }
   }
   // Getting Main Move of the Year
   
   //get date of the first day's bar of the year
   datetime FirstDayTime;
   for ( int r=1;r<= Month();r++ )
   FirstDayTime = iTime(NULL,PERIOD_MN1,r-1) ;
   // number of H1 bars this year
   int numbarsH1year = iBarShift (NULL, PERIOD_H1, FirstDayTime, 0);
   // apply timeshift 
   if ( (numbarsH1year + TimeShift) > 1 ) 
   {
   numbarsH1year = numbarsH1year - TimeShift;
   }
   else
   {
   numbarsH1year = numbarsH1year + iBarShift( NULL, PERIOD_H1, iTime(NULL, PERIOD_MN1, 12 )) - TimeShift;
   } 
   LowYearbar = iLowest (NULL,PERIOD_H1,MODE_LOW, numbarsH1year,0);
   HighYearbar = iHighest (NULL,PERIOD_H1,MODE_HIGH, numbarsH1year,0);
   bool mainYMoveRange = true;
   bool mainYMoveUp = false;
   bool NoH1HistoryYear = false;
   if ( LowYearbar == 0 || HighYearbar == 0) 
      {
      if (iHigh (NULL, PERIOD_H1, 0) > iHigh (NULL, PERIOD_H1, 1) ) { mainYMoveRange = false; mainYMoveUp = true; }
      else { mainYMoveRange = false; mainYMoveUp = false; }
      }
   else
   if( LowYearbar < HighYearbar ) { mainYMoveRange = false; mainYMoveUp = false; }
   else
   if( LowYearbar > HighYearbar ) { mainYMoveRange = false; mainYMoveUp = true; }
   
   string yearMove = "Main move of the year is ";
   if ( NoH1HistoryYear == true ) yearMove = yearMove + "No H1 History";
   else
   if( mainYMoveRange == true ) yearMove = yearMove + "No H1 Bars"; 
   else
   if( mainYMoveUp == true ) yearMove = yearMove + "UP"; else yearMove = yearMove + "DOWN"; 
   if (PopUp_Alert){
      if (Prev_mainYMoveUp != mainYMoveUp){
         if (mainYMoveUp == true)Alert("Year Move has changed to UP");
            else Alert("Year Move has changed to DOWN");
         Prev_mainYMoveUp = mainYMoveUp;
      }
   }
   // Calculate average ranges   
   R25 = R25/DailyAverage;
   WR25 = WR25/WeeklyAverage;
   MR25 = MR25/MonthlyAverage;
   
   //Calculate % completion of ranges
   double DailyX = R25*1;
   int DailyPercent = ((Curday/DailyX)*100);
   double WeeklyX = WR25*1;
   int WeeklyPercent = ((Curwk/WeeklyX)*100);
   double MonthlyX = MR25*1;
   int MonthlyPercent = ((Curmthy/MonthlyX)*100);
   
   // Calculate long and short trades
   // Get todays high and low
   low0  =  iLow(NULL,PERIOD_D1,0);
   high0 =  iHigh(NULL,PERIOD_D1,0);
   // calculate risk/reward units in terms of average daily range
   TotalPips = R25/Risk_to_Reward_ratio;
   // long entry at days low + one risk/reward unit - Stop loss
   EntryLong = TotalPips*10 - Stop_Loss*10;
   ENT_Long = low0 + EntryLong*Point;
   SL_Long    =  low0 - Stop_Loss*Point*10;
   //TP at entry + average range
   TPLong =  EntryLong + R25*10; 
   TP_Long = ENT_Long + TPLong*Point;
   // short entry at days high - one risk/reward unit - Stop loss
   EntryShort =  TotalPips*10 - Stop_Loss*10;
   ENT_Short  =  high0 - EntryShort*Point;
   SL_Short   =  high0 + Stop_Loss*Point*10;
   TPShort = R25*10 + high0 - EntryShort;
   TP_Short = ENT_Short - TPShort*Point;
   
   CurrentSpread = (Ask/CurrencyKoefic)-(Bid/CurrencyKoefic);

   today_range = (iHigh(NULL,PERIOD_D1,0)) - (iLow(NULL,PERIOD_D1,0));
   
   if (SkipMainMoveText == true)
   {
   dayMove="";
   ydayMove="";
   weekMove="";
   monthMove="";
   yearMove="";
   }
   
   /* Text =   "Avg " + DailyAverage + " Days Range: " +  R25  + "\n" +
            "Prev Day Range: " +  Prevday  + "\n" +
            "Current Day Range: " +  Curday  + " - " + DailyPercent +"% of ADR" + "\n\n" +
            "Avg " + WeeklyAverage + " Weeks Range: " +  WR25  + "\n" +
            "Prev Week Range: " +  Prevwk  + "\n" +
            "Current Week Range: " +  Curwk  + " - " + WeeklyPercent + "% of AWR" + "\n\n" +
            "Avg " + MonthlyAverage + " Months Range: " +  MR25  + "\n" +
            "Prev Month Range: " +  Prevmthy  + "\n" +
            "Current Month Range: " +  Curmthy  + " - " + MonthlyPercent + "% of AMR" + "\n\n" +
            "Currency Pair spread: " +  DoubleToStr(CurrentSpread,1)  + "\n\n" +
            dayMove + "\n" + ydayMove + "\n" +
            weekMove + "\n" + monthMove + "\n" + yearMove + "\n\n";
            
   if (SkipTradeText == false)Text =   Text +
            "Long Entry: " + DoubleToStr(EntryLong*0.1,0) + " Pips at " + DoubleToStr(ENT_Long,nDigits)  + "\n" +        
            "Short Entry: " + DoubleToStr(EntryShort*0.1,0) + " Pips at " + DoubleToStr(ENT_Short,nDigits)  + "\n\n" +
            "StopLosses should be :"  + "\n" +
            "Long:  " + Stop_Loss  + " Pips at " + DoubleToStr(SL_Long,nDigits)  + "\n" +
            "Short: " + Stop_Loss + " Pips at " + DoubleToStr(SL_Short,nDigits) + "\n\n" +
            "Take Profits should be :"  + "\n" +
            "Long:  " + DoubleToStr(TPLong*0.1,0) + " Pips at " + DoubleToStr(TP_Long,nDigits)  + "\n" +
            "Short: " + DoubleToStr(TPShort*0.1,0) + " Pips at " + DoubleToStr(TP_Short,nDigits) + "\n\n" +
            "** Always Consider Spread on Pair Before Entering **" + "\n\n"; 
     */   
            
   if (SkipComment == false)
   Comment(Text);
 
   if (box_main_move == true)
   {
   
   ObjectCreate("Main_Moves", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("Main_Moves","MAIN MOVES",8, "Arial", Blue);
   ObjectSet("Main_Moves", OBJPROP_CORNER, Global_Corner);
   ObjectSet("Main_Moves", OBJPROP_XDISTANCE, 915+X_MM-900);
   ObjectSet("Main_Moves", OBJPROP_YDISTANCE, 1+Y_MM);
   
   ObjectCreate("line1", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("line1","----------------",8, "Verdana", Blue);
   ObjectSet("line1", OBJPROP_CORNER, Global_Corner);
   ObjectSet("line1", OBJPROP_XDISTANCE, 907+X_MM-900);
   ObjectSet("line1", OBJPROP_YDISTANCE, 12+Y_MM);
   
   ObjectCreate("Year_text", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("Year_text","YEAR",8, "Arial", Blue);
   ObjectSet("Year_text", OBJPROP_CORNER, Global_Corner);
   ObjectSet("Year_text", OBJPROP_XDISTANCE, 955+X_MM-900);
   ObjectSet("Year_text", OBJPROP_YDISTANCE, 26+Y_MM);
   
   ObjectCreate("Month_text", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("Month_text","MONTH",8, "Arial", Blue);
   ObjectSet("Month_text", OBJPROP_CORNER, Global_Corner);
   ObjectSet("Month_text", OBJPROP_XDISTANCE, 955+X_MM-900);
   ObjectSet("Month_text", OBJPROP_YDISTANCE, 46+Y_MM);
   
   ObjectCreate("Week_text", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("Week_text","WEEK",8, "Arial", Blue);
   ObjectSet("Week_text", OBJPROP_CORNER, Global_Corner);
   ObjectSet("Week_text", OBJPROP_XDISTANCE, 955+X_MM-900);
   ObjectSet("Week_text", OBJPROP_YDISTANCE, 66+Y_MM);
   
   ObjectCreate("Day_text", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("Day_text","TODAY",8, "Arial", Blue);
   ObjectSet("Day_text", OBJPROP_CORNER, Global_Corner);
   ObjectSet("Day_text", OBJPROP_XDISTANCE, 955+X_MM-900);
   ObjectSet("Day_text", OBJPROP_YDISTANCE, 106+Y_MM);
   
   ObjectCreate("YDay_text", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("YDay_text","Y-DAY",8, "Arial", Blue);
   ObjectSet("YDay_text", OBJPROP_CORNER, Global_Corner);
   ObjectSet("YDay_text", OBJPROP_XDISTANCE, 955+X_MM-900);
   ObjectSet("YDay_text", OBJPROP_YDISTANCE, 86+Y_MM);
   
   ObjectCreate("Year_Move", OBJ_LABEL, 0, 0, 0);

   if ( NoH1HistoryYear == true ) ObjectSetText("Year_Move","NOH1",8, "Arial", PeachPuff);
   else
   if( mainYMoveRange == true ) ObjectSetText("Year_Move","WAIT",8, "Arial", PeachPuff); 
   else
   if( mainYMoveUp == true ) ObjectSetText("Year_Move","UP",8, "Arial", Green); 
   else ObjectSetText("Year_Move","DOWN",8, "Arial", Red);
   
   ObjectSet("Year_Move", OBJPROP_CORNER, Global_Corner);
   ObjectSet("Year_Move", OBJPROP_XDISTANCE, 909+X_MM-900);
   ObjectSet("Year_Move", OBJPROP_YDISTANCE, 26+Y_MM);
   
   ObjectCreate("Month_Move", OBJ_LABEL, 0, 0, 0);

   
   
   if ( NoH1HistoryMonth == true ) ObjectSetText("Month_Move","NOH1",8, "Arial", PeachPuff);
   else
   if( mainMMoveRange == true ) ObjectSetText("Month_Move","WAIT",8, "Arial", PeachPuff); 
   else
   if( mainMMoveUp == true ) ObjectSetText("Month_Move","UP",8, "Arial", Green); 
   else ObjectSetText("Month_Move","DOWN",8, "Arial", Red); 
   
   ObjectSet("Month_Move", OBJPROP_CORNER, Global_Corner);
   ObjectSet("Month_Move", OBJPROP_XDISTANCE, 909+X_MM-900);
   ObjectSet("Month_Move", OBJPROP_YDISTANCE, 46+Y_MM);
   
   ObjectCreate("Week_Move", OBJ_LABEL, 0, 0, 0);
   
   
   if ( NoM1HistoryWeek == true ) ObjectSetText("Week_Move","NOM1",8, "Arial", PeachPuff);
   else
   if( mainWMoveRange == true ) ObjectSetText("Week_Move","WAIT",8, "Arial", PeachPuff); 
   else
   if( mainWMoveUp == true ) ObjectSetText("Week_Move","UP",8, "Arial", Green); 
   else ObjectSetText("Week_Move","DOWN",8, "Arial", Red); 
   
   ObjectSet("Week_Move", OBJPROP_CORNER, Global_Corner);
   ObjectSet("Week_Move", OBJPROP_XDISTANCE, 909+X_MM-900);
   ObjectSet("Week_Move", OBJPROP_YDISTANCE, 66+Y_MM);
   
   ObjectCreate("Day_Move", OBJ_LABEL, 0, 0, 0);
   
   
   if ( NoM1HistoryDay == true ) ObjectSetText("Day_Move","NOM1",8, "Arial", PeachPuff);
   else
   if( mainMoveRange == true ) ObjectSetText("Day_Move","WAIT",8, "Arial", PeachPuff); 
   else
   if( mainMoveUp == true ) ObjectSetText("Day_Move","UP",8, "Arial", Green); 
   else ObjectSetText("Day_Move","DOWN",8, "Arial", Red);  
   
   ObjectSet("Day_Move", OBJPROP_CORNER, Global_Corner);
   ObjectSet("Day_Move", OBJPROP_XDISTANCE, 909+X_MM-900);
   ObjectSet("Day_Move", OBJPROP_YDISTANCE, 106+Y_MM);
   
   ObjectCreate("YDay_Move", OBJ_LABEL, 0, 0, 0);

   
   if ( NoM1EHistoryDay == true ) ObjectSetText("YDay_Move","NOM1",8, "Arial", PeachPuff);
   else
   if( mainEMoveRange == true ) ObjectSetText("YDay_Move","WAIT",8, "Arial", PeachPuff); 
   else
   if( mainEMoveUp == true ) ObjectSetText("YDay_Move","UP",8, "Arial", Green); 
   else ObjectSetText("YDay_Move","DOWN",8, "Arial", Red);  
   
   ObjectSet("YDay_Move", OBJPROP_CORNER, Global_Corner);
   ObjectSet("YDay_Move", OBJPROP_XDISTANCE, 909+X_MM-900);
   ObjectSet("YDay_Move", OBJPROP_YDISTANCE, 86+Y_MM);
   
   }
   
   return(0);
  }
//+------------------------------------------------------------------+