Navigation:Home > Content >

PriceInfo2_1.mq4

Time: 2013-04-10 | Download file:PriceInfo2_1.mq4

//+------------------------------------------------------------------+
//|                                        #Signal_Bars_v3_Daily.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
#property link      " cja "
#property indicator_chart_window

extern bool Corner_of_Chart_RIGHT_TOP = true;
extern bool Show_Price = true;
extern bool Show_Xtra_Details = true;
extern bool Show_Smaller_Size = true;
extern int Shift_UP_DN =0; 
extern int Adjust_Side_to_side  = 20;
extern color BarLabel_color = Aqua;
extern color CommentLabel_color = Aqua;




//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectsDeleteAll(0,OBJ_LABEL); 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {    
 

   //*****************************************************************************************************
   //Info
   int precision;
   if (Symbol() == "GBPJPY" || Symbol() == "USDJPY" || Symbol() == "EURJPY" 
        || Symbol() == "CADJPY" || Symbol() == "CHFJPY" || Symbol() == "AUDJPY")
       precision = 2; else precision = 4;   
   
   string PRC1;
   color PriceColor;
   PriceColor = Lime;
   double Price1 = iMA(Symbol(),0,1,0,MODE_EMA,PRICE_CLOSE,0);  
   PRC1 = DoubleToStr(Price1,precision);  
        
   

    if (Show_Smaller_Size  == false)
    {  
      
    if (Show_Price  == true)
    {      
           ObjectCreate("Signalprice", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("Signalprice",""+PRC1+"", 33, "Arial",  PriceColor);
   ObjectSet("Signalprice", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("Signalprice", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("Signalprice", OBJPROP_YDISTANCE, 58+Shift_UP_DN); 
   }}
          
    if (Show_Smaller_Size  == true)
    {  
     if (Show_Price  == true)
    {     
           ObjectCreate("Signalprice", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("Signalprice",""+PRC1+"", 15, "Arial",  PriceColor);
   ObjectSet("Signalprice", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("Signalprice", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("Signalprice", OBJPROP_YDISTANCE, 60+Shift_UP_DN);  
   }}
   int R1=0,R5=0,R10=0,R20=0,RAvg=0,i=0;
   R1 =  (iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1))/Point/10;
   for(i=1;i<=5;i++)
      R5    =    R5  +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point/10;
   for(i=1;i<=10;i++)
      R10   =    R10 +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point/10;
   for(i=1;i<=20;i++)
      R20   =    R20 +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point/10;

   R5 = R5/5;
   R10 = R10/10;
   R20 = R20/20;
   RAvg  =  (R1+R5+R10+R20)/4; 

   
   
   
   string HI="",LO="",SPREAD="",PIPS="",DAV="",HILO="",PRC,Pips="",Av="",AV_Yest="";
   color color_pip,color_av;
   double OPEN = iOpen(NULL,1440,0);
   double CLOSE = iClose(NULL,1440,0);
   double SPRD = NormalizeDouble((Ask - Bid)/Point/10,1);
   double High_Today = iHigh(NULL,1440,0);
   double Low_Today = iLow(NULL,1440,0);
   PIPS =  DoubleToStr((CLOSE-OPEN)/Point/10,0);
   SPREAD = (DoubleToStr(SPRD,1));
   DAV = (DoubleToStr(RAvg,0));
   AV_Yest =  (iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1))/Point;
   HILO = DoubleToStr((High_Today-Low_Today)/Point/10,0);
  
     if (CLOSE >= OPEN) {Pips= "-";color_pip = Blue; }
     if (CLOSE < OPEN) {Pips= "-";color_pip = Red; }
      if (DAV > AV_Yest) {Av= "-";color_av = Blue; }
     if (DAV < AV_Yest) {Av= "-";color_av = Red; }
     
        
    if (Show_Smaller_Size  == false)
    {     
    if (Show_Xtra_Details == true)
    {
     if (Show_Price  == true)
    {  
    
                ObjectCreate("MMLEVELS7", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS7","Spread", 12, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS7", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS7", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS7", OBJPROP_YDISTANCE, 100+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS8", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS8",""+SPREAD+"", 12, "Arial Bold", Yellow);
   ObjectSet("MMLEVELS8", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS8", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS8", OBJPROP_YDISTANCE, 100+Shift_UP_DN);  
   
     
                ObjectCreate("MMLEVELS9", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS9","Pips to Open", 12, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS9", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS9", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS9", OBJPROP_YDISTANCE, 115+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS10", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS10",""+PIPS+"", 12, "Arial Bold", color_pip);
   ObjectSet("MMLEVELS10", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS10", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS10", OBJPROP_YDISTANCE, 115+Shift_UP_DN);  
      
                ObjectCreate("MMLEVELS11", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS11","Hi to Low", 12, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS11", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS11", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS11", OBJPROP_YDISTANCE, 130+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS12", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS12",""+HILO+"", 12, "Arial Bold", Blue);
   ObjectSet("MMLEVELS12", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS12", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS12", OBJPROP_YDISTANCE, 130+Shift_UP_DN);  
   
                 ObjectCreate("MMLEVELS13", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS13","Daily Av", 12, "Arial",CommentLabel_color);
   ObjectSet("MMLEVELS13", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS13", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS13", OBJPROP_YDISTANCE, 145+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS14", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS14",""+DAV+"", 12, "Arial Bold", color_av);
   ObjectSet("MMLEVELS14", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS14", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS14", OBJPROP_YDISTANCE, 145+Shift_UP_DN); 
 }}}
 //*****************************************************************
 //Shift if price not wanted
  if (Show_Smaller_Size  == false)
    {     
    if (Show_Xtra_Details == true)
    {
     if (Show_Price  == false)
    {  
    
                ObjectCreate("MMLEVELS7", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS7","Spread", 12, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS7", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS7", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS7", OBJPROP_YDISTANCE, 60+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS8", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS8",""+SPREAD+"", 12, "Arial Bold", Yellow);
   ObjectSet("MMLEVELS8", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS8", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS8", OBJPROP_YDISTANCE, 60+Shift_UP_DN);  
   
     
                ObjectCreate("MMLEVELS9", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS9","Pips to Open", 12, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS9", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS9", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS9", OBJPROP_YDISTANCE, 75+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS10", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS10",""+PIPS+"", 12, "Arial Bold", color_pip);
   ObjectSet("MMLEVELS10", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS10", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS10", OBJPROP_YDISTANCE, 75+Shift_UP_DN);  
      
                ObjectCreate("MMLEVELS11", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS11","Hi to Low", 12, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS11", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS11", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS11", OBJPROP_YDISTANCE, 90+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS12", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS12",""+HILO+"", 12, "Arial Bold", Blue);
   ObjectSet("MMLEVELS12", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS12", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS12", OBJPROP_YDISTANCE, 90+Shift_UP_DN);  
   
                 ObjectCreate("MMLEVELS13", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS13","Daily Av", 12, "Arial",CommentLabel_color);
   ObjectSet("MMLEVELS13", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS13", OBJPROP_XDISTANCE, 45+Adjust_Side_to_side);
   ObjectSet("MMLEVELS13", OBJPROP_YDISTANCE, 105+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS14", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS14",""+DAV+"", 12, "Arial Bold", color_av);
   ObjectSet("MMLEVELS14", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS14", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS14", OBJPROP_YDISTANCE, 105+Shift_UP_DN); 
 }}}
 
  //***********************************************************************
  //Smaller type option     
    if (Show_Smaller_Size  == true)
    {     
    if (Show_Xtra_Details == true)
    {
     if (Show_Price  == true)
    {  
    
                ObjectCreate("MMLEVELS7", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS7","Spread", 9, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS7", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS7", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS7", OBJPROP_YDISTANCE, 80+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS8", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS8",""+SPREAD+"", 9, "Arial Bold", Yellow);
   ObjectSet("MMLEVELS8", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS8", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS8", OBJPROP_YDISTANCE, 80+Shift_UP_DN);  
   
     
                ObjectCreate("MMLEVELS9", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS9","Pips to Open", 9, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS9", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS9", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS9", OBJPROP_YDISTANCE, 95+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS10", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS10",""+PIPS+"", 9, "Arial Bold", color_pip);
   ObjectSet("MMLEVELS10", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS10", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS10", OBJPROP_YDISTANCE, 95+Shift_UP_DN);  
      
                ObjectCreate("MMLEVELS11", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS11","Hi to Low", 9, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS11", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS11", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS11", OBJPROP_YDISTANCE, 110+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS12", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS12",""+HILO+"", 9, "Arial Bold", Blue);
   ObjectSet("MMLEVELS12", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS12", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS12", OBJPROP_YDISTANCE, 110+Shift_UP_DN);  
   
                 ObjectCreate("MMLEVELS13", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS13","Daily Av", 9, "Arial",CommentLabel_color);
   ObjectSet("MMLEVELS13", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS13", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS13", OBJPROP_YDISTANCE, 125+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS14", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS14",""+DAV+"", 9, "Arial Bold", color_av);
   ObjectSet("MMLEVELS14", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS14", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS14", OBJPROP_YDISTANCE, 125+Shift_UP_DN); 
 }}}
 
 //****************************************************************
 // Shift if Price not needed
  if (Show_Smaller_Size  == true)
    {     
    if (Show_Xtra_Details == true)
    {
     if (Show_Price  == false)
    {  
    
                ObjectCreate("MMLEVELS7", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS7","Spread", 9, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS7", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS7", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS7", OBJPROP_YDISTANCE, 60+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS8", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS8",""+SPREAD+"", 9, "Arial Bold", Yellow);
   ObjectSet("MMLEVELS8", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS8", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS8", OBJPROP_YDISTANCE, 60+Shift_UP_DN);  
   
     
                ObjectCreate("MMLEVELS9", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS9","Pips to Open", 9, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS9", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS9", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS9", OBJPROP_YDISTANCE, 75+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS10", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS10",""+PIPS+"", 9, "Arial Bold", color_pip);
   ObjectSet("MMLEVELS10", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS10", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS10", OBJPROP_YDISTANCE, 75+Shift_UP_DN);  
      
                ObjectCreate("MMLEVELS11", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS11","Hi to Low", 9, "Arial", CommentLabel_color);
   ObjectSet("MMLEVELS11", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS11", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS11", OBJPROP_YDISTANCE, 90+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS12", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS12",""+HILO+"", 9, "Arial Bold", Blue);
   ObjectSet("MMLEVELS12", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS12", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS12", OBJPROP_YDISTANCE, 90+Shift_UP_DN);  
   
                 ObjectCreate("MMLEVELS13", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS13","Daily Av", 9, "Arial",CommentLabel_color);
   ObjectSet("MMLEVELS13", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS13", OBJPROP_XDISTANCE, 40+Adjust_Side_to_side);
   ObjectSet("MMLEVELS13", OBJPROP_YDISTANCE, 105+Shift_UP_DN); 
   
               ObjectCreate("MMLEVELS14", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("MMLEVELS14",""+DAV+"", 9, "Arial Bold", color_av);
   ObjectSet("MMLEVELS14", OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet("MMLEVELS14", OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet("MMLEVELS14", OBJPROP_YDISTANCE, 105+Shift_UP_DN); 
 }}}
 //----
   return(0);
  }
//+------------------------------------------------------------------+

Recommend