Pivot-point-vTEXT

Download script
Author:
Pivot-point-vTEXT

This script is an automated technical analysis tool designed to calculate and display "Pivot Points" directly on your trading charts. Pivot points are common price levels used by traders to identify potential areas of support (where prices might stop falling) and resistance (where prices might stop rising).

Core Logic and Functionality

1. Data Collection The script automatically retrieves historical price data—specifically the high, low, opening, and closing prices—from the previous trading day. It is designed with a specific logic to handle weekends; if it detects a Monday, it intelligently looks back to find the last valid Friday of trading to ensure the calculations remain accurate.

2. Mathematical Calculations Once the historical data is gathered, the script performs a series of calculations to generate several key price levels:

  • The Pivot Point (P): The central equilibrium point based on the previous day's price action.
  • Resistance Levels (R1, R2, R3): These represent "ceilings" where upward momentum might face selling pressure.
  • Support Levels (S1, S2, S3): These represent "floors" where downward momentum might face buying interest.
  • M-Levels (M0–M5): The script calculates additional intermediate levels (midpoints) between the primary support and resistance lines to provide a more granular view of the price corridors.

3. Visual Display The script is designed to be highly customizable for the user. It handles the visual presentation in three ways:

  • Dynamic Drawing: It can automatically draw horizontal lines across your chart at every calculated level.
  • On-Screen Labels: It generates text labels (e.g., "R1", "S2", "Pivot") that float on the chart, showing the exact price value. These labels are programmed to stay organized in a specific layout, allowing you to see all levels at a glance.
  • Customization Options: You can toggle these lines and labels on or off, change their colors to match your preference, and adjust the font size or position of the information displayed on your screen.

Summary for the User

Essentially, this tool removes the manual math from your trading routine. Instead of calculating support and resistance levels by hand every day, the script does it instantly. It paints a "map" of the current trading day's key price zones, helping you visualize where the market is likely to react based on yesterday's price history.

Price Data Components
Series array that contains open time of each bar
17 Views
0 Downloads
0 Favorites
Pivot-point-vTEXT
//+------------------------------------------------------------------+
//|                                            Pivot-point-vTEXT.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//|           Included is the PRICE based Pivot calculator           |
//|                (Daily Pivot,R1,R2,R3 & S1,S2,S3)                 |
//|                                                                  |
//|                                 Email: Xard777@connectfree.co.uk |
//+------------------------------------------------------------------+
#property copyright ""
#property link      "Comments & M Levels added by cja"
#property indicator_chart_window

extern string IIIIIIIIIIIIIIIIIIIIIIIII="<<<< Show/Lines/Comments >>>>>>>>>>>>>>>>>";
extern bool Draw_Main_Lines=false;
extern bool Draw_M_Lines = true;
extern bool Show_Comments_Main_Levels = true;
extern bool Show_Comments_M_Levels = true;
extern string IIIIIIIIIIIIIIIIIIIIIIIIII="<<<< Line/Comments/Colors >>>>>>>>>>>>>>>>";
extern string IIIIIIIIIIIIIIIIIIIIIIIIIIIII="<<<< Main Level/Colors >>>>>>>>>>>>>>>>";
extern color R3_color = Blue;
extern color R2_color = Blue;
extern color R1_color = Blue;
extern color PP_color = Red;
extern color S1_color = Blue;
extern color S2_color = Blue;
extern color S3_color = Blue;
extern string IIIIIIIIIIIIIIIIIIIIIIIIIIIIII="<<<< M Level/Colors >>>>>>>>>>>>>>>>";
extern color M5_color = DimGray;
extern color M4_color = DimGray;
extern color M3_color = DimGray;
extern color M2_color = DimGray;
extern color M1_color = DimGray;
extern color M0_color = DimGray;

extern string IIIIIIIIIIIIIIIIIIIIIIIIIII="<<<< Comment Movements >>>>>>>>>>>>>>>>>>";
extern int AdjustComments_UP_DOWN = 0;
extern int AdjustComments_Sideways = 0;
extern bool Set_Comments_TopRight = true;
//---- input parameters ----
extern string IIIIIIIIIIIIIIIIIIIIIIIIIIII ="<<<< Comments/font size >>>>>>>>>>>>>>>>>";
extern int fontsize = 12;
double LastHigh, LastLow, x;

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   ObjectsDeleteAll(0,OBJ_LABEL);
  
  Comment(""); 
  ObjectDelete("p_Line");
  ObjectDelete("r1_Line");
  ObjectDelete("r2_Line");
  ObjectDelete("r3_Line");
  ObjectDelete("s1_Line");
  ObjectDelete("s2_Line");
  ObjectDelete("s3_Line");
  ObjectDelete("P label");
  ObjectDelete("R1 label");
  ObjectDelete("R2 label");
  ObjectDelete("R3 label");
  ObjectDelete("S1 label");
  ObjectDelete("S2 label");
  ObjectDelete("S3 label");
  
  ObjectDelete("m5_Line");
  ObjectDelete("m4_Line");
  ObjectDelete("m3_Line");
  ObjectDelete("m2_Line");
  ObjectDelete("m1_Line");
  ObjectDelete("m0_Line");
    
  ObjectDelete("M5 label");
  ObjectDelete("M4 label");
  ObjectDelete("M3 label");
  ObjectDelete("M2 label");
  ObjectDelete("M1 label");
  ObjectDelete("M0 label");
  
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {



//---- Name for DataWindow and indicator subwindow label
   IndicatorShortName("XA"); 
   SetIndexDrawBegin(0,1);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));

   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{

  //{
   int counted_bars = IndicatorCounted();
   int limit, i;
   
//---- Indicator Calculation ----
   if(counted_bars == 0)
     {
       x = Period();
       if(x > 240) 
           return(-1);       
     }
   if(counted_bars < 0) 
       return(-1);
   //---- last counted bar will be recounted
   //   if(counted_bars>0) counted_bars--;
      limit = (Bars - counted_bars) - 1;
//----
   for(i = limit; i >= 0; i--)
     { 
       if(High[i+1] > LastHigh) 
           LastHigh = High[i+1];
       //----
       if(Low[i+1] < LastLow) 
           LastLow=Low[i+1];
       if(TimeDay(Time[i]) != TimeDay(Time[i+1]))
         { 
         
           LastLow = Open[i]; 
           LastHigh = Open[i];
           
         }
      
//---- Pivot Setup ----
double rates[1][6],yesterday_volume,yesterday_close,yesterday_high,yesterday_low,yesterday_open;
ArrayCopyRates(rates, Symbol(), PERIOD_D1);

if(DayOfWeek() == 1)
{
   if(TimeDayOfWeek(iTime(Symbol(),PERIOD_D1,1)) == 5)
   {
       yesterday_volume = rates[1][5];
       yesterday_close = rates[1][4];
       yesterday_high = rates[1][3];
       yesterday_low = rates[1][2];
       yesterday_open = rates[1][1];
       
   }
   else
   {
      for(int d = 5;d>=0;d--)
      {
         if(TimeDayOfWeek(iTime(Symbol(),PERIOD_D1,d)) == 5)
         {
             yesterday_volume = rates[d][5];
             yesterday_close = rates[d][4];
             yesterday_high = rates[d][3];
             yesterday_low = rates[d][2];
             yesterday_open = rates[d][1];
         }
         
      }  
      
   }
}
else
{
    yesterday_close = rates[1][4];
    yesterday_high = rates[1][3];
    yesterday_low = rates[1][2];
    yesterday_open = rates[1][1];
}

//---- Calculate Pivots ----
double R = yesterday_high - yesterday_low;//range
double p = (yesterday_high + yesterday_low + yesterday_close)/3;// Standard Pivot
double r3 = (2*p)+(yesterday_high-(2*yesterday_low));// Resistance 3
double r2 = p+(yesterday_high - yesterday_low);// Resistance point 2
double r1 = (2*p)-yesterday_low;// Resistance point 1
double s1 = (2*p)-yesterday_high;// Support point 1
double s2 = p-(yesterday_high - yesterday_low);// Support point 2
double s3 = (2*p)-((2* yesterday_high)-yesterday_low);// Support point 3

    double m0 = (s2 + s3)/2;
    double m1 = (s1 + s2)/2;
    double m2 = (p + s1)/2;
    double m3 = (p + r1)/2; 
    double m4 = (r1 + r2)/2;
    double m5 = (r2 + r3)/2; 

    if(Show_Comments_Main_Levels==true) 
    {
     if(Show_Comments_M_Levels==false){ 
          ObjectCreate("PPR3", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPR3","R3 = "+DoubleToStr(r3,Digits), fontsize, "Arial Bold", S3_color);
   ObjectSet("PPR3", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPR3", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPR3", OBJPROP_YDISTANCE, 20+AdjustComments_UP_DOWN); 
   
         ObjectCreate("PPR2", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPR2","R2 = "+ DoubleToStr(r2,Digits), fontsize, "Arial Bold", S2_color);
   ObjectSet("PPR2", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPR2", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPR2", OBJPROP_YDISTANCE, 40+AdjustComments_UP_DOWN); 
   
         ObjectCreate("PPR1", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPR1","R1 = "+ DoubleToStr(r1,Digits), fontsize, "Arial Bold", S1_color);
   ObjectSet("PPR1", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPR1", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPR1", OBJPROP_YDISTANCE, 60+AdjustComments_UP_DOWN); 
 
         ObjectCreate("PP", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PP","P   = "+ DoubleToStr(p,Digits), fontsize, "Arial Bold", PP_color);
   ObjectSet("PP", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PP", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PP", OBJPROP_YDISTANCE, 80+AdjustComments_UP_DOWN); 
   
         ObjectCreate("PPS1", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPS1","S1 = "+ DoubleToStr(s1,Digits), fontsize, "Arial Bold", R1_color);
   ObjectSet("PPS1", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPS1", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPS1", OBJPROP_YDISTANCE, 100+AdjustComments_UP_DOWN); 
   
         ObjectCreate("PPS2", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPS2","S2 = "+ DoubleToStr(s2,Digits), fontsize, "Arial Bold", R2_color);
   ObjectSet("PPS2", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPS2", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPS2", OBJPROP_YDISTANCE, 120+AdjustComments_UP_DOWN);
    
         ObjectCreate("PPS3", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPS3","S3 = "+ DoubleToStr(s3,Digits), fontsize, "Arial Bold", R3_color);
   ObjectSet("PPS3", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPS3", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPS3", OBJPROP_YDISTANCE, 140+AdjustComments_UP_DOWN); 
   }}
   
   // M Levels
   
   if(Show_Comments_M_Levels==true){ 
           ObjectCreate("PPR3", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPR3","R3 = "+DoubleToStr(r3,Digits), fontsize, "Arial Bold", S3_color);
   ObjectSet("PPR3", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPR3", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPR3", OBJPROP_YDISTANCE, 20+AdjustComments_UP_DOWN); 
   
         ObjectCreate("PPR2", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPR2","R2 = "+ DoubleToStr(r2,Digits), fontsize, "Arial Bold", S2_color);
   ObjectSet("PPR2", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPR2", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPR2", OBJPROP_YDISTANCE, 60+AdjustComments_UP_DOWN); 
   
         ObjectCreate("PPR1", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPR1","R1 = "+ DoubleToStr(r1,Digits), fontsize, "Arial Bold", S1_color);
   ObjectSet("PPR1", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPR1", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPR1", OBJPROP_YDISTANCE, 100+AdjustComments_UP_DOWN); 
 
         ObjectCreate("PP", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PP","P   = "+ DoubleToStr(p,Digits), fontsize, "Arial Bold", PP_color);
   ObjectSet("PP", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PP", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PP", OBJPROP_YDISTANCE, 140+AdjustComments_UP_DOWN); 
   
         ObjectCreate("PPS1", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPS1","S1 = "+ DoubleToStr(s1,Digits), fontsize, "Arial Bold", R1_color);
   ObjectSet("PPS1", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPS1", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPS1", OBJPROP_YDISTANCE, 180+AdjustComments_UP_DOWN); 
   
         ObjectCreate("PPS2", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPS2","S2 = "+ DoubleToStr(s2,Digits), fontsize, "Arial Bold", R2_color);
   ObjectSet("PPS2", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPS2", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPS2", OBJPROP_YDISTANCE, 220+AdjustComments_UP_DOWN);
    
         ObjectCreate("PPS3", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPS3","S3 = "+ DoubleToStr(s3,Digits), fontsize, "Arial Bold", R3_color);
   ObjectSet("PPS3", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPS3", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPS3", OBJPROP_YDISTANCE, 260+AdjustComments_UP_DOWN);
     
          ObjectCreate("PPM5", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPM5","M5 = "+ DoubleToStr(m5,Digits), fontsize, "Arial Bold", M5_color );
   ObjectSet("PPM5", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPM5", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPM5", OBJPROP_YDISTANCE, 40+AdjustComments_UP_DOWN); 
   
          ObjectCreate("PPM4", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPM4","M4 = "+ DoubleToStr(m4,Digits), fontsize, "Arial Bold", M4_color );
   ObjectSet("PPM4", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPM4", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPM4", OBJPROP_YDISTANCE, 80+AdjustComments_UP_DOWN); 
   
          ObjectCreate("PPM3", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPM3","M3 = "+ DoubleToStr(m3,Digits), fontsize, "Arial Bold", M3_color );
   ObjectSet("PPM3", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPM3", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPM3", OBJPROP_YDISTANCE, 120+AdjustComments_UP_DOWN); 
   
          ObjectCreate("PPM2", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPM2","M2 = "+ DoubleToStr(m2,Digits), fontsize, "Arial Bold", M2_color );
   ObjectSet("PPM2", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPM2", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPM2", OBJPROP_YDISTANCE, 160+AdjustComments_UP_DOWN); 
   
          ObjectCreate("PPM1", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPM1","M1 = "+ DoubleToStr(m1,Digits), fontsize, "Arial Bold", M1_color );
   ObjectSet("PPM1", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPM1", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPM1", OBJPROP_YDISTANCE, 200+AdjustComments_UP_DOWN); 
   
          ObjectCreate("PPM0", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("PPM0","M0 = "+ DoubleToStr(m0,Digits), fontsize, "Arial Bold", M0_color );
   ObjectSet("PPM0", OBJPROP_CORNER, Set_Comments_TopRight);
   ObjectSet("PPM0", OBJPROP_XDISTANCE, 30+AdjustComments_Sideways);
   ObjectSet("PPM0", OBJPROP_YDISTANCE, 240+AdjustComments_UP_DOWN); 
   }
//Pivot, Support & Resistance Lines


if (Draw_Main_Lines)
{
ObjectDelete("p_Line");
ObjectCreate("p_Line", OBJ_HLINE,0, CurTime(),p);
ObjectSet("p_Line",OBJPROP_COLOR,PP_color);
ObjectSet("p_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectSet("p_Line",OBJPROP_WIDTH,1);

ObjectDelete("r1_Line");
ObjectCreate("r1_Line", OBJ_HLINE,0, CurTime(),r1);
ObjectSet("r1_Line",OBJPROP_COLOR,R1_color);
ObjectSet("r1_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectSet("r1_Line",OBJPROP_WIDTH,1);

ObjectDelete("r2_Line");
ObjectCreate("r2_Line", OBJ_HLINE,0, CurTime(),r2);
ObjectSet("r2_Line",OBJPROP_COLOR,R2_color);
ObjectSet("r2_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectSet("r2_Line",OBJPROP_WIDTH,1);

ObjectDelete("r3_Line");
ObjectCreate("r3_Line", OBJ_HLINE,0, CurTime(),r3);
ObjectSet("r3_Line",OBJPROP_COLOR,R3_color);
ObjectSet("r3_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectSet("r3_Line",OBJPROP_WIDTH,1);

ObjectDelete("s1_Line");
ObjectCreate("s1_Line", OBJ_HLINE,0, CurTime(),s1);
ObjectSet("s1_Line",OBJPROP_COLOR,S1_color);
ObjectSet("s1_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectSet("s1_Line",OBJPROP_WIDTH,1);

ObjectDelete("s2_Line");
ObjectCreate("s2_Line", OBJ_HLINE,0, CurTime(),s2);
ObjectSet("s2_Line",OBJPROP_COLOR,S2_color);
ObjectSet("s2_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectSet("s2_Line",OBJPROP_WIDTH,1);

ObjectDelete("s3_Line");
ObjectCreate("s3_Line", OBJ_HLINE,0, CurTime(),s3);
ObjectSet("s3_Line",OBJPROP_COLOR,S3_color);
ObjectSet("s3_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectSet("s3_Line",OBJPROP_WIDTH,1);

// M Level Lines
if(Draw_M_Lines==true){
ObjectDelete("m5_Line");
ObjectCreate("m5_Line", OBJ_HLINE,0, CurTime(),m5);
ObjectSet("m5_Line",OBJPROP_COLOR,M5_color );
ObjectSet("m5_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectSet("m5_Line",OBJPROP_WIDTH,1);

ObjectDelete("m4_Line");
ObjectCreate("m4_Line", OBJ_HLINE,0, CurTime(),m4);
ObjectSet("m4_Line",OBJPROP_COLOR,M4_color );
ObjectSet("m4_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectSet("m4_Line",OBJPROP_WIDTH,1);

ObjectDelete("m3_Line");
ObjectCreate("m3_Line", OBJ_HLINE,0, CurTime(),m3);
ObjectSet("m3_Line",OBJPROP_COLOR,M3_color );
ObjectSet("m3_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectSet("m3_Line",OBJPROP_WIDTH,1);

ObjectDelete("m2_Line");
ObjectCreate("m2_Line", OBJ_HLINE,0, CurTime(),m2);
ObjectSet("m2_Line",OBJPROP_COLOR,M2_color );
ObjectSet("m2_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectSet("m5_Line",OBJPROP_WIDTH,1);

ObjectDelete("m1_Line");
ObjectCreate("m1_Line", OBJ_HLINE,0, CurTime(),m1);
ObjectSet("m1_Line",OBJPROP_COLOR,M1_color );
ObjectSet("m1_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectSet("m1_Line",OBJPROP_WIDTH,1);

ObjectDelete("m0_Line");
ObjectCreate("m0_Line", OBJ_HLINE,0, CurTime(),m0);
ObjectSet("m0_Line",OBJPROP_COLOR,M0_color );
ObjectSet("m0_Line",OBJPROP_STYLE,STYLE_SOLID);
ObjectSet("m0_Line",OBJPROP_WIDTH,1);
}

ObjectsRedraw();

// ---- Typing Labels ----

//R3 Label
if(ObjectFind("R3 label") != 0)
{
ObjectCreate("R3 label", OBJ_TEXT, 0, Time[3], r3);
ObjectSetText("R3 label", " R3 ", 9, "Verdana", R3_color);
}
else
{
ObjectMove("R3 label", 0, Time[3], r3);
}

//S3 Label   
if(ObjectFind("S3 label") != 0)
{
ObjectCreate("S3 label", OBJ_TEXT, 0, Time[3], s3);
ObjectSetText("S3 label", " S3 ", 9, "Verdana", S3_color);
}
else
{
ObjectMove("S3 label", 0, Time[3], s3);
}

//R2 Label 
if(ObjectFind("R2 label") != 0)
{
ObjectCreate("R2 label", OBJ_TEXT, 0, Time[3], r2);
ObjectSetText("R2 label", " R2 ", 9, "Verdana", R2_color);
}
else
{
ObjectMove("R2 label", 0, Time[3], r2);
}

//S2 Label 
if(ObjectFind("S2 label") != 0)
{
ObjectCreate("S2 label", OBJ_TEXT, 0, Time[3], s2);
ObjectSetText("S2 label", " S2 ", 9, "Verdana", S2_color);
}
else
{
ObjectMove("S2 label", 0, Time[3], s2);
}

//R1 Label
if(ObjectFind("R1 label") != 0)
{
ObjectCreate("R1 label", OBJ_TEXT, 0, Time[3], r1);
ObjectSetText("R1 label", " R1 ", 9, "Verdana", R1_color);
}
else
{
ObjectMove("R1 label", 0, Time[3], r1);
}

//S1 Label
if(ObjectFind("S1 label") != 0)
{
ObjectCreate("S1 label", OBJ_TEXT, 0, Time[3], s1);
ObjectSetText("S1 label", " S1 ", 9, "Verdana", S1_color);
}
else
{
ObjectMove("S1 label", 0, Time[3], s1);
}

//Pivot Label
if(ObjectFind("P label") != 0)
{
ObjectCreate("P label", OBJ_TEXT, 0, Time[3], p);
ObjectSetText("P label", " Pivot ", 9, "Verdana", PP_color);
}
else
{
ObjectMove("P label", 0, Time[3], p);
}

// M Level Labels 
if(Draw_M_Lines==true){
if(ObjectFind("M5 label") != 0)
{ObjectCreate("M5 label", OBJ_TEXT, 0, Time[3], m5);
ObjectSetText("M5 label", " M5 ", 9, "Verdana", M5_color);
}else{ObjectMove("M5 label", 0, Time[3], m5);} 
   
   if(ObjectFind("M4 label") != 0)
{ObjectCreate("M4 label", OBJ_TEXT, 0, Time[3], m4);
ObjectSetText("M4 label", " M4 ", 9, "Verdana", M4_color);
}else{ObjectMove("M4 label", 0, Time[3], m4);} 

   if(ObjectFind("M3 label") != 0)
{ObjectCreate("M3 label", OBJ_TEXT, 0, Time[3], m3);
ObjectSetText("M3 label", " M3 ", 9, "Verdana", M3_color);
}else{ObjectMove("M3 label", 0, Time[3], m3);} 

   if(ObjectFind("M2 label") != 0)
{ObjectCreate("M2 label", OBJ_TEXT, 0, Time[3], m2);
ObjectSetText("M2 label", " M2 ", 9, "Verdana", M2_color);
}else{ObjectMove("M2 label", 0, Time[3], m2);} 

   if(ObjectFind("M1 label") != 0)
{ObjectCreate("M1 label", OBJ_TEXT, 0, Time[3], m1);
ObjectSetText("M1 label", " M1 ", 9, "Verdana", M1_color);
}else{ObjectMove("M1 label", 0, Time[3], m1);} 

   if(ObjectFind("M0 label") != 0)
{ObjectCreate("M0 label", OBJ_TEXT, 0, Time[3], m0);
ObjectSetText("M0 label", " M0 ", 9, "Verdana", M0_color);
}else{ObjectMove("M0 label", 0, Time[3], m0);} 
}


   
}
}
   return(0);
   
  }
//Job Done
//+------------------------------------------------------------------+

Comments