//+------------------------------------------------------------------+
//|                                The Force data numbers ver 02.mq4 |
//|              Copyright © 2008, Royston Global Import Export Inc. |
//|                                           http://www.royston.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Royston Global Import Export Inc."
#property link      "http://www.royston.net"

#property indicator_chart_window

extern int X_distance = 60;

extern bool ShowValues=true;

extern int corner_label = 3;
extern int label_dist_Y = 5;
extern color time_colour=Blue;
extern int font_size = 10;
extern int arrow_size = 12;

double value_open_ma_M5, value_close_ma_M5;
double value_open1_ma_M5, value_close1_ma_M5;
double value_open2_ma_M5, value_close2_ma_M5;

double golf;
double open_ma = 5;
double close_ma = 5;
double apply_to_open = PRICE_OPEN;
double apply_to_close = PRICE_CLOSE;
double ShowComment=false;


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

      
      ObjectDelete("bar0_time");
      ObjectDelete("bar1_time");
      
      ObjectDelete("EMA_bar0_close");
      ObjectDelete("EMA_bar0_open");
      ObjectDelete("EMA_bar1_close");
      ObjectDelete("EMA_bar1_open");

      ObjectDelete("MACD_bar0");
      ObjectDelete("MACD_bar1");
            
      ObjectDelete("Stoch_bar0_K");
      ObjectDelete("Stoch_bar0_D");
      ObjectDelete("Stoch_bar1_K");
      ObjectDelete("Stoch_bar1_D");
      
      
      ObjectDelete("long0");
      ObjectDelete("short0");
      ObjectDelete("long1");
      ObjectDelete("short1");      
                    
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int  start()
{

 double     val_Stoch_M5_buffer0=iCustom(NULL,PERIOD_M5, "Stochastic",5,3,3,0,0);
 double     val_Stoch_M5_buffer1=iCustom(NULL,PERIOD_M5, "Stochastic",5,3,3,1,0);
 double     val_bar1_Stoch_M5_buffer0=iCustom(NULL,PERIOD_M5, "Stochastic",5,3,3,0,1);
 double     val_bar1_Stoch_M5_buffer1=iCustom(NULL,PERIOD_M5, "Stochastic",5,3,3,1,1);
 double     val_bar2_Stoch_M5_buffer0=iCustom(NULL,PERIOD_M5, "Stochastic",5,3,3,0,2);
 double     val_bar2_Stoch_M5_buffer1=iCustom(NULL,PERIOD_M5, "Stochastic",5,3,3,1,2);
 
 double     val_bar0_MACD_M5_buffer=iCustom(NULL,PERIOD_M5, "MACD",12,26,1,0,0);
 double     val_bar1_MACD_M5_buffer=iCustom(NULL,PERIOD_M5, "MACD",12,26,1,0,1);
 double     val_bar2_MACD_M5_buffer=iCustom(NULL,PERIOD_M5, "MACD",12,26,1,0,2);
 double     val_bar3_MACD_M5_buffer=iCustom(NULL,PERIOD_M5, "MACD",12,26,1,0,3);

 double     range = iATR(0,PERIOD_D1,1,0)/Point;
 
 string     bar0_time=TimeToStr(iTime(NULL,PERIOD_M5,0),TIME_MINUTES);
 string     bar1_time=TimeToStr(iTime(NULL,PERIOD_M5,1),TIME_MINUTES);


  
            value_open_ma_M5 = iMA(Symbol(),PERIOD_M5,open_ma,0,MODE_EMA,apply_to_open,0);
            value_close_ma_M5 = iMA(Symbol(),PERIOD_M5,close_ma,0,MODE_EMA,apply_to_close,0);         
            value_open1_ma_M5 = iMA(Symbol(),PERIOD_M5,open_ma,0,MODE_EMA,apply_to_open,1);
            value_close1_ma_M5 = iMA(Symbol(),PERIOD_M5,close_ma,0,MODE_EMA,apply_to_close,1);
          
                 
{            
if    (value_open_ma_M5>20)
      golf = 2;
else
      golf = 4;
} 
            
            string Text = "";
                   Text =   
                    " " + DoubleToStr(range,0)
            +"        " + DoubleToStr(value_close_ma_M5,golf) + "   " + DoubleToStr(value_open_ma_M5,golf) + "   "  
            +"        " + DoubleToStr(val_bar0_MACD_M5_buffer,5)  + "   " + DoubleToStr(val_bar1_MACD_M5_buffer,5)
            +"        " + DoubleToStr(val_Stoch_M5_buffer0,0)  +"   "  + DoubleToStr(val_Stoch_M5_buffer1,0)
            +"        " + DoubleToStr(value_close1_ma_M5,golf) + "   " + DoubleToStr(value_open1_ma_M5,golf)
            +"        " + DoubleToStr(value_close2_ma_M5,golf) + "   " + DoubleToStr(value_open2_ma_M5,golf)
            +"        " + bar0_time
             +"        " + bar1_time
            ;  
 

            
     if(ShowComment==true)
           Comment(Text);
 
     if 
      (ShowValues==true)
{

//=============labels for indicator numerical values============================

//=============label for bar times==============================================

      ObjectCreate("bar0_time",OBJ_LABEL,0,0,0,0,0);
      ObjectSetText("bar0_time"," " + bar0_time + " ",font_size,"Tahoma",0);
      ObjectSet("bar0_time",OBJPROP_CORNER,corner_label);
      ObjectSet("bar0_time",OBJPROP_XDISTANCE,X_distance-50);
      ObjectSet("bar0_time",OBJPROP_YDISTANCE,label_dist_Y+20);
      ObjectSet("bar0_time",OBJPROP_COLOR,time_colour);

      ObjectCreate("bar1_time",OBJ_LABEL,0,0,0,0,0);
      ObjectSetText("bar1_time"," " + bar1_time + " ",font_size,"Tahoma",0);
      ObjectSet("bar1_time",OBJPROP_CORNER,corner_label);
      ObjectSet("bar1_time",OBJPROP_XDISTANCE,X_distance-50);
      ObjectSet("bar1_time",OBJPROP_YDISTANCE,label_dist_Y);
      ObjectSet("bar1_time",OBJPROP_COLOR,time_colour);

//=============labels for indicator numerical values============================

//      ObjectCreate("EMA_bar0_close",OBJ_LABEL,0,0,0,0,0);
//      ObjectSetText("EMA_bar0_close"," " + DoubleToStr(value_close_ma_M5,golf) + " ",font_size,"Tahoma",0);
//      ObjectSet("EMA_bar0_close",OBJPROP_CORNER,corner_label);
//      ObjectSet("EMA_bar0_close",OBJPROP_XDISTANCE,X_distance+55);
//      ObjectSet("EMA_bar0_close",OBJPROP_YDISTANCE,label_dist_Y+20);
//{
//      if
//      (value_open_ma_M5 < value_close_ma_M5)
//      ObjectSet("EMA_bar0_close",OBJPROP_COLOR,Green);
//      else
//      ObjectSet("EMA_bar0_close",OBJPROP_COLOR,Red);
//}      
      


//      ObjectCreate("EMA_bar0_open",OBJ_LABEL,0,0,0,0,0);
//      ObjectSetText("EMA_bar0_open"," " + DoubleToStr(value_open_ma_M5,golf) + " ",font_size,"Tahoma",0);
//      ObjectSet("EMA_bar0_open",OBJPROP_CORNER,corner_label);
//      ObjectSet("EMA_bar0_open",OBJPROP_XDISTANCE,X_distance);
//      ObjectSet("EMA_bar0_open",OBJPROP_YDISTANCE,label_dist_Y+20);
//{
//      if
//      (value_open_ma_M5 < value_close_ma_M5)
//      ObjectSet("EMA_bar0_open",OBJPROP_COLOR,Green);
//      else
//      ObjectSet("EMA_bar0_open",OBJPROP_COLOR,Red);
//}          
    
//====================================

      ObjectCreate("EMA_bar1_close",OBJ_LABEL,0,0,0,0,0);
      ObjectSetText("EMA_bar1_close"," " + DoubleToStr(value_close1_ma_M5,golf) + " ",font_size,"Tahoma",0);
      ObjectSet("EMA_bar1_close",OBJPROP_CORNER,corner_label);
      ObjectSet("EMA_bar1_close",OBJPROP_XDISTANCE,X_distance+85);
      ObjectSet("EMA_bar1_close",OBJPROP_YDISTANCE,label_dist_Y);
{
      if
      (value_open1_ma_M5 < value_close1_ma_M5)
      ObjectSet("EMA_bar1_close",OBJPROP_COLOR,Green);
      else
      ObjectSet("EMA_bar1_close",OBJPROP_COLOR,Red);
}      
      


      ObjectCreate("EMA_bar1_open",OBJ_LABEL,0,0,0,0,0);
      ObjectSetText("EMA_bar1_open"," " + DoubleToStr(value_open1_ma_M5,golf) + " ",font_size,"Tahoma",0);
      ObjectSet("EMA_bar1_open",OBJPROP_CORNER,corner_label);
      ObjectSet("EMA_bar1_open",OBJPROP_XDISTANCE,X_distance+30);
      ObjectSet("EMA_bar1_open",OBJPROP_YDISTANCE,label_dist_Y);
{
      if
      (value_open1_ma_M5 < value_close1_ma_M5)
      ObjectSet("EMA_bar1_open",OBJPROP_COLOR,Green);
      else
      ObjectSet("EMA_bar1_open",OBJPROP_COLOR,Red);
}      

//====================================
  
//==========================label for MACD numericals=============================      
      
//      ObjectCreate("MACD_bar0",OBJ_LABEL,0,0,0,0,0);
//      ObjectSetText("MACD_bar0"," " + DoubleToStr(val_bar0_MACD_M5_buffer,5) + " ",font_size,"Tahoma",0);
//      ObjectSet("MACD_bar0",OBJPROP_CORNER,corner_label);
//      ObjectSet("MACD_bar0",OBJPROP_XDISTANCE,X_distance+120);
//      ObjectSet("MACD_bar0",OBJPROP_YDISTANCE,label_dist_Y+20);
//{
//      if  
//      (val_bar0_MACD_M5_buffer > val_bar1_MACD_M5_buffer)
//      ObjectSet("MACD_bar0",OBJPROP_COLOR,Green);
//      else
//      ObjectSet("MACD_bar0",OBJPROP_COLOR,Red);
//}      
      
      ObjectCreate("MACD_bar1",OBJ_LABEL,0,0,0,0,0);
      ObjectSetText("MACD_bar1"," " + DoubleToStr(val_bar1_MACD_M5_buffer,5) + " ",font_size,"Tahoma",0);
      ObjectSet("MACD_bar1",OBJPROP_CORNER,corner_label);
      ObjectSet("MACD_bar1",OBJPROP_XDISTANCE,X_distance+150);
      ObjectSet("MACD_bar1",OBJPROP_YDISTANCE,label_dist_Y);
{
      if  
      (val_bar1_MACD_M5_buffer > val_bar2_MACD_M5_buffer)
      ObjectSet("MACD_bar1",OBJPROP_COLOR,Green);
      else
      ObjectSet("MACD_bar1",OBJPROP_COLOR,Red);
}   

 
//=============label for Stoch numericals=================


//      ObjectCreate("Stoch_bar0_K",OBJ_LABEL,0,0,0,0,0);
//      ObjectSetText("Stoch_bar0_K"," " + DoubleToStr(val_Stoch_M5_buffer0,0) + " ",font_size,"Tahoma",0);
//      ObjectSet("Stoch_bar0_K",OBJPROP_CORNER,corner_label);
//      ObjectSet("Stoch_bar0_K",OBJPROP_XDISTANCE,X_distance+250);
//      ObjectSet("Stoch_bar0_K",OBJPROP_YDISTANCE,label_dist_Y+20);
//{
//      if
//      (val_Stoch_M5_buffer0 > val_Stoch_M5_buffer1)
//      ObjectSet("Stoch_bar0_K",OBJPROP_COLOR,Green);
//      else
//      ObjectSet("Stoch_bar0_K",OBJPROP_COLOR,Red);
//}      
      

//      ObjectCreate("Stoch_bar0_D",OBJ_LABEL,0,0,0,0,0);
//      ObjectSetText("Stoch_bar0_D"," " + DoubleToStr(val_Stoch_M5_buffer1,0) + " ",font_size,"Tahoma",0);
//      ObjectSet("Stoch_bar0_D",OBJPROP_CORNER,corner_label);
//      ObjectSet("Stoch_bar0_D",OBJPROP_XDISTANCE,X_distance+210);
//      ObjectSet("Stoch_bar0_D",OBJPROP_YDISTANCE,label_dist_Y+20);
//{
//      if
//      (val_Stoch_M5_buffer0 > val_Stoch_M5_buffer1)
//      ObjectSet("Stoch_bar0_D",OBJPROP_COLOR,Green);
//      else
//      ObjectSet("Stoch_bar0_D",OBJPROP_COLOR,Red);
//}          
    
//====================================


      ObjectCreate("Stoch_bar1_K",OBJ_LABEL,0,0,0,0,0);
      ObjectSetText("Stoch_bar1_K"," " + DoubleToStr(val_bar1_Stoch_M5_buffer0,0) + " ",font_size,"Tahoma",0);
      ObjectSet("Stoch_bar1_K",OBJPROP_CORNER,corner_label);
      ObjectSet("Stoch_bar1_K",OBJPROP_XDISTANCE,X_distance+280);
      ObjectSet("Stoch_bar1_K",OBJPROP_YDISTANCE,label_dist_Y);
{
      if
      (val_bar1_Stoch_M5_buffer0 > val_bar1_Stoch_M5_buffer1)
      ObjectSet("Stoch_bar1_K",OBJPROP_COLOR,Green);
      else
      ObjectSet("Stoch_bar1_K",OBJPROP_COLOR,Red);
}      
      


      ObjectCreate("Stoch_bar1_D",OBJ_LABEL,0,0,0,0,0);
      ObjectSetText("Stoch_bar1_D"," " + DoubleToStr(val_bar1_Stoch_M5_buffer1,0) + " ",font_size,"Tahoma",0);
      ObjectSet("Stoch_bar1_D",OBJPROP_CORNER,corner_label);
      ObjectSet("Stoch_bar1_D",OBJPROP_XDISTANCE,X_distance+240);
      ObjectSet("Stoch_bar1_D",OBJPROP_YDISTANCE,label_dist_Y);
{
      if
      (val_bar1_Stoch_M5_buffer0 > val_bar1_Stoch_M5_buffer1)
      ObjectSet("Stoch_bar1_D",OBJPROP_COLOR,Green);
      else
      ObjectSet("Stoch_bar1_D",OBJPROP_COLOR,Red);
}          

}

   
//====================================

//=================================UP ARROW OR DOWN ARROW===================

//==================================bar0==================================

  
   ObjectCreate("long0",OBJ_LABEL,0,0,0,0,0);
   ObjectSet("long0",OBJPROP_CORNER,corner_label); 
   ObjectSet("long0",OBJPROP_XDISTANCE,X_distance);
   ObjectSet("long0",OBJPROP_YDISTANCE,label_dist_Y+20);
   
{   
      if

      ((value_open_ma_M5 < value_close_ma_M5)                      &&
      (val_bar0_MACD_M5_buffer > val_bar1_MACD_M5_buffer)          &&
      
//      (value_fast_ma_M5 > value_slow_ma_M5)                       &&
//     (val_Stoch_M5_buffer0 > 20.000)                          &&
//     (val_Stoch_M5_buffer0 < 80.000)                          &&
      (val_Stoch_M5_buffer0 > val_Stoch_M5_buffer1))  
    
      
   ObjectSetText("long0",CharToStr(225),arrow_size,"Wingdings",Green); 
else
   ObjectDelete("long0");
}

//====================================================================
   ObjectCreate("short0",OBJ_LABEL,0,0,0,0,0);
   ObjectSet("short0",OBJPROP_CORNER,corner_label); 
   ObjectSet("short0",OBJPROP_XDISTANCE,X_distance);
//   ObjectSet("short0",OBJPROP_YDISTANCE,Y_distance);
   ObjectSet("short0",OBJPROP_YDISTANCE,label_dist_Y+20);
{   if

            ((value_open_ma_M5 > value_close_ma_M5)                      &&
      (val_bar0_MACD_M5_buffer < val_bar1_MACD_M5_buffer)          &&
      
//      (value_fast_ma_M5 > value_slow_ma_M5)                       &&
//     (val_Stoch_M5_buffer0 > 20.000)                          &&
//     (val_Stoch_M5_buffer0 < 80.000)                          &&
      (val_Stoch_M5_buffer0 < val_Stoch_M5_buffer1))
    
      
   ObjectSetText("short0",CharToStr(226),arrow_size,"Wingdings",Red); 
else
   ObjectDelete("short0");
}

//==================================bar1==================================

  
   ObjectCreate("long1",OBJ_LABEL,0,0,0,0,0);
   ObjectSet("long1",OBJPROP_CORNER,corner_label); 
   ObjectSet("long1",OBJPROP_XDISTANCE,X_distance);
   ObjectSet("long1",OBJPROP_YDISTANCE,label_dist_Y);
   
{   
      if

      ((value_open1_ma_M5 < value_close1_ma_M5)                      &&
      (val_bar1_MACD_M5_buffer > val_bar2_MACD_M5_buffer)          &&
      
//      (value_fast_ma_M5 > value_slow_ma_M5)                       &&
//     (val_Stoch_M5_buffer0 > 20.000)                          &&
//     (val_Stoch_M5_buffer0 < 80.000)                          &&
      (val_bar1_Stoch_M5_buffer0 > val_bar1_Stoch_M5_buffer1))  
    
      
   ObjectSetText("long1",CharToStr(225),arrow_size,"Wingdings",Green); 
else
   ObjectDelete("long1");
}

//====================================================================
   ObjectCreate("short1",OBJ_LABEL,0,0,0,0,0);
   ObjectSet("short1",OBJPROP_CORNER,corner_label); 
   ObjectSet("short1",OBJPROP_XDISTANCE,X_distance);
//   ObjectSet("short1",OBJPROP_YDISTANCE,Y_distance);
   ObjectSet("short1",OBJPROP_YDISTANCE,label_dist_Y);
{   if

            ((value_open1_ma_M5 > value_close1_ma_M5)                      &&
      (val_bar1_MACD_M5_buffer < val_bar2_MACD_M5_buffer)          &&
      
//      (value_fast_ma_M5 > value_slow_ma_M5)                       &&
//     (val_Stoch_M5_buffer0 > 20.000)                          &&
//     (val_Stoch_M5_buffer0 < 80.000)                          &&
      (val_bar1_Stoch_M5_buffer0 < val_bar1_Stoch_M5_buffer1))
    
      
   ObjectSetText("short1",CharToStr(226),arrow_size,"Wingdings",Red); 
else
   ObjectDelete("short1");
}





   return(0);
}
//+------------------------------------------------------------------+


