Average_Range_OH_OL_OHL_HL_OC_W

Download script
Author: Copyright � 2008, cjatradingtools.com
Average_Range_OH_OL_OHL_HL_OC_W

The Average Range script is a specialized visual dashboard designed for MetaTrader 4. Its primary purpose is to provide traders with a structured, at-a-glance summary of historical price movement and volatility by calculating various "ranges" over different timeframes.

Instead of requiring you to manually calculate how much a currency pair or asset moved over the last several days, this script automatically performs those calculations and displays them as clean text labels on your chart.

Core Functionality

The script analyzes daily price data to extract several key metrics, including:

  • High-Low Range: The total distance between the highest and lowest price reached.
  • Open-High & Open-Low: Specific measurements of how far the price moved from the opening bell to its extremes.
  • Close-to-Open: The relative distance between where the day started and where it ended.
  • Weighted/Average Ranges: It calculates "Width" metrics, which help represent the balance of these movements relative to the total daily range.

How it Works for the User

The logic follows a structured sequence to organize information on your screen:

  1. Data Collection: The script looks back at a specific number of previous days (configured by the user via settings like Av_3, Av_4, etc.).
  2. Averaging Logic: It calculates the average movement for several distinct periods (e.g., 1-day, 5-day, 10-day, and 30-day averages). This allows you to see if the current market volatility is higher or lower than what is "normal" for that asset.
  3. Dynamic Display: Once the math is complete, the script generates a formatted dashboard on your chart. It organizes these numbers into rows, clearly labeling them so you can distinguish between:
    • Today’s Stats: Real-time data for the current session.
    • Historical Averages: Comparative data for previous days.
    • Total Average: A final "Total Av" calculation that combines all analyzed periods into one unified metric.

Visual Customization

To ensure the dashboard does not clutter your trading view, the script includes several "Adjuster" settings:

  • Shift_UP_DN: Allows you to move the entire dashboard up or down on your screen.
  • Adjust_Side_to_side: Allows you to slide the dashboard left or right to clear out of the way of your candles or other indicators.
  • Color Coding: The script uses specific colors (like Dark Orange, Gray, and Red) to differentiate between headers, separators, and actual data points, making it easier to read quickly during live trading.

Summary for Traders

