Dolly Graphics_v5





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

//+------------------------------------------------------------------+
//|                                         Dolly (the famous sheep) |
//|               original indicator is called valasholic13 v2.5.mq4 |
//|                                                                  |
//|                  and the original author is valasholic@yahoo.com |
//|                                                                  |         
//|                        mods and stuff by Linuxser for Forex-TSD  |
//|                      (there is a lot of usefull code inside here)|
//|Credits: hulahula (traslation from original indonesian language)  |
//|ign... in collaboration with Linuxser (with mods and improvments  |
//+------------------------------------------------------------------+

/*
Changelog v0.4.1:
   - Modifications over the pivot points drawing: I think now is better
     and more clean code in that section. With this mod, also the
     pivots, supports and resistances are only calculated if and only
     if the flag pivotlines is set true.
     Other modifications here are about the object creation. With this
     improve the objects are created at init time and isn't necessary
     to create them at any time.
   - User experience: this is a conflictive point... I've modified some
     graphics issues to get a more readeable indicator.
       * "Unions" between zones of diferent days.
       * Realistic font size.
   - Corrections in the source coude... now it's a little more beauty (sorry for
     the little spanish comments)     
     
Changelog v0.4.2:
   - Comments modified (linuxser)
   - Added buy/sell zones just like the WSS indicator. (ign...)
   - Added a parameter to back to old style (without zones... ) Note: when
     the parameter ShowZones is off (false), then the objects are deleted to
     'improve' speed :) (ign...)
   - More improvements on PivotPoints add-on (object creation). (ign...)
   

Dolly Graphics 4: by cja
   - Comments restored to original figures but different layout, kept simple thanks to FxNorth for advise
   - Graphics code cleaned up now can be run on any colour background
   - Pivot points altered to short LINES and Labels can be shifted and LINES extended
   - Pivot M Levels added and Labels can be shifted and LINES extended
   - Dolly Sell Buy Target Labels can be shifted
   - Daily Average Range added above & below Dolly Levels and DAR Labels can be shifted 
Dolly Graphics 5   
   - Dolly coloured panels & Daily Average Range can now be either panels or lines or a combo of both 
   - Daily Average Panels can now be turned on/off  
   - Dolly trading Comments reset to original layout with larger type & can now be turned on/off
   - Pivot points and M pivot levels can now be selected individually
   - Added in Back TEST simply set to # of days and scroll back to the 1st graphic in the line
   
*/
#property copyright ""
#property link      " Dolly Graphics cja"
#property indicator_chart_window

extern bool Dolly_GRAPHICS = true;
extern bool Daily_AverageGRAPHICS = true;
extern bool Show_DailyAverageGRAPHICS = true;
extern bool Show_DollyTEXT = true;
extern bool Show_PivotLines = false;
extern bool Show_M_PivotLines = false;


extern int SHIFT_DollyText = 0;
extern int SHIFT_DailyAverageText = 27;
extern int SHIFT_PivotPointText = 0;
extern int SHIFT_M_PivotText = 0;
extern int PivotPoint_ExtendLINE = 0;
extern int M_Pivot_ExtendLINE = 0;
extern int Back_TEST = 0;


#define DollyBUY3 "DollyBUY3"
#define DollyBUY2 "DollyBUY2"
#define DollyBUY1 "DollyBUY1"
#define DollySELL1 "DollySELL1"
#define DollySELL2 "DollySELL2"
#define DollySELL3 "DollySELL3"

#define AvBUY150 "AvBUY150"
#define AvBUY125 "AvBUY125"
#define AvBUY100 "AvBUY100"
#define AvBUY75 "AvBUY75"
#define AvSELL75 "AvSELL75"
#define AvSELL100 "AvSELL100"
#define AvSELL125 "AvSELL125"
#define AvSELL150 "AvSELL150"

#define P1 "P1"

#define PP1 "PP1"
#define RR3 "RR3"
#define RR2 "RR2"
#define RR1 "RR1"
#define SS1 "SS1"
#define SS2 "SS2"
#define SS3 "SS3"

#define MM1 "MM1"
#define MM2 "MM2"
#define MM3 "MM3"
#define MM4 "MM4"
#define MM5 "MM5"
#define MM0 "MM0"

#define IND_NAME "Dolly Graphics #5"
#define LEVEL_1 20
#define LEVEL_2 40
#define LEVEL_3 55



/*#property indicator_buffers 7
#property indicator_color1  Snow
#property indicator_width1 1
#property indicator_color2  Red
#property indicator_width2 2
#property indicator_color3  Blue
#property indicator_width3 2
#property indicator_color4  Orange
#property indicator_width4 2
#property indicator_color5  SteelBlue
#property indicator_width5 2
#property indicator_color6  Yellow
#property indicator_width6 1
#property indicator_color7  Aqua
#property indicator_width7 1*/
//---- input parameters

//---- buffers
double PBuffer[];
double S1Buffer[];
double B1Buffer[];
double S2Buffer[];
double B2Buffer[];
double S3Buffer[];
double B3Buffer[];

double P, S1, B1, S2, B2, S3, B3;
double LastHigh, LastLow, x;
double D4=0.55;

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
   
   ObjectsDeleteAll(0,OBJ_TEXT);
   ObjectsDeleteAll(0,OBJ_RECTANGLE);
   ObjectsDeleteAll(0,OBJ_TRENDBYANGLE);
   ObjectDelete("string");
   
    
   ObjectDelete(DollyBUY3);
   ObjectDelete(DollyBUY2);
   ObjectDelete(DollyBUY1);
   ObjectDelete(DollySELL1);
   ObjectDelete(DollySELL2);
   ObjectDelete(DollySELL3);
   
   
   ObjectDelete (AvBUY150); 
   ObjectDelete (AvBUY125); 
   ObjectDelete (AvBUY100);
   ObjectDelete (AvBUY75); 
   ObjectDelete (AvSELL75); 
   ObjectDelete (AvSELL100); 
   ObjectDelete (AvSELL125); 
   ObjectDelete (AvSELL150); 
   
    ObjectDelete(P1);
      
   ObjectDelete(PP1);
   ObjectDelete(RR3);
   ObjectDelete(RR2);
   ObjectDelete(RR1);
   ObjectDelete(SS1);
   ObjectDelete(SS2);
   ObjectDelete(SS3);
   ObjectDelete(MM1);
   ObjectDelete(MM2);
   ObjectDelete(MM3);
   ObjectDelete(MM4);
   ObjectDelete(MM5);
   ObjectDelete(MM0);
   
   ObjectDelete("Dolly");
   ObjectDelete("Dolly1");ObjectDelete("Dolly2");ObjectDelete("Dolly3");ObjectDelete("Dolly4");
   ObjectDelete("Dolly5");ObjectDelete("Dolly6");ObjectDelete("Dolly7");ObjectDelete("Dolly8");
   ObjectDelete("Dolly9");ObjectDelete("Dolly10");ObjectDelete("Dolly11");ObjectDelete("Dolly12");
   ObjectDelete("Dolly13");ObjectDelete("Dolly14");ObjectDelete("Dolly15");ObjectDelete("Dolly16");
   ObjectDelete("Dolly17");ObjectDelete("Dolly18");ObjectDelete("Dolly19");ObjectDelete("Dolly20");
   ObjectDelete("Dolly21");ObjectDelete("Dolly22");ObjectDelete("Dolly23");ObjectDelete("Dolly24");
   ObjectDelete("Dolly25");ObjectDelete("Dolly26");ObjectDelete("Dolly27");ObjectDelete("Dolly28");
   ObjectDelete("Dolly29");ObjectDelete("Dolly30");ObjectDelete("Dolly31");ObjectDelete("Dolly32");
   ObjectDelete("Dolly33");ObjectDelete("Dolly34");ObjectDelete("Dolly35");ObjectDelete("Dolly36");
   ObjectDelete("Dolly37");ObjectDelete("Dolly38");ObjectDelete("Dolly39");ObjectDelete("Dolly40");
   ObjectDelete("Dolly41");ObjectDelete("Dolly42");ObjectDelete("Dolly43");ObjectDelete("Dolly44");
   ObjectDelete("Dolly45");ObjectDelete("Dolly46");ObjectDelete("Dolly47");ObjectDelete("Dolly48");
   ObjectDelete("Dolly49");

  	deinit_pivots();

	//----
	return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   //---- indicator line
	SetIndexStyle(0, DRAW_NONE);
	SetIndexStyle(1, DRAW_NONE);
	SetIndexStyle(2, DRAW_NONE);
	SetIndexStyle(3, DRAW_NONE);
	SetIndexStyle(4, DRAW_NONE);
	SetIndexStyle(5, DRAW_NONE);
	SetIndexStyle(6, DRAW_NONE);
	SetIndexBuffer(0, PBuffer);
	SetIndexBuffer(1, S1Buffer);
	SetIndexBuffer(2, B1Buffer);
	SetIndexBuffer(3, S2Buffer);
	SetIndexBuffer(4, B2Buffer);
	SetIndexBuffer(5, S3Buffer);
	SetIndexBuffer(6, B3Buffer);
	//---- name for DataWindow and indicator subwindow label
	IndicatorShortName(IND_NAME);
	
	//----
	SetIndexDrawBegin(0,1);
	IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));

   if(Show_PivotLines)
      init_pivots();
      
  	//----
	return(0);
}

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

{  
CreateDL();
}

void CreateObj(string objName, double start, double end, color clr)
  {
   ObjectCreate(objName, OBJ_RECTANGLE, 0, iTime(NULL,1440,Back_TEST), start, Time[0], end);
   ObjectSet(objName, OBJPROP_COLOR, clr);
   ObjectSet(objName,OBJPROP_BACK,Dolly_GRAPHICS);
   ObjectSet(objName,OBJPROP_WIDTH,0);
   ObjectSet(objName,OBJPROP_STYLE,0);
   }
   void DeleteObjects()
   {
   ObjectDelete(DollyBUY3);
   ObjectDelete(DollyBUY2);
   ObjectDelete(DollyBUY1);
   ObjectDelete(DollySELL1);
   ObjectDelete(DollySELL2);
   ObjectDelete(DollySELL3);
       
   }
   void CreateDL()
   {
   ObjectsDeleteAll(0,OBJ_RECTANGLE);
   DeleteObjects();
   
    CreateAL();
}