Essentially, this tool acts as a Volatility Reference Sheet. By using it, you can immediately see the "expected" range of an asset based on its recent history. If you know that an asset typically moves 100 pips a day on average (based on the script's "Total Av"), and it has already moved 80 pips by mid-day, you have a clear mathematical hint regarding its remaining potential for the session.

Price Data Components
Series array that contains the highest prices of each barSeries array that contains open prices of each barSeries array that contains the lowest prices of each barSeries array that contains close prices for each bar
5 Views
0 Downloads
0 Favorites
Average_Range_OH_OL_OHL_HL_OC_W
//+------------------------------------------------------------------+
//|                                               Average Range .mq4 |
//|                                         Copyright © 2008, by cja |
//|                                      http://cjatradingtools.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, cjatradingtools.com"
#property link      "http://cjatradingtools.com/"

#property indicator_chart_window
extern int Magic_num = 12349;
extern int Av_1  = 0;
extern int Av_2  = 1;
extern int Av_3  = 5;
extern int Av_4  = 10;
extern int Av_5  = 20;
extern int Av_6  = 30;
extern color Title_col    = DarkOrange;
extern color Label_col    = Gray;
extern color Av_col       = Red;
extern color Total_col    = Silver;
extern color Total_Av_col = Red;

extern int   Shift_UP_DN = 10;// Adjusts Signal Display Up & Down 
extern int   Adjust_Side_to_side  = 80;// Adjusts Signal Display from side to side
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   DeleteLabels();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   if(counted_bars < 0) return(-1);
   if(counted_bars > 0) counted_bars--;
        int limit = Bars-counted_bars;
   
   int i=0;

    int AV1=0, AV2=0, AV3=0, AV4=0, AV5=0, AV6=0, RAvg;
    
    int AV1oh=0,AV2oh=0,AV3oh=0,AV4oh=0,AV5oh=0,AV6oh=0,RAvgoh;
    int AV1ol=0,AV2ol=0,AV3ol=0,AV4ol=0,AV5ol=0,AV6ol=0,RAvgol;

    int AV1ohl=0,AV2ohl=0,AV3ohl=0,AV4ohl=0,AV5ohl=0,AV6ohl=0,RAvgohl;

    int AV1c=0,AV2c=0,AV3c=0,AV4c=0,AV5c=0,AV6c=0,RAvgc;
    int AV1w=0,AV2w=0,AV3w=0,AV4w=0,AV5w=0,AV6w=0,RAvgw;




   
  
   AV1oh =  MathAbs(iHigh(NULL,1440,0)-iOpen(NULL,1440,0))/Point;
   AV2oh =  MathAbs(iHigh(NULL,1440,1)-iOpen(NULL,1440,1))/Point;
      
   AV1ol =  MathAbs(iOpen(NULL,1440,0)-iLow(NULL,1440,0))/Point;
   AV2ol =  MathAbs(iOpen(NULL,1440,1)-iLow(NULL,1440,1))/Point;

   AV1ohl =  MathMax(AV1oh,AV1ol);
   AV2ohl =  MathMax(AV2oh,AV2ol);

   AV1 =  (iHigh(NULL,1440,0)-iLow(NULL,1440,0))/Point;
   AV2 =  (iHigh(NULL,1440,1)-iLow(NULL,1440,1))/Point;


   
   AV1c =  MathAbs(iClose(NULL,1,0)   -iOpen(NULL,1440,0))/Point;
   AV2c =  MathAbs(iClose(NULL,1440,1)-iOpen(NULL,1440,1))/Point;
   

   AV1w =(AV1-AV1c)/2;  
   AV2w =(AV2-AV2c)/2;
   
   
   
   for(i=1;i<=Av_3;i++) {

      AV3oh = AV3oh + MathAbs(iHigh(NULL,1440,i)-iOpen(NULL,1440,i))/Point;
      AV3ol = AV3ol + MathAbs(iOpen(NULL,1440,i)-iLow(NULL,1440,i))/Point;

   AV3ohl =  MathMax(AV3oh,AV3ol);


      AV3   =  AV3  +  (iHigh(NULL,1440,i) -iLow(NULL,1440,i))/Point;


      AV3c  =  AV3c +  MathAbs(iClose(NULL,1440,i) -iOpen(NULL,1440,i))/Point;
      AV3w  = (AV3-AV3c)/2;       
                         }
   
   for(i=1;i<=Av_4;i++) {

      AV4oh = AV4oh + MathAbs(iHigh(NULL,1440,i)-iOpen(NULL,1440,i))/Point;
      AV4ol = AV4ol + MathAbs(iOpen(NULL,1440,i)-iLow(NULL,1440,i))/Point;

   AV4ohl =  MathMax(AV4oh,AV4ol);


      AV4   =  AV4  +   (iHigh(NULL,1440,i) -iLow(NULL,1440,i))/Point;
      AV4c  =  AV4c +  MathAbs (iClose(NULL,1440,i)-iOpen(NULL,1440,i))/Point;
      AV4w  = (AV4-AV4c)/2;       
                        }
                        
   for(i=1;i<=Av_5;i++) {   
 
      AV5oh = AV5oh + MathAbs(iHigh(NULL,1440,i)-iOpen(NULL,1440,i))/Point;
      AV5ol = AV5ol + MathAbs(iOpen(NULL,1440,i)-iLow(NULL,1440,i))/Point;

   AV5ohl =  MathMax(AV5oh,AV5ol);

 
      AV5   =  AV5   +  (iHigh(NULL,1440,i) -iLow(NULL,1440,i))/Point;
      AV5c  =  AV5c  +  MathAbs(iClose(NULL,1440,i)-iOpen(NULL,1440,i))/Point;
      AV5w  = (AV5-AV5c)/2;       
                        }
                        
   for(i=1;i<=Av_6;i++) {

      AV6oh = AV6oh + MathAbs(iHigh(NULL,1440,i)-iOpen(NULL,1440,i))/Point;
      AV6ol = AV6ol + MathAbs(iOpen(NULL,1440,i)-iLow(NULL,1440,i))/Point;

   AV6ohl =  MathMax(AV6oh,AV6ol);

 
      AV6   =  AV6   +  (iHigh(NULL,1440,i) -iLow(NULL,1440,i))/Point;
      AV6c  =  AV6c  +  MathAbs(iClose(NULL,1440,i)-iOpen(NULL,1440,i))/Point;
      AV6w  = (AV6-AV6c)/2;       
     
                          }
   
//--- 
     
      AV3oh = AV3oh/Av_3;
      AV4oh = AV4oh/Av_4;
      AV5oh = AV5oh/Av_5;
      AV6oh = AV6oh/Av_6;
      RAvgoh=(AV2oh+AV3oh+AV4oh+AV5oh+AV6oh)/5; 

      AV3ol = AV3ol/Av_3;
      AV4ol = AV4ol/Av_4;
      AV5ol = AV5ol/Av_5;
      AV6ol = AV6ol/Av_6;
      RAvgol=(AV2ol+AV3ol+AV4ol+AV5ol+AV6ol)/5; 


      AV3ohl = AV3ohl/Av_3;
      AV4ohl = AV4ohl/Av_4;
      AV5ohl = AV5ohl/Av_5;
      AV6ohl = AV6ohl/Av_6;
      RAvgohl= (AV2ohl+AV3ohl+AV4ohl+AV5ohl+AV6ohl)/5; 



     
      AV3 = AV3/Av_3;
      AV4 = AV4/Av_4;
      AV5 = AV5/Av_5;
      AV6 = AV6/Av_6;
      RAvg= (AV2+AV3+AV4+AV5+AV6)/5; 


      AV3c = AV3c/Av_3;
      AV4c = AV4c/Av_4;
      AV5c = AV5c/Av_5;
      AV6c = AV6c/Av_6;
      RAvgc= (AV2c+AV3c+AV4c+AV5c+AV6c)/5; 


      AV3w = AV3w/Av_3;
      AV4w = AV4w/Av_4;
      AV5w = AV5w/Av_5;
      AV6w = AV6w/Av_6;
      RAvgw  =  (AV2w+AV3w+AV4w+AV5w+AV6w)/5; 
//




//-----
   
   CreateAverage( "AV"+Magic_num,7+ Shift_UP_DN,-60+ Adjust_Side_to_side );
   ObjectSetText( "AV"+Magic_num,"Daily Range",12,"Arial Bold",DarkOrange); 
   
   CreateAverage( "AVoh"+Magic_num,25+ Shift_UP_DN,155+ Adjust_Side_to_side );
   ObjectSetText( "AVoh"+Magic_num,"O-H",8,"Arial Bold",Chocolate); 

   CreateAverage( "AVol"+Magic_num,25+ Shift_UP_DN,110+ Adjust_Side_to_side );
   ObjectSetText( "AVol"+Magic_num,"O-L",8,"Arial Bold",Chocolate); 


   CreateAverage( "AVohl"+Magic_num,25+ Shift_UP_DN,65+ Adjust_Side_to_side );
   ObjectSetText( "AVohl"+Magic_num,"O-H-L",8,"Arial Bold",Chocolate); 





   CreateAverage( "AVhl"+Magic_num,25+ Shift_UP_DN,25+ Adjust_Side_to_side );
   ObjectSetText( "AVhl"+Magic_num,"H-L",8,"Arial Bold",Chocolate); 

   CreateAverage( "AVcc"+Magic_num,25+ Shift_UP_DN,-20+ Adjust_Side_to_side );
   ObjectSetText( "AVcc"+Magic_num,"O-Cl",8,"Arial Bold",Chocolate); 

   CreateAverage( "AVw"+Magic_num,25+ Shift_UP_DN,-60+ Adjust_Side_to_side );
   ObjectSetText( "AVw"+Magic_num,"W",8,"Arial Bold",Chocolate); 
  
   
   CreateAverage( "AV1"+Magic_num,28+ Shift_UP_DN,-60+ Adjust_Side_to_side );
   ObjectSetText( "AV1"+Magic_num,"----------------------------------------",
                                                10,"Arial Bold",Silver); 
   
 

   CreateAverage("AV2"+Magic_num,40+ Shift_UP_DN,200+ Adjust_Side_to_side );
   ObjectSetText("AV2"+Magic_num,"Today", 12,"Arial Bold",Gray); 
     
   CreateAverage("AV3oh"+Magic_num,40+ Shift_UP_DN,155+ Adjust_Side_to_side );
   ObjectSetText("AV3oh"+Magic_num,DoubleToStr(AV1oh ,0), 12,"Arial Bold",Red); 
     
   CreateAverage("AV3ol"+Magic_num,40+ Shift_UP_DN,110+ Adjust_Side_to_side );
   ObjectSetText("AV3ol"+Magic_num,DoubleToStr(AV1ol ,0), 12,"Arial Bold",Red); 
     
     
   CreateAverage("AV3ohl"+Magic_num,40+ Shift_UP_DN,65+ Adjust_Side_to_side );
   ObjectSetText("AV3ohl"+Magic_num,DoubleToStr(AV1ohl ,0), 12,"Arial Bold",Red); 
     
     
     
   CreateAverage("AV3"+Magic_num,40+ Shift_UP_DN,20+ Adjust_Side_to_side );
   ObjectSetText("AV3"+Magic_num,DoubleToStr(AV1 ,0), 12,"Arial Bold",Red); 
   
   CreateAverage("AV3c"+Magic_num,40+ Shift_UP_DN,-25+ Adjust_Side_to_side );
   ObjectSetText("AV3c"+Magic_num,DoubleToStr(AV1c ,0), 12,"Arial Bold",Red); 
   
   CreateAverage("AV3w"+Magic_num,40+ Shift_UP_DN,-60+ Adjust_Side_to_side );
   ObjectSetText("AV3w"+Magic_num,DoubleToStr(AV1w ,0), 12,"Arial Bold",Red); 

   
   
      
   CreateAverage("AV4"+Magic_num,60+ Shift_UP_DN,200+ Adjust_Side_to_side );
   ObjectSetText("AV4"+Magic_num,""+Av_2+" Day", 12,"Arial Bold",Gray); 
 
 
   CreateAverage("AV5oh"+Magic_num,60+ Shift_UP_DN,155+ Adjust_Side_to_side );
   ObjectSetText("AV5oh"+Magic_num,DoubleToStr(AV2oh ,0), 12,"Arial Bold",Red); 
 
   CreateAverage("AV5ol"+Magic_num,60+ Shift_UP_DN,110+ Adjust_Side_to_side );
   ObjectSetText("AV5ol"+Magic_num,DoubleToStr(AV2ol ,0), 12,"Arial Bold",Red); 

   CreateAverage("AV5ohl"+Magic_num,60+ Shift_UP_DN,65+ Adjust_Side_to_side );
   ObjectSetText("AV5ohl"+Magic_num,DoubleToStr(AV2ohl ,0), 12,"Arial Bold",Red); 



   CreateAverage("AV5"+Magic_num,60+ Shift_UP_DN,20+ Adjust_Side_to_side );
   ObjectSetText("AV5"+Magic_num,DoubleToStr(AV2 ,0), 12,"Arial Bold",Red); 
 
   CreateAverage("AV5c"+Magic_num,60+ Shift_UP_DN,-25+ Adjust_Side_to_side );
   ObjectSetText("AV5c"+Magic_num,DoubleToStr(AV2c ,0), 12,"Arial Bold",Red); 
  
   CreateAverage("AV5w"+Magic_num,60+ Shift_UP_DN,-60+ Adjust_Side_to_side );
   ObjectSetText("AV5w"+Magic_num,DoubleToStr(AV2w ,0), 12,"Arial Bold",Red); 


   
   CreateAverage("AV6" +Magic_num,80+ Shift_UP_DN,200+ Adjust_Side_to_side );
   ObjectSetText("AV6" +Magic_num,""+Av_3+" Days", 12,"Arial Bold",Gray); 

   CreateAverage("AV7oh" +Magic_num,80+ Shift_UP_DN,155+ Adjust_Side_to_side );
   ObjectSetText("AV7oh" +Magic_num,DoubleToStr(AV3oh ,0), 12,"Arial Bold",Red); 

   CreateAverage("AV7ol" +Magic_num,80+ Shift_UP_DN,110+ Adjust_Side_to_side );
   ObjectSetText("AV7ol" +Magic_num,DoubleToStr(AV3ol ,0), 12,"Arial Bold",Red); 

   CreateAverage("AV7ohl"+Magic_num,80+ Shift_UP_DN,65+ Adjust_Side_to_side );
   ObjectSetText("AV7ohl"+Magic_num,DoubleToStr(AV3ohl ,0), 12,"Arial Bold",Red); 
     
     
     
   CreateAverage("AV7" +Magic_num,80+ Shift_UP_DN,20+ Adjust_Side_to_side );
   ObjectSetText("AV7" +Magic_num,DoubleToStr(AV3 ,0), 12,"Arial Bold",Red); 

   CreateAverage("AV7c"+Magic_num,80+ Shift_UP_DN,-25+ Adjust_Side_to_side );
   ObjectSetText("AV7c"+Magic_num,DoubleToStr(AV3c ,0), 12,"Arial Bold",Red); 

   CreateAverage("AV7w"+Magic_num,80+ Shift_UP_DN,-60+ Adjust_Side_to_side );
   ObjectSetText("AV7w"+Magic_num,DoubleToStr(AV3w ,0), 12,"Arial Bold",Red); 


   
   
   CreateAverage("AV8"+Magic_num,100+ Shift_UP_DN,200+ Adjust_Side_to_side );
   ObjectSetText("AV8"+Magic_num,""+Av_4+" Days", 12,"Arial Bold",Gray); 
     
   CreateAverage("AV9oh"+Magic_num,100+ Shift_UP_DN,155+ Adjust_Side_to_side );
   ObjectSetText("AV9oh"+Magic_num,DoubleToStr(AV4oh ,0), 12,"Arial Bold",Red); 
     
   CreateAverage("AV9ol"+Magic_num,100+ Shift_UP_DN,110+ Adjust_Side_to_side );
   ObjectSetText("AV9ol"+Magic_num,DoubleToStr(AV4ol ,0), 12,"Arial Bold",Red); 
     
     
   CreateAverage("AV9ohl"+Magic_num,100+ Shift_UP_DN,65+ Adjust_Side_to_side );
   ObjectSetText("AV9ohl"+Magic_num,DoubleToStr(AV4ohl ,0), 12,"Arial Bold",Red); 
     
     
   CreateAverage("AV9"+Magic_num,100+ Shift_UP_DN,20+ Adjust_Side_to_side );
   ObjectSetText("AV9"+Magic_num,DoubleToStr(AV4 ,0), 12,"Arial Bold",Red); 
   
   CreateAverage("AV9c"+Magic_num,100+ Shift_UP_DN,-25+ Adjust_Side_to_side );
   ObjectSetText("AV9c"+Magic_num,DoubleToStr(AV4c ,0), 12,"Arial Bold",Red); 
   
   CreateAverage("AV9w"+Magic_num,100+ Shift_UP_DN,-60+ Adjust_Side_to_side );
   ObjectSetText("AV9w"+Magic_num,DoubleToStr(AV4w ,0), 12,"Arial Bold",Red); 

   
   
   CreateAverage("AV10"+Magic_num,120+ Shift_UP_DN,200+ Adjust_Side_to_side );
   ObjectSetText("AV10"+Magic_num,""+Av_5+" Days", 12,"Arial Bold",Gray); 
     
   CreateAverage("AV11oh"+Magic_num,120+ Shift_UP_DN,155+ Adjust_Side_to_side );
   ObjectSetText("AV11oh"+Magic_num,DoubleToStr(AV5oh ,0), 12,"Arial Bold",Red); 
   
   CreateAverage("AV11ol"+Magic_num,120+ Shift_UP_DN,110+ Adjust_Side_to_side );
   ObjectSetText("AV11ol"+Magic_num,DoubleToStr(AV5ol ,0), 12,"Arial Bold",Red); 
   
   CreateAverage("AV11ohl"+Magic_num,120+ Shift_UP_DN,65+ Adjust_Side_to_side );
   ObjectSetText("AV11ohl"+Magic_num,DoubleToStr(AV5ohl ,0), 12,"Arial Bold",Red); 
     
     
     
     
   CreateAverage("AV11"+Magic_num,120+ Shift_UP_DN,20+ Adjust_Side_to_side );
   ObjectSetText("AV11"+Magic_num,DoubleToStr(AV5 ,0), 12,"Arial Bold",Red); 
   
   CreateAverage("AV11c"+Magic_num,120+ Shift_UP_DN,-25+ Adjust_Side_to_side );
   ObjectSetText("AV11c"+Magic_num,DoubleToStr(AV5c ,0), 12,"Arial Bold",Red); 
   
   CreateAverage("AV11w"+Magic_num,120+ Shift_UP_DN,-60+ Adjust_Side_to_side );
   ObjectSetText("AV11w"+Magic_num,DoubleToStr(AV5w ,0), 12,"Arial Bold",Red); 
   
   
   
   CreateAverage("AV12"+Magic_num,140+ Shift_UP_DN,200+ Adjust_Side_to_side );
   ObjectSetText("AV12"+Magic_num,""+Av_6+" Days", 12,"Arial Bold",Gray); 



   CreateAverage("AV13oh"+Magic_num,140+ Shift_UP_DN,155+ Adjust_Side_to_side );
   ObjectSetText("AV13oh"+Magic_num,DoubleToStr(AV6oh ,0), 12,"Arial Bold",Red); 

   CreateAverage("AV13ol"+Magic_num,140+ Shift_UP_DN,110+ Adjust_Side_to_side );
   ObjectSetText("AV13ol"+Magic_num,DoubleToStr(AV6ol ,0), 12,"Arial Bold",Red); 

   CreateAverage("AV13ohl"+Magic_num,140+ Shift_UP_DN,65+ Adjust_Side_to_side );
   ObjectSetText("AV13ohl"+Magic_num,DoubleToStr(AV6ohl ,0), 12,"Arial Bold",Red); 

     
   CreateAverage("AV13"+Magic_num,140+ Shift_UP_DN,20+ Adjust_Side_to_side );
   ObjectSetText("AV13"+Magic_num,DoubleToStr(AV6 ,0), 12,"Arial Bold",Red); 

   CreateAverage("AV13c"+Magic_num,140+ Shift_UP_DN,-25+ Adjust_Side_to_side );
   ObjectSetText("AV13c"+Magic_num,DoubleToStr(AV6c ,0), 12,"Arial Bold",Red); 
   
   CreateAverage("AV13w"+Magic_num,140+ Shift_UP_DN,-60+ Adjust_Side_to_side );
   ObjectSetText("AV13w"+Magic_num,DoubleToStr(AV6w ,0), 12,"Arial Bold",Red); 
      

   
   CreateAverage("AV14"+Magic_num,167+ Shift_UP_DN,200+ Adjust_Side_to_side );
   ObjectSetText("AV14"+Magic_num,"Total Av", 12,"Arial Bold",Silver); 
  
   CreateAverage("AV15oh"+Magic_num,167+ Shift_UP_DN,155+ Adjust_Side_to_side );
   ObjectSetText("AV15oh"+Magic_num,DoubleToStr(RAvgoh ,0), 12,"Arial Bold",Red); 

   CreateAverage("AV15ol"+Magic_num,167+ Shift_UP_DN,110+ Adjust_Side_to_side );
   ObjectSetText("AV15ol"+Magic_num,DoubleToStr(RAvgol ,0), 12,"Arial Bold",Red); 
  
  
   CreateAverage("AV15ohl"+Magic_num,167+ Shift_UP_DN,65+ Adjust_Side_to_side );
   ObjectSetText("AV15ohl"+Magic_num,DoubleToStr(RAvgohl ,0), 12,"Arial Bold",Red); 

  
  
   CreateAverage("AV15"+Magic_num,167+ Shift_UP_DN,20+ Adjust_Side_to_side );
   ObjectSetText("AV15"+Magic_num,DoubleToStr(RAvg ,0), 12,"Arial Bold",Red); 
 
   CreateAverage("AV15c"+Magic_num,167+ Shift_UP_DN,-25+ Adjust_Side_to_side );
   ObjectSetText("AV15c"+Magic_num,DoubleToStr(RAvgc ,0), 12,"Arial Bold",Red); 

   CreateAverage("AV15w"+Magic_num,167+ Shift_UP_DN,-60+ Adjust_Side_to_side );
   ObjectSetText("AV15w"+Magic_num,DoubleToStr(RAvgw ,0), 12,"Arial Bold",Red); 
 
 
   
   
   CreateAverage("AV16"+Magic_num,155+ Shift_UP_DN,-60+ Adjust_Side_to_side );
   ObjectSetText("AV16"+Magic_num,"---------------------------------------",10,"Arial Bold",Silver); 
   
   CreateAverage("AV17"+Magic_num,180+ Shift_UP_DN,-60+ Adjust_Side_to_side );
   ObjectSetText("AV17"+Magic_num,"----------------------------------------",10,"Arial Bold",Silver); 
   
   
     
   
//----
   return(0);
  }
  
  
int CreateAverage( string n, int Shift_UP_DN, int Adjust_Side_to_side ) {
   ObjectCreate( n, OBJ_LABEL,0, 0, 0 );
   ObjectSet( n, OBJPROP_CORNER, 1 );
   ObjectSet( n, OBJPROP_XDISTANCE,Adjust_Side_to_side );
   ObjectSet( n, OBJPROP_YDISTANCE,Shift_UP_DN);
   ObjectSet( n, OBJPROP_BACK, false );
   }
   
   void DeleteLabels(){
   
   ObjectDelete("AV"+Magic_num); ObjectDelete("AV1"+Magic_num);ObjectDelete("AV2"+Magic_num);
   ObjectDelete("AV3"+Magic_num);ObjectDelete("AV4"+Magic_num);ObjectDelete("AV5"+Magic_num);
   ObjectDelete("AV6"+Magic_num);ObjectDelete("AV7"+Magic_num);ObjectDelete("AV8"+Magic_num);
   ObjectDelete("AV9"+Magic_num);ObjectDelete("AV10"+Magic_num);ObjectDelete("AV11"+Magic_num);
   ObjectDelete("AV12"+Magic_num);ObjectDelete("AV13"+Magic_num);ObjectDelete("AV14"+Magic_num);
   ObjectDelete("AV15"+Magic_num);ObjectDelete("AV16"+Magic_num);ObjectDelete("AV17"+Magic_num);
   ObjectDelete("AVhl"+Magic_num);
  
  
  ObjectDelete("AVhl"+Magic_num); ObjectDelete("AVcc"+Magic_num);ObjectDelete("AV3c"+Magic_num);
  ObjectDelete("AV4c"+Magic_num); ObjectDelete("AV5c"+Magic_num);ObjectDelete("AV7c"+Magic_num);
  ObjectDelete("AV9c"+Magic_num); ObjectDelete("AV11c"+Magic_num);ObjectDelete("AV13c"+Magic_num);
  ObjectDelete("AV15c"+Magic_num); 

   ObjectDelete("AVw"+Magic_num); 
   ObjectDelete("AV1w"+Magic_num);   ObjectDelete("AV2w"+Magic_num);
   ObjectDelete("AV3w"+Magic_num);   ObjectDelete("AV4w"+Magic_num);
   ObjectDelete("AV5w"+Magic_num);   ObjectDelete("AV7w"+Magic_num);
   ObjectDelete("AV9w"+Magic_num);   ObjectDelete("AV11w"+Magic_num);
   ObjectDelete("AV13w"+Magic_num);  ObjectDelete("AV15w"+Magic_num); 

   ObjectDelete("AVoh"+Magic_num); 
   ObjectDelete("AV1oh"+Magic_num);   ObjectDelete("AV2oh"+Magic_num);
   ObjectDelete("AV3oh"+Magic_num);   ObjectDelete("AV4oh"+Magic_num);
   ObjectDelete("AV5oh"+Magic_num);   ObjectDelete("AV7oh"+Magic_num);
   ObjectDelete("AV9oh"+Magic_num);   ObjectDelete("AV11oh"+Magic_num);
   ObjectDelete("AV13oh"+Magic_num);  ObjectDelete("AV15oh"+Magic_num); 


   ObjectDelete("AVol"+Magic_num); 
   ObjectDelete("AV1ol"+Magic_num);   ObjectDelete("AV2ol"+Magic_num);
   ObjectDelete("AV3ol"+Magic_num);   ObjectDelete("AV4ol"+Magic_num);
   ObjectDelete("AV5ol"+Magic_num);   ObjectDelete("AV7ol"+Magic_num);
   ObjectDelete("AV9ol"+Magic_num);   ObjectDelete("AV11ol"+Magic_num);
   ObjectDelete("AV13ol"+Magic_num);  ObjectDelete("AV15ol"+Magic_num); 



   ObjectDelete("AVohl"+Magic_num); 
   ObjectDelete("AV1ohl"+Magic_num);   ObjectDelete("AV2ohl"+Magic_num);
   ObjectDelete("AV3ohl"+Magic_num);   ObjectDelete("AV4ohl"+Magic_num);
   ObjectDelete("AV5ohl"+Magic_num);   ObjectDelete("AV7ohl"+Magic_num);
   ObjectDelete("AV9ohl"+Magic_num);   ObjectDelete("AV11ohl"+Magic_num);
   ObjectDelete("AV13ohl"+Magic_num);  ObjectDelete("AV15ohl"+Magic_num); 





   }
//+------------------------------------------------------------------+

Comments