void CreateObj1(string objName1, double start, double end, color clr)
  {
   ObjectCreate(objName1, OBJ_RECTANGLE, 0, iTime(NULL,1440,Back_TEST), start, Time[0], end);
   ObjectSet(objName1, OBJPROP_COLOR, clr);
   ObjectSet(objName1,OBJPROP_BACK,Daily_AverageGRAPHICS);
   ObjectSet(objName1,OBJPROP_WIDTH,0);
   ObjectSet(objName1,OBJPROP_STYLE,0);
   }
   ObjectDelete (AvBUY150); 
   ObjectDelete (AvBUY125); 
   ObjectDelete (AvBUY100);
   ObjectDelete (AvBUY75); 
   ObjectDelete (AvSELL75); 
   ObjectDelete (AvSELL100); 
   ObjectDelete (AvSELL125); 
   ObjectDelete (AvSELL150); 
   
 
   void CreateAL()
   {
   ObjectsDeleteAll(0,OBJ_RECTANGLE);
   DeleteObjects();
   
   
    CreatePP();
}
void CreateObj2(string objName2, double start, double end, color clr)
  {
   ObjectCreate(objName2, OBJ_TRENDBYANGLE, 0, iTime(NULL,1440,PivotPoint_ExtendLINE), start, Time[0], end);
   ObjectSet(objName2, OBJPROP_COLOR, clr);
   ObjectSet(objName2,OBJPROP_RAY,false);
   ObjectSet(objName2,OBJPROP_WIDTH,1);
   ObjectSet(objName2,OBJPROP_STYLE,0);
   }
   ObjectDelete(PP1);
   ObjectDelete(RR3);
   ObjectDelete(RR2);
   ObjectDelete(RR1);
   ObjectDelete(SS1);
   ObjectDelete(SS2);
   ObjectDelete(SS3);
  
   
   
   void CreatePP()
   {
    ObjectsDeleteAll(0,OBJ_TRENDBYANGLE);
    DeleteObjects();

     CreatePIVOT();
}
void CreateObj3(string objName3, double start, double end, color clr)
  {
   ObjectCreate(objName3, OBJ_TRENDBYANGLE, 0, iTime(NULL,1440,PivotPoint_ExtendLINE ), start, Time[0], end);
   ObjectSet(objName3, OBJPROP_COLOR, clr);
   ObjectSet(objName3,OBJPROP_RAY,false);
   ObjectSet(objName3,OBJPROP_WIDTH,2);
   }
   ObjectDelete(P1);
      
   void CreatePIVOT()
   {
    ObjectsDeleteAll(0,OBJ_TRENDBYANGLE);
    DeleteObjects();

  
  CreateMM();
}
void CreateObj4(string objName4, double start, double end, color clr)
  {
   ObjectCreate(objName4, OBJ_TRENDBYANGLE, 0, iTime(NULL,1440,M_Pivot_ExtendLINE), start, Time[0], end);
   ObjectSet(objName4, OBJPROP_COLOR, clr);
   ObjectSet(objName4,OBJPROP_RAY,false);
   ObjectSet(objName4,OBJPROP_WIDTH,1);
    ObjectSet(objName4,OBJPROP_STYLE,2);
   }
   ObjectDelete(MM1);
   ObjectDelete(MM2);
   ObjectDelete(MM3);
   ObjectDelete(MM4);
   ObjectDelete(MM5);
   ObjectDelete(MM0);
      
   void CreateMM()
   {
    ObjectsDeleteAll(0,OBJ_TRENDBYANGLE);
     DeleteObjects();

  double P = (iHigh(NULL,1440,Back_TEST+1) + iLow(NULL,1440,Back_TEST+1) + iClose(NULL,1440,Back_TEST+1)) / 3; 
  double OPEN = iOpen(NULL,1440,0); 
  double HI2 = iHigh(NULL,1440,0);
  double LOW2 = iLow(NULL,1440,0); 
  double HI3 = iHigh(NULL,1440,1);
  double LOW3 = iLow(NULL,1440,1);
  double HI4 = iHigh(NULL,1440,0);
  double LOW4 = iLow(NULL,1440,0);
  double HI5 = iHigh(NULL,1440,2);
  double LOW5 = iLow(NULL,1440,2);
  double HI6 = iHigh(NULL,1440,3);
  double LOW6 = iLow(NULL,1440,3);
  double HI7 = iHigh(NULL,1440,4);
  double LOW7 = iLow(NULL,1440,4);
  double HI8 = iHigh(NULL,1440,5);
  double LOW8 = iLow(NULL,1440,5);
  double HI9 = iHigh(NULL,1440,6);
  double LOW9 = iLow(NULL,1440,6);
  double HI10 = iHigh(NULL,1440,7);
  double LOW10 = iLow(NULL,1440,7);
  double HI11 = iHigh(NULL,1440,8);
  double LOW11 = iLow(NULL,1440,8);
  double HI12 = iHigh(NULL,1440,9);
  double LOW12 = iLow(NULL,1440,9);
  double HI13 = iHigh(NULL,1440,10);
  double LOW13 = iLow(NULL,1440,10);
  double HI14 = iHigh(NULL,1440,11);
  double LOW14 = iLow(NULL,1440,11);
  double HI15 = iHigh(NULL,1440,12);
  double LOW15 = iLow(NULL,1440,12);
  double HI16 = iHigh(NULL,1440,13);
  double LOW16 = iLow(NULL,1440,13);
  double HI17 = iHigh(NULL,1440,14);
  double LOW17 = iLow(NULL,1440,14);
  double HI18 = iHigh(NULL,1440,15);
  double LOW18 = iLow(NULL,1440,15);
  double HI19 = iHigh(NULL,1440,16);
  double LOW19 = iLow(NULL,1440,16);
  double HI20 = iHigh(NULL,1440,17);
  double LOW20 = iLow(NULL,1440,17);
  double HI21 = iHigh(NULL,1440,18);
  double LOW21 = iLow(NULL,1440,18);
  double HI22 = iHigh(NULL,1440,19);
  double LOW22 = iLow(NULL,1440,19);
  double HI23 = iHigh(NULL,1440,20);
  double LOW23 = iLow(NULL,1440,20);
    
  double ONE = (HI3-LOW3);
  
  double FIVE = ((HI3-LOW3)+(HI5-LOW5)+(HI6-LOW6)+(HI7-LOW7)+(HI8-LOW8))/5;
           
  double TEN = ((HI3-LOW3)+(HI5-LOW5)+(HI6-LOW6)+(HI7-LOW7)+(HI8-LOW8)+
                  (HI9-LOW9)+(HI10-LOW10)+(HI11-LOW11)+(HI12-LOW12)+(HI13-LOW13))/10;
                    
  double TWENTY = ((HI3-LOW3)+(HI5-LOW5)+(HI6-LOW6)+(HI7-LOW7)+(HI8-LOW8)+
               (HI9-LOW9)+(HI10-LOW10)+(HI11-LOW11)+(HI12-LOW12)+(HI13-LOW13)+
               (HI14-LOW14)+(HI15-LOW15)+(HI16-LOW16)+(HI17-LOW17)+(HI18-LOW18)+
               (HI19-LOW19)+(HI20-LOW20)+(HI21-LOW21)+(HI22-LOW22)+(HI23-LOW23))/20; 
                                              
  double AV = (ONE+FIVE+TEN+TWENTY)/4;// New Setting AV = (FIVE+TEN+TWENTY)/3;
  
  double DOLLYBUY3 = B3; 
  double DOLLYBUY2 = B2; 
  double DOLLYBUY1 = B1; 
  double DOLLYSELL1 = S1; 
  double DOLLYSELL2 = S2; 
  double DOLLYSELL3 = S3;
  
  double AvDN150 = P-AV/2*3;
  double AvUP150 = P+AV/2*3;
  double AvDN125 = P-AV/4*5;
  double AvUP125 = P+AV/4*5;
  double AvDN100 =P-AV; 
  double AvUP100 = P+AV;
  double AvDN75 =P-AV/4*3; 
  double AvUP75 = P+AV/4*3;  
  double AvDN50 = P-AV/2;
  double AvUP50 = P+AV/2;
  double AvDN25 =P-AV/4; 
  double AvUP25 = P+AV/4; 
  
   double CLOSE = iClose(NULL,1440,0); 
  	
   
//Buy	  
     if(ObjectFind("B1") != 0)
{
ObjectCreate("B1", OBJ_TEXT, 0, Time[SHIFT_DollyText], DOLLYBUY1);
ObjectSetText("B1", "                        BUY AREA", 8, "Arial",DodgerBlue);
}
else
{
ObjectMove("B1", 0, Time[SHIFT_DollyText], DOLLYBUY1);
}
     if(ObjectFind("B2") != 0)
{
ObjectCreate("B2", OBJ_TEXT, 0, Time[SHIFT_DollyText], DOLLYBUY2);
ObjectSetText("B2", "                                   1st BUY TARGET ", 8, "Arial",DodgerBlue);
}
else
{
ObjectMove("B2", 0, Time[SHIFT_DollyText],DOLLYBUY2);
}	
     if(ObjectFind("B3") != 0)

{
ObjectCreate("B3", OBJ_TEXT, 0, Time[SHIFT_DollyText], DOLLYBUY3);
ObjectSetText("B3", "                             2nd TARGET ", 8, "Arial",DodgerBlue);
}
else
{
ObjectMove("B3", 0, Time[SHIFT_DollyText], DOLLYBUY3);
}
//Sell
     if(ObjectFind("S1") != 0)
{
ObjectCreate("S1", OBJ_TEXT, 0, Time[SHIFT_DollyText],DOLLYSELL1);
ObjectSetText("S1", "                         SELL AREA", 8, "Arial", Orange);
}
else
{
ObjectMove("S1", 0, Time[SHIFT_DollyText], DOLLYSELL1);
}
     if(ObjectFind("S2") != 0)
{
ObjectCreate("S2", OBJ_TEXT, 0, Time[SHIFT_DollyText], DOLLYSELL2);
ObjectSetText("S2", "                                   1st SELL TARGET ", 8, "Arial",Orange);
}
else
{
ObjectMove("S2", 0, Time[SHIFT_DollyText], DOLLYSELL2);
}
     if(ObjectFind("S3") != 0)
{
ObjectCreate("S3", OBJ_TEXT, 0, Time[SHIFT_DollyText], DOLLYSELL3);
ObjectSetText("S3", "                             2nd TARGET ", 8, "Arial",Orange);
}
else
{
ObjectMove("S3", 0, Time[SHIFT_DollyText], DOLLYSELL3);
}

	 	
//Pivot
     if(ObjectFind("Pivot") != 0)
{
ObjectCreate("Pivot", OBJ_TEXT, 0, Time[SHIFT_DollyText], P);
ObjectSetText("Pivot", "                             PIVOT "+ DoubleToStr(P,Digits)+"", 8, "Arial",Silver);
}
else
{
ObjectMove("Pivot", 0, Time[SHIFT_DollyText], P);
}

//Average Levels

   if(ObjectFind("TOP/AV150") != 0)
{
ObjectCreate("TOP/AV150", OBJ_TEXT, 0, Time[SHIFT_DailyAverageText], AvUP150);
ObjectSetText("TOP/AV150", "                                    150% ", 8, "Arial", DeepSkyBlue);
}
else
{
ObjectMove("TOP/AV150", 0, Time[SHIFT_DailyAverageText], AvUP150);
}

     if(ObjectFind("LOW/AV150") != 0)
{
ObjectCreate("LOW/AV150", OBJ_TEXT, 0, Time[SHIFT_DailyAverageText], AvDN150);
ObjectSetText("LOW/AV150", "                                    150% ", 8, "Arial", Yellow);
}
else
{
ObjectMove("LOW/AV150", 0, Time[27], AvDN150);
} 

   if(ObjectFind("TOP/AV125") != 0)
{
ObjectCreate("TOP/AV125", OBJ_TEXT, 0, Time[SHIFT_DailyAverageText], AvUP125);
ObjectSetText("TOP/AV125", "                                    125% ", 8, "Arial", DeepSkyBlue);
}
else
{
ObjectMove("TOP/AV125", 0, Time[SHIFT_DailyAverageText], AvUP125);
}

     if(ObjectFind("LOW/AV125") != 0)
{
ObjectCreate("LOW/AV125", OBJ_TEXT, 0, Time[SHIFT_DailyAverageText], AvDN125);
ObjectSetText("LOW/AV125", "                                    125% ", 8, "Arial", Yellow);
}
else
{
ObjectMove("LOW/AV125", 0, Time[27], AvDN125);
} 

     if(ObjectFind("TOP/AV100") != 0)
{
ObjectCreate("TOP/AV100", OBJ_TEXT, 0, Time[SHIFT_DailyAverageText], AvUP100);
ObjectSetText("TOP/AV100", "                                   100%", 8, "Arial", DeepSkyBlue);
}
else
{
ObjectMove("TOP/AV100", 0, Time[SHIFT_DailyAverageText], AvUP100);
} 
  
     if(ObjectFind("LOW/AV100") != 0)
{
ObjectCreate("LOW/AV100", OBJ_TEXT, 0, Time[SHIFT_DailyAverageText], AvDN100);
ObjectSetText("LOW/AV100", "                                    100% ", 8, "Arial", Yellow);
}
else
{
ObjectMove("LOW/AV100", 0, Time[SHIFT_DailyAverageText], AvDN100);
} 
     if(ObjectFind("TOP/AV75") != 0)
{
ObjectCreate("TOP/AV75", OBJ_TEXT, 0, Time[SHIFT_DailyAverageText], AvUP75);
ObjectSetText("TOP/AV75", "                                      75% ", 8, "Arial", DeepSkyBlue);
}
else
{
ObjectMove("TOP/AV75", 0, Time[SHIFT_DailyAverageText], AvUP75);
}

     if(ObjectFind("LOW/AV75") != 0)
{
ObjectCreate("LOW/AV75", OBJ_TEXT, 0, Time[SHIFT_DailyAverageText], AvDN75);
ObjectSetText("LOW/AV75", "                                     75%", 8, "Arial", Yellow);
} 
else
{
ObjectMove("LOW/AV75", 0, Time[SHIFT_DailyAverageText], AvDN75);
} 	

  
   if(ObjectFind("LOW/AV50") != 0)
{
ObjectCreate("LOW/AV50", OBJ_TEXT, 0, Time[SHIFT_DailyAverageText], AvUP50);
ObjectSetText("LOW/AV50", "                                       50% ", 8, "Arial",DeepSkyBlue );
}
else
{
ObjectMove("LOW/AV50", 0, Time[SHIFT_DailyAverageText], AvUP50);
} 

     if(ObjectFind("TOP/AV50") != 0)
{
ObjectCreate("TOP/AV50", OBJ_TEXT, 0, Time[SHIFT_DailyAverageText], AvDN50);
ObjectSetText("TOP/AV50", "                                      50% ", 8, "Arial",Yellow );
} 
else
{
ObjectMove("TOP/AV50", 0, Time[SHIFT_DailyAverageText], AvDN50);
} 

     if(ObjectFind("TOP/AV25") != 0)
{
ObjectCreate("TOP/AV25", OBJ_TEXT, 0, Time[SHIFT_DailyAverageText], AvUP25);
ObjectSetText("TOP/AV25", "                                      25% ", 8, "Arial", DeepSkyBlue);
}
else
{
ObjectMove("TOP/AV25", 0, Time[SHIFT_DailyAverageText], AvUP25);
}

     if(ObjectFind("LOW/AV25") != 0)
{
ObjectCreate("LOW/AV25", OBJ_TEXT, 0, Time[SHIFT_DailyAverageText], AvDN25);
ObjectSetText("LOW/AV25", "                                     25%", 8, "Arial", Yellow);
}
else
{
ObjectMove("LOW/AV25", 0, Time[SHIFT_DailyAverageText], AvDN25);
} 

   
    
 ObjectsRedraw();
 
   // Dolly Colored Levels
   CreateObj(DollyBUY3, DOLLYBUY3, DOLLYBUY3, C'0,0,210' );
   CreateObj(DollyBUY2, DOLLYBUY3, DOLLYBUY2,C'0,0,150');
   CreateObj(DollyBUY1, DOLLYBUY2, DOLLYBUY1, C'0,0,100');
   CreateObj(DollySELL1, DOLLYSELL1, DOLLYSELL2, C'120,0,0');
   CreateObj(DollySELL2, DOLLYSELL2, DOLLYSELL3, C'180,0,0');
   CreateObj(DollySELL3, DOLLYSELL3, DOLLYSELL3, C'230,0,0');
   
   
    if (Show_DailyAverageGRAPHICS==true)
    {
   //Daily Average Colored Levels
   CreateObj1(AvBUY150 ,AvUP150,AvUP125, C'0,110,255');
   CreateObj1(AvBUY125 ,AvUP125,AvUP100, C'0,70,255');
   CreateObj1(AvBUY100 ,AvUP100,AvUP75,C'20,20,255');
   CreateObj1(AvBUY75,AvUP75,DOLLYBUY3, C'0,0,210');
   CreateObj1(AvSELL75,AvDN75,DOLLYSELL3, C'220,0,0');
   CreateObj1(AvSELL100,AvDN100,AvDN75, C'255,0,0');
   CreateObj1(AvSELL125,AvDN100,AvDN125,C'255,70,0');//C'255,70,70'
   CreateObj1(AvSELL150,AvDN125,AvDN150, C'255,110,0');//
  }
   
   CreateObj3(P1,P,P, DimGray);
  
   
  

	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]))
		{
		   PBuffer[i+1] = EMPTY_VALUE; // Changes line from continuous to short separate lines
		   S1Buffer[i+1] = EMPTY_VALUE;
		   B1Buffer[i+1] = EMPTY_VALUE;
		   S2Buffer[i+1] = EMPTY_VALUE;
		   B2Buffer[i+1] = EMPTY_VALUE;
		   S3Buffer[i+1] = EMPTY_VALUE;
		   B3Buffer[i+1] = EMPTY_VALUE;
			//////////// Logic for determine Momentum Break \\\\\\\\\\\\\\\\\\\\\

			P = (iHigh(NULL,1440,Back_TEST+1) + iLow(NULL,1440,Back_TEST+1) + iClose(NULL,1440,Back_TEST+1)) / 3;  // Logic for determinating pivot
			B1 = P + LEVEL_1 * Point; // Logic to determine Buy Area 
			S1 = P - LEVEL_1 * Point; // Logic to determine Sell Area 
			B2 = P + LEVEL_2 * Point; // Logic to determine High Break Area 
			S2 = P - LEVEL_2 * Point; // Logic to determine Low Break Area )
			B3 = P + LEVEL_3 * Point; // Logic to determine High Target Area 
			S3 = P - LEVEL_3 * Point; // Logic to determine Low Target Area 
			
			LastLow = Open[i]; 
			LastHigh = Open[i];
		}
		PBuffer[i] = P;
		S1Buffer[i] = S1;
		B1Buffer[i] = B1;
		S2Buffer[i] = S2;
		B2Buffer[i] = B2;
		S3Buffer[i] = S3;
		B3Buffer[i] = B3;



		if (Show_PivotLines==true)
		{
		    double rates[1][6],yesterday_close,yesterday_high,yesterday_low;
		    ArrayCopyRates(rates, Symbol(), PERIOD_D1);

		    if(DayOfWeek() == 1)
		    {
			    if(TimeDayOfWeek(iTime(Symbol(),PERIOD_D1,1)) == 5)
			    {
				    yesterday_close = rates[1][4];
				    yesterday_high = rates[1][3];
				    yesterday_low = rates[1][2];
			    }
			    else
			    {
				    for(int d = 5;d>=0;d--)
				    {
					    if(TimeDayOfWeek(iTime(Symbol(),PERIOD_D1,d)) == 5)
					    {
						    yesterday_close = rates[d][4];
						    yesterday_high = rates[d][3];
						    yesterday_low = rates[d][2];
						    break;
					    }
				    }  
			    }
		    }
		    else
		    {
			    yesterday_close = rates[1][4];
			    yesterday_high = rates[1][3];
			    yesterday_low = rates[1][2];
		    }
			//---- 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 ));
			double r2 = p + ( yesterday_high - yesterday_low );
			double r1 = ( 2 * p ) - yesterday_low;
			double s1 = ( 2 * p ) - yesterday_high;
			double s2 = p - ( yesterday_high - yesterday_low );
			double s3 = ( 2 * p ) - ( ( 2 * yesterday_high ) - yesterday_low );
			
				
			double m1 = ((2*p)-yesterday_high + p-(yesterday_high - yesterday_low))/2;
			double m2 = (p + (2*p)-yesterday_high)/2;
			double m3 = (p + (2*p)-yesterday_low)/2;
			double m4 = ((2*p)-yesterday_low + p+(yesterday_high - yesterday_low))/2; 
			double m5 = ((2*p)+(yesterday_high-(2*yesterday_low))+p+(yesterday_high - yesterday_low))/2; 
			double m0 = (p-(yesterday_high - yesterday_low)+(2*p)-((2* yesterday_high)-yesterday_low))/2; 

         if(ObjectFind("p_Line") == -1)
            init_pivots();
          set_pivots(p, r1, r2, r3, s1, s2, s3, m1, m2, m3, m4, m5, m0);
	
          CreateObj2(RR3,r3,r3, DimGray);
          CreateObj2(RR2,r2,r2, DimGray);
          CreateObj2(RR1,r1,r1, DimGray);
          CreateObj2(SS3,s3,s3, DimGray);
          CreateObj2(SS2,s2,s2, DimGray);
          CreateObj2(SS1,s1,s1, DimGray);
          }
          CreateObj2(PP1,p,p, DimGray);
         if (Show_M_PivotLines==true) 
         {
          CreateObj4(MM1,m1,m1, DimGray);
          CreateObj4(MM2,m2,m2, DimGray);
          CreateObj4(MM3,m3,m3, DimGray);
          CreateObj4(MM4,m4,m4, DimGray);
          CreateObj4(MM5,m5,m5, DimGray);
          CreateObj4(MM0,m0,m0, DimGray);
          
        	}  
					
	 string  NAME,BUYSTOP,BUYSTOP1,STOP,STOP1,PROFIT,PROFIT1,SELL,SELL1,STOP2,STOP3,PROFIT2,
	         PROFIT3,BUYTARGT,PROFIT4,SELLTARGT,PROFIT5,OPEN1,DAR,TOTAL,TDR,LDR,TIME, 
	         TIME2,PRICE,TDR1,LDR1,STOP4,STOP5 ; 
	
	 if (Show_DollyTEXT==true)
	 {        
	NAME = IND_NAME;			
	BUYSTOP = (DoubleToStr (B1,Digits));
	BUYSTOP1 = (DoubleToStr(B2,Digits));
	STOP = (DoubleToStr (S1,Digits));
	STOP1 = (DoubleToStr(B1,Digits));
	PROFIT = (DoubleToStr ((B2),Digits));
	PROFIT1 = (DoubleToStr ((B2+(10*Point)),Digits)); 
	SELL = (DoubleToStr (S1,Digits));
	SELL1 = (DoubleToStr (S2,Digits)); 
	STOP2 = (DoubleToStr (B1,Digits));
	STOP3 = (DoubleToStr(S1,Digits));
	PROFIT2 = (DoubleToStr ((S2),Digits));
	PROFIT3 = (DoubleToStr ((S2-(10*Point)),Digits));
	BUYTARGT = (DoubleToStr(S2,Digits));
	PROFIT4 = (DoubleToStr(B1,Digits));
	STOP4 = (DoubleToStr(S3,Digits));
	SELLTARGT = (DoubleToStr(B2,Digits));
	PROFIT5 = (DoubleToStr(S1,Digits));
	STOP5 = (DoubleToStr(B3,Digits));
	OPEN1 = (DoubleToStr(OPEN,Digits));
	DAR = (DoubleToStr(AV/Point,0));
	TOTAL = (DoubleToStr(HI2-LOW2,Digits));
	TDR = (DoubleToStr(P+AV,Digits));
	LDR = (DoubleToStr(P-AV,Digits));
	TDR1 = (DoubleToStr(P+AV/2,Digits));
	LDR1 = (DoubleToStr(P-AV/2,Digits));
	TIME = (TimeToStr(LocalTime(),Digits-6));
	TIME2 = (TimeToStr(CurTime(),Digits-6));
	PRICE = (DoubleToStr(iMA(Symbol(),0,1,0,MODE_EMA,PRICE_CLOSE,0),Digits));//iMA(Symbol(),0,1,0,MODE_EMA,PRICE_CLOSE,0);        
   

   ObjectDelete("Dolly");
   Dolly( "Dolly", 22, 12,4);
   ObjectSetText( "Dolly"," "+ NAME +"", 11, "Arial", Yellow );
   
   ObjectDelete("Dolly1");
   Dolly1( "Dolly1", 35, 12,4);
   ObjectSetText( "Dolly1", ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"  , 8, "Arial", White );
   
   				
	ObjectDelete("Dolly2");
   Dolly2( "Dolly2", 50, 12,4);
   ObjectSetText( "Dolly2", "BUY ZONE", 9, "Arial", DeepSkyBlue );
   ObjectDelete("Dolly3");
   Dolly3( "Dolly3", 60, 12,4);
   ObjectSetText( "Dolly3",",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", 8, "Arial", White );
   
   ObjectDelete("Dolly4");
   Dolly4( "Dolly4", 75, 12,4);
   ObjectSetText( "Dolly4", "BUY STOP-1  "+Symbol()+ "  @ ", 9, "Arial", DodgerBlue );
   ObjectDelete("Dolly5");
   Dolly5( "Dolly5", 75, 12,4);
   ObjectSetText( "Dolly5"," "+ BUYSTOP +"", 9, "Arial", DarkOrange );
   
    ObjectDelete("Dolly6");
   Dolly6( "Dolly6", 90, 12,4);
   ObjectSetText( "Dolly6", "TP               and SL @    ", 9, "Arial", DodgerBlue);
   ObjectDelete("Dolly7");
   Dolly7( "Dolly7", 90, 12,4);
   ObjectSetText( "Dolly7"," "+ BUYSTOP1 +"", 9, "Arial", YellowGreen);
   ObjectDelete("Dolly8");
   Dolly8( "Dolly8", 90, 12,4);
   ObjectSetText( "Dolly8"," "+ STOP +"", 9, "Arial", Yellow );
   
       ObjectDelete("Dolly9");
   Dolly9( "Dolly9", 110, 12,4);
   ObjectSetText( "Dolly9", "BUY STOP-2  "+Symbol()+ "  @ ",9, "Arial", LightBlue );
   ObjectDelete("Dolly10");
   Dolly10( "Dolly10", 110, 12,4);
   ObjectSetText( "Dolly10"," "+ BUYSTOP1 +"", 9, "Arial", DarkOrange );
   
         ObjectDelete("Dolly11");
   Dolly11( "Dolly11", 125, 12,4);
   ObjectSetText( "Dolly11",  "TP               and SL @    ", 9, "Arial", LightBlue);
   ObjectDelete("Dolly12");
   Dolly12( "Dolly12", 125, 12,4);
   ObjectSetText( "Dolly12"," "+ PROFIT1 +"", 9, "Arial", YellowGreen );
   
        ObjectDelete("Dolly13");
   Dolly13( "Dolly13", 125, 12,4);
   ObjectSetText( "Dolly13", ""+ STOP1 +""  , 9, "Arial", Yellow );
  
   
    ObjectDelete("Dolly14");
   Dolly14( "Dolly14", 140, 12,4);
   ObjectSetText( "Dolly14", ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"  , 8, "Arial", White );
   
         ObjectDelete("Dolly15");
   Dolly15( "Dolly15", 155, 12,4);
   ObjectSetText( "Dolly15", "SELL ZONE"  , 9, "Arial", Orange );
   
   ObjectDelete("Dolly16");
   Dolly16( "Dolly16", 165, 12,4);
   ObjectSetText( "Dolly16", ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"  , 8, "Arial", White );
   
    
       ObjectDelete("Dolly17");
   Dolly17( "Dolly17", 180, 12,4);
   ObjectSetText( "Dolly17", "SELL STOP-1  "+Symbol()+ "  to ", 9, "Arial", OrangeRed );
   ObjectDelete("Dolly18");
   Dolly18( "Dolly18", 180, 12,4);
   ObjectSetText( "Dolly18"," "+ SELL +"", 9, "Arial",DarkOrange);
   
     
          ObjectDelete("Dolly19");
   Dolly19( "Dolly19", 195, 12,4);
   ObjectSetText( "Dolly19",  "TP               and SL @    ", 9, "Arial", OrangeRed );
   ObjectDelete("Dolly20");
   Dolly20( "Dolly20", 195, 12,4);
   ObjectSetText( "Dolly20"," "+ PROFIT2  +"", 9, "Arial", YellowGreen );
        ObjectDelete("Dolly21");
   Dolly21( "Dolly21", 195, 12,4);
   ObjectSetText( "Dolly21"," "+STOP1+ " " , 9, "Arial", Yellow );
   
     
       ObjectDelete("Dolly22");
   Dolly22( "Dolly22", 215, 12,4);
   ObjectSetText( "Dolly22", "SELL STOP-2  "+Symbol()+ "  to ", 9, "Arial", OrangeRed );
   ObjectDelete("Dolly23");
   Dolly23( "Dolly23", 215, 12,4);
   ObjectSetText( "Dolly23"," "+ SELL1 +"", 9, "Arial",DarkOrange);
   
   
      
          ObjectDelete("Dolly24");
   Dolly24( "Dolly24", 230, 12,4);
   ObjectSetText( "Dolly24",  "TP               and SL @    ", 9, "Arial", OrangeRed );
   ObjectDelete("Dolly25");
   Dolly25( "Dolly25", 230, 12,4);
   ObjectSetText( "Dolly25"," "+ PROFIT3  +"", 9, "Arial", YellowGreen );
        ObjectDelete("Dolly26");
   Dolly26( "Dolly26", 230, 12,4);
   ObjectSetText( "Dolly26"," "+STOP3+ " " , 9, "Arial", Yellow );
  
    ObjectDelete("Dolly27");
   Dolly27( "Dolly27", 245, 12,4);
   ObjectSetText( "Dolly27", ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"  , 8, "Arial", White );
   
        ObjectDelete("Dolly28");
   Dolly28( "Dolly28", 260, 12,4);
   ObjectSetText( "Dolly28", "POTENTIAL REVERSAL LEVELS"  , 9, "Arial",DarkSeaGreen);
 
 
    ObjectDelete("Dolly29");
   Dolly29( "Dolly29", 270, 12,4);
   ObjectSetText( "Dolly29", ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"  , 8, "Arial", White );
   
           ObjectDelete("Dolly30");
   Dolly30( "Dolly30", 285, 12,4);
   ObjectSetText( "Dolly30", "BEARISH CORRECTION : "  , 9, "Arial",DeepSkyBlue);
   
         ObjectDelete("Dolly31");
   Dolly31( "Dolly31", 300, 12,4);
   ObjectSetText( "Dolly31", "BUY STOP "+Symbol()+ "  @ ", 9, "Arial", DodgerBlue );
   ObjectDelete("Dolly32");
   Dolly32( "Dolly32", 300, 12,4);
   ObjectSetText( "Dolly32"," "+ BUYTARGT +"", 9, "Arial", DarkOrange );
   
       
          ObjectDelete("Dolly33");
   Dolly33( "Dolly33", 315, 12,4);
   ObjectSetText( "Dolly33",  "TP               and SL @    ", 9, "Arial", DodgerBlue );
   ObjectDelete("Dolly34");
   Dolly34( "Dolly34", 315, 12,4);
   ObjectSetText( "Dolly34"," "+ PROFIT4  +"", 9, "Arial", YellowGreen );
        ObjectDelete("Dolly35");
   Dolly35( "Dolly35", 315, 12,4);
   ObjectSetText( "Dolly35"," "+STOP4+ " " , 9, "Arial", Yellow );
   
   
    
           ObjectDelete("Dolly36");
   Dolly36( "Dolly36", 335, 12,4);
   ObjectSetText( "Dolly36", "BULLISH CORRECTION : "  , 9, "Arial",Orange);
   
         ObjectDelete("Dolly37");
   Dolly37( "Dolly37", 350, 12,4);
   ObjectSetText( "Dolly37", "SELL STOP "+Symbol()+ "  @ ", 9, "Arial",  OrangeRed );
   ObjectDelete("Dolly38");
   Dolly38( "Dolly38", 350, 12,4);
   ObjectSetText( "Dolly38"," "+ SELLTARGT +"", 9, "Arial", DarkOrange );
   
       
          ObjectDelete("Dolly39");
   Dolly39( "Dolly39", 365, 12,4);
   ObjectSetText( "Dolly39",  "TP               and SL @    ", 9, "Arial",  OrangeRed );
   ObjectDelete("Dolly40");
   Dolly40( "Dolly40", 365, 12,4);
   ObjectSetText( "Dolly40"," "+ PROFIT5  +"", 9, "Arial", YellowGreen );
        ObjectDelete("Dolly41");
   Dolly41( "Dolly41", 365, 12,4);
   ObjectSetText( "Dolly41"," "+STOP5+ " " , 9, "Arial", Yellow );
   
   
    ObjectDelete("Dolly42");
   Dolly42( "Dolly42", 380, 12,4);
   ObjectSetText( "Dolly42", ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"  , 8, "Arial", White );
   
        
          ObjectDelete("Dolly43");
   Dolly43( "Dolly43", 395, 12,4);
   ObjectSetText( "Dolly43",  "DAILY OPEN", 9, "Arial",  Orange );
   ObjectDelete("Dolly44");
   Dolly44( "Dolly44", 395, 12,4);
   ObjectSetText( "Dolly44"," "+ OPEN1 +"", 9, "Arial", YellowGreen );
        ObjectDelete("Dolly45");
   Dolly45( "Dolly45", 410, 12,4);
   ObjectSetText( "Dolly45","DAILY AVERAGE RANGE " , 9, "Arial",DarkSeaGreen);
          ObjectDelete("Dolly46");
   Dolly46( "Dolly46", 410, 12,4);
   ObjectSetText( "Dolly46"," "+DAR+ " " , 9, "Arial", DarkOrange );
   
   
    ObjectDelete("Dolly47");
   Dolly47( "Dolly47", 420, 12,4);
   ObjectSetText( "Dolly47", ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"  , 8, "Arial", White );
   
          ObjectDelete("Dolly48");
   Dolly48( "Dolly48", 435, 12,4);
   ObjectSetText( "Dolly48","Price" , 10, "Arial", Silver);
          ObjectDelete("Dolly49");
   Dolly49( "Dolly49", 435, 12,4);
   ObjectSetText( "Dolly49"," "+PRICE+ " " , 15, "Arial", Silver);
   
	}
	}

	//----
	return(0);

}


//+------------------------------------------------------------------+
int Dolly( string Text, int xOffset, int yOffset,int iCorner) //TITLE
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20);
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly1( string Text, int xOffset, int yOffset,int iCorner) //TITLE
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly2( string Text, int xOffset, int yOffset,int iCorner)//Buy Zone
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly3( string Text, int xOffset, int yOffset,int iCorner) //Line
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly4( string Text, int xOffset, int yOffset,int iCorner)
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly5( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 170 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly6( string Text, int xOffset, int yOffset,int iCorner)
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly7( string Text, int xOffset, int yOffset,int iCorner)
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 35 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly8( string Text, int xOffset, int yOffset,int iCorner)
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 140 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly9( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly10( string Text, int xOffset, int yOffset,int iCorner)
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 170 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly11( string Text, int xOffset, int yOffset,int iCorner)
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly12( string Text, int xOffset, int yOffset,int iCorner)
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 35 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly13( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 140 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly14( string Text, int xOffset, int yOffset,int iCorner) //Line
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20);
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly15( string Text, int xOffset, int yOffset,int iCorner) //SELL ZONE
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly16( string Text, int xOffset, int yOffset,int iCorner) //LINE
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly17( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly18( string Text, int xOffset, int yOffset,int iCorner)
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 170 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}   
int Dolly19( string Text, int xOffset, int yOffset,int iCorner) // Line
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}   
int Dolly20( string Text, int xOffset, int yOffset,int iCorner) // 1st SELL 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 35 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}   
int Dolly21( string Text, int xOffset, int yOffset,int iCorner) // 1st SELL SL
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 140 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}  
int Dolly22( string Text, int xOffset, int yOffset,int iCorner) // 2nd SELL
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}   
int Dolly23( string Text, int xOffset, int yOffset,int iCorner) // 2nd SELL
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 170 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly24( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}   
int Dolly25( string Text, int xOffset, int yOffset,int iCorner)
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 35);
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly26( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 140 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}   
int Dolly27( string Text, int xOffset, int yOffset,int iCorner)//LINE 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly28( string Text, int xOffset, int yOffset,int iCorner) // POTENTIAL 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}   
int Dolly29( string Text, int xOffset, int yOffset,int iCorner) // LINE
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly30( string Text, int xOffset, int yOffset,int iCorner) //BEARISH CORR
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}   
int Dolly31( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly32( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 170 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly33( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly34( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 35 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly35( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 140 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly36( string Text, int xOffset, int yOffset,int iCorner) //BULLISH CORR
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly37( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly38( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 170 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly39( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly40( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 35 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly41( string Text, int xOffset, int yOffset,int iCorner)  
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 140 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly42( string Text, int xOffset, int yOffset,int iCorner)  
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly43( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly44( string Text, int xOffset, int yOffset,int iCorner) 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 100 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly45( string Text, int xOffset, int yOffset,int iCorner)  
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
} 
int Dolly46( string Text, int xOffset, int yOffset,int iCorner)  
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 160 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly47( string Text, int xOffset, int yOffset,int iCorner) //Line 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly48( string Text, int xOffset, int yOffset,int iCorner) //Line 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 20 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}
int Dolly49( string Text, int xOffset, int yOffset,int iCorner) //Line 
{  ObjectCreate(Text,OBJ_LABEL         , 0, 0, 0 );
   ObjectSet   (Text,OBJPROP_CORNER    , iCorner);
   ObjectSet   (Text,OBJPROP_XDISTANCE , 50 );
   ObjectSet   (Text,OBJPROP_YDISTANCE , xOffset );
   ObjectSet   (Text,OBJPROP_BACK      , True );
}

void init_pivots()
{
	// --- Typing Labels
	if(ObjectFind("R3 label") != 0)
	{
		ObjectCreate("R3 label", OBJ_TEXT, 0, 0, 0);
		ObjectSetText("R3 label", " R3 ", 8, "Arial", Silver);
	}

	if(ObjectFind("S3 label") != 0)
	{
		ObjectCreate("S3 label", OBJ_TEXT, 0, 0, 0);
		ObjectSetText("S3 label", " S3 ", 8, "Arial", Silver);
	}

	if(ObjectFind("R2 label") != 0)
	{
		ObjectCreate("R2 label", OBJ_TEXT, 0, 0, 0);
		ObjectSetText("R2 label", " R2 ", 8, "Arial", Silver);
	}

	if(ObjectFind("S2 label") != 0)
	{
		ObjectCreate("S2 label", OBJ_TEXT, 0, 0, 0);
		ObjectSetText("S2 label", " S2 ", 8, "Arial", Silver);
	}

	if(ObjectFind("R1 label") != 0)
	{
		ObjectCreate("R1 label", OBJ_TEXT, 0, 0, 0);
		ObjectSetText("R1 label", " R1 ", 8, "Arial", Silver);
	}

	if(ObjectFind("S1 label") != 0)
	{
		ObjectCreate("S1 label", OBJ_TEXT, 0, 0, 0);
		ObjectSetText("S1 label", " S1 ", 8, "Arial", Silver);
	}

	if(ObjectFind("P label") != 0)
	{
		ObjectCreate("P label", OBJ_TEXT, 0, 0, 0);
		ObjectSetText("P label", "P ", 8, "Arial",Silver);
	}
		if(ObjectFind("M1 label") != 0)
	{
		ObjectCreate("M1 label", OBJ_TEXT, 0, 0, 0);
		ObjectSetText("M1 label", " M1 ", 8, "Arial", Silver);
	}

	if(ObjectFind("M2 label") != 0)
	{
		ObjectCreate("M2 label", OBJ_TEXT, 0, 0, 0);
		ObjectSetText("M2 label", " M2", 8, "Arial", Silver);
	}

	if(ObjectFind("M3 label") != 0)
	{
		ObjectCreate("M3 label", OBJ_TEXT, 0, 0, 0);
		ObjectSetText("M3 label", " M3 ", 8, "Arial", Silver);
	}

	if(ObjectFind("M4 label") != 0)
	{
		ObjectCreate("M4 label", OBJ_TEXT, 0, 0, 0);
		ObjectSetText("M4 label", " M4 ", 8, "Arial", Silver);
	}

	if(ObjectFind("M5 label") != 0)
	{
		ObjectCreate("M5 label", OBJ_TEXT, 0, 0, 0);
		ObjectSetText("M5 label", " M5 ", 8, "Arial", Silver);
	}

	if(ObjectFind("M0 label") != 0)
	{
		ObjectCreate("M0 label", OBJ_TEXT, 0, 0, 0);
		ObjectSetText("M0 label", " M0 ", 8, "Arial", Silver);
	}

	
	return;
}

void set_pivots(double p, double r1, double r2, double r3, double s1, double s2, double s3, double m1, double m2, double m3,
                 double m4, double m5, double m0 )
{
   ObjectSet("p_Line",OBJPROP_PRICE1, p);   ObjectMove("P label",  0, Time[SHIFT_PivotPointText], p);
   ObjectSet("r1_Line",OBJPROP_PRICE1, r1); ObjectMove("R1 label", 0, Time[SHIFT_PivotPointText], r1);
   ObjectSet("r2_Line",OBJPROP_PRICE1, r2); ObjectMove("R2 label", 0, Time[SHIFT_PivotPointText], r2);
   ObjectSet("r3_Line",OBJPROP_PRICE1, r3); ObjectMove("R3 label", 0, Time[SHIFT_PivotPointText], r3);
   ObjectSet("s1_Line",OBJPROP_PRICE1, s1); ObjectMove("S1 label", 0, Time[SHIFT_PivotPointText], s1);
   ObjectSet("s2_Line",OBJPROP_PRICE1, s2); ObjectMove("S2 label", 0, Time[SHIFT_PivotPointText], s2);
   ObjectSet("s3_Line",OBJPROP_PRICE1, s3); ObjectMove("S3 label", 0, Time[SHIFT_PivotPointText], s3);
   
   if (Show_M_PivotLines==true) 
   {
     ObjectSet("m1_Line",OBJPROP_PRICE1, m1);   ObjectMove("M1 label",  0, Time[SHIFT_M_PivotText], m1);
     ObjectSet("m2_Line",OBJPROP_PRICE1, m2);   ObjectMove("M2 label",  0, Time[SHIFT_M_PivotText], m2);
     ObjectSet("m3_Line",OBJPROP_PRICE1, m3);   ObjectMove("M3 label",  0, Time[SHIFT_M_PivotText], m3);
     ObjectSet("m4_Line",OBJPROP_PRICE1, m4);   ObjectMove("M4 label",  0, Time[SHIFT_M_PivotText], m4);
     ObjectSet("m5_Line",OBJPROP_PRICE1, m5);   ObjectMove("M5 label",  0, Time[SHIFT_M_PivotText], m5);
     ObjectSet("m0_Line",OBJPROP_PRICE1, m0);   ObjectMove("M0 label",  0, Time[SHIFT_M_PivotText], m0);
   }
}

void deinit_pivots()
{
	ObjectDelete("r1 Label");
	ObjectDelete("r1_Line");
	ObjectDelete("r2 Label");
	ObjectDelete("r2_Line");
	ObjectDelete("r3 Label");
	ObjectDelete("r3_Line");
	ObjectDelete("r1 Label");
	ObjectDelete("r1_Line");
	ObjectDelete("r2 Label");
	ObjectDelete("r2_Line");
	ObjectDelete("r3 Label");
	ObjectDelete("r3_Line");
	ObjectDelete("R1 Label");
	ObjectDelete("R1_Line");
	ObjectDelete("R2 Label");
	ObjectDelete("R2_Line");
	ObjectDelete("R3 Label");
	ObjectDelete("R3_Line");
	ObjectDelete("S1 Label");
	ObjectDelete("S1_Line");
	ObjectDelete("S2 Label");
	ObjectDelete("S2_Line");
	ObjectDelete("S3 Label");
	ObjectDelete("S3_Line");
	ObjectDelete("P Label");
	ObjectDelete("P_Line");
	ObjectDelete("M1_Line");
	ObjectDelete("M1 Label");
	ObjectDelete("M2_Line");
	ObjectDelete("M2 Label");
	ObjectDelete("M3_Line");
	ObjectDelete("M3 Label");
	ObjectDelete("M4_Line");
	ObjectDelete("M4 Label");
	ObjectDelete("M5_Line");
	ObjectDelete("M5 Label");
	ObjectDelete("M0_Line");
	ObjectDelete("M0 Label");
	ObjectDelete("m1 Label");
	ObjectDelete("m1_Line");
	ObjectDelete("m2 Label");
	ObjectDelete("m2_Line");
	ObjectDelete("m3 Label");
	ObjectDelete("m3_Line");
	ObjectDelete("m4 Label");
	ObjectDelete("m4_Line");
	ObjectDelete("m5 Label");
	ObjectDelete("m5_Line");
	ObjectDelete("m0 Label");
	ObjectDelete("m0_Line");
}





Sample



image not available


Analysis



Market Information Used:

Series array that contains open time of each bar
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Series array that contains close prices for each bar
Series array that contains open prices of each bar


Indicator Curves created:

Implements a curve of type DRAW_NONE


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: