//+------------------------------------------------------------------+
//|                                      TRO_SR_RR_Freeway.mq4       |
//|                                                                  |
//|   Copyright © 2008, Avery T. Horton, Jr. aka TheRumpledOne       |
//|                                                                  |
//|   PO BOX 43575, TUCSON, AZ 85733                                 |
//|                                                                  |
//|   GIFTS AND DONATIONS ACCEPTED                                   | 
//|                                                                  |
//|   therumpledone@gmail.com                                        |  
//+------------------------------------------------------------------+ 

#property copyright "Copyright © 2008, Avery T. Horton, Jr. aka TheRumpledOne"
#property link      "therumpledone@gmail.com"

#property indicator_chart_window
 
extern color ColorUpper   = Maroon ;
extern color ColorShort   = Crimson ;
extern color ColorLong    = DarkGreen ;
extern color ColorLower   = Blue ; 


extern color UpS_color = Lime;
extern color UpW_color = Green;
extern color Eq_color  = Yellow;
extern color DnW_color = Maroon;
extern color DnS_color = Red;

extern int   Line_Style.p1   = STYLE_DOT ;
extern int   Line_Style.p2   = STYLE_DASHDOT ;
extern int   Line_Style.p3   = STYLE_DASH ;
extern int   Line_Style.p4   = STYLE_SOLID ;

extern color  ColorUpClear    = Honeydew ;
extern color  ColorDownClear  = MistyRose ;
extern color  ColorUpBlocked  = LightGray ;
extern color  ColorDnBlocked  = LightGray ;

extern color ColorBelow   = Red ;
extern color ColorBelow2  = Pink ;
extern color ColorAbove   = Green ; 
extern color ColorAbove2  = LightGreen ; 

extern bool Show.Freeway = true ;

extern bool Show.p1 = true ;
extern bool Show.p2 = false ;
extern bool Show.p3 = false ;
extern bool Show.p4 = false ;

extern int p1.ma=5;//Period() in minutes
extern int p2.ma=15;//Period() in minutes
extern int p3.ma=60;//Period() in minutes
extern int p4.ma=1440;//Period() in minutes

extern int first_columnCCIperiods=50;
extern int second_columnCCIperiods=50;
extern int third_columnCCIperiods=50;
extern int fourth_columnCCIperiods=50;
extern int cci.applied.price=5;
extern int cciUpperTrigger=0;
extern int cciLowerTrigger=0;
extern bool Use_Std_Reg=false;
extern int STD.Rgres.period=0;
extern int STD.Rgres.length=56;
extern double STD.Rgres.width=1.618;
extern double STD.width=0.618;

extern int ma.applied.price=1;/*
Applied price constants. It can be any of the following values:

Constant       Value Description 
PRICE_CLOSE    0     Close price. 
PRICE_OPEN     1     Open price. 
PRICE_HIGH     2     High price. 
PRICE_LOW      3     Low price. 
PRICE_MEDIAN   4     Median price, (high+low)/2. 
PRICE_TYPICAL  5     Typical price, (high+low+close)/3. 
PRICE_WEIGHTED 6     Weighted close price, (high+low+close+close)/4.*/ 
extern int ma.Method=0;/*
Moving Average Method
Constant    Value Description 
MODE_SMA    0     Simple moving average, 
MODE_EMA    1     Exponential moving average, 
MODE_SMMA   2     Smoothed moving average, 
MODE_LWMA   3     Linear weighted moving average.   */


/*

extern int ma1.Length=0;
extern int ma2.Length=0;
extern int ma3.Length=0;
extern int ma4.Length=0;
extern int ma5.Length=0;
extern int ma6.Length=0;
extern int ma7.Length=0;

extern int fib.SR.shadow.1=0;
extern int fib.SR.shadow.2=0;
extern int fib.SR.shadow.3=0;
extern int fib.SR.shadow.4=0;
extern int fib.SR.shadow.5=0;
extern int fib.SR.shadow.6=0;
extern int fib.SR.shadow.7=0;




extern int ma1.Length=20;
extern int ma2.Length=34;
extern int ma3.Length=34;
extern int ma4.Length=50;
extern int ma5.Length=89;
extern int ma6.Length=144;
extern int ma7.Length=200;

extern int fib.SR.shadow.1=8;
extern int fib.SR.shadow.2=13;
extern int fib.SR.shadow.3=21;
extern int fib.SR.shadow.4=34;
extern int fib.SR.shadow.5=55;
extern int fib.SR.shadow.6=89;
extern int fib.SR.shadow.7=144;

*/


extern int ma1.Length=0;
extern int ma2.Length=0;
extern int ma3.Length=0;
extern int ma4.Length=0;
extern int ma5.Length=0;
extern int ma6.Length=0;
extern int ma7.Length=0; 

extern int fib.SR.shadow.1=0;
extern int fib.SR.shadow.2=0;
extern int fib.SR.shadow.3=0;
extern int fib.SR.shadow.4=0;
extern int fib.SR.shadow.5=0;
extern int fib.SR.shadow.6=0;
extern int fib.SR.shadow.7=0;

extern color fib.SR.shadow.1.c=AliceBlue;
extern color fib.SR.shadow.2.c=LightBlue;
extern color fib.SR.shadow.3.c=DodgerBlue;
extern color fib.SR.shadow.4.c=RoyalBlue;
extern color fib.SR.shadow.5.c=Blue;
extern color fib.SR.shadow.6.c=MediumBlue;
extern color fib.SR.shadow.7.c=DarkBlue;

double ma1.p1, ma2.p1, ma3.p1, ma4.p1, ma5.p1, ma6.p1, ma7.p1;
double ma1.p2, ma2.p2, ma3.p2, ma4.p2, ma5.p2, ma6.p2, ma7.p2;
double ma1.p3, ma2.p3, ma3.p3, ma4.p3, ma5.p3, ma6.p3, ma7.p3;
double ma1.p4, ma2.p4, ma3.p4, ma4.p4, ma5.p4, ma6.p4, ma7.p4;
double tmb1,tmb2,tmb3,tmb4,tmr1,tmr2,tmr3,tmr4;
datetime t1.p1, t2.p1, t1.p2, t2.p2, t1.p3, t2.p3, t1.p4, t2.p4;

   double time.frame.multiplier;
   double zoom.multiplier;
   int bpw ;

double support = 0, resistance=0 , goShort = 0, goLong = 0 ;
double support.p1 = 0, resistance.p1 = 0 , goShort.p1 = 0, goLong.p1 = 0 ;
double support.p2 = 0, resistance.p2 = 0 , goShort.p2 = 0, goLong.p2 = 0 ;
double support.p3 = 0, resistance.p3 = 0 , goShort.p3 = 0, goLong.p3 = 0 ;
double support.p4 = 0, resistance.p4 = 0 , goShort.p4 = 0, goLong.p4 = 0 ;


double Bias_Open, Bias_Close, Bias_High, Bias_Low, Bias_Diff, Bias_Mid, Bias_Pivot ;
color  ColorBias = Yellow ;


string Obj0001,Obj0002,Obj0003,Obj0004,Obj0005,Obj0006,Obj0007,Obj0008,Obj0009,Obj0010,Obj0011,Obj0012,Obj0013,Obj0014;  
string symbol, tChartPeriod,  tShortName, tp1.ma, tp2.ma, tp3.ma, tp4.ma, tHead , BiasArrow ;  

int    digits, period, myBars = 21  ; 



string Arrow12 = "ñ"; // 12 oclock
string Arrow2  = "ö";  // 2 oclock
string Arrow3  = "ð";  // 3 oclock
string Arrow5  = "ø";  // 5 oclock
string Arrow6  = "ò";  // 6 oclock
 
 
//+------------------------------------------------------------------+

int init()  
{  
   period       = Period() ;   
   symbol       = Symbol() ;
   tShortName   = "srrrfwy"+symbol+period ;

   tp1.ma =  "       " + TimeFrameToString(p1.ma) ;
   tp2.ma =  "       " + TimeFrameToString(p2.ma) ;
   tp3.ma =  "       " + TimeFrameToString(p3.ma) ;
   tp4.ma =  "       " + TimeFrameToString(p4.ma) ;
   
//   tHead  =   tp1.ma + "       "+ tp2.ma + "           "+ tp3.ma + "     "+ tp4.ma ;
   
   Obj0001 = "0001" + tShortName ; 
   Obj0002 = "0002" + tShortName ; 
   Obj0003 = "0003" + tShortName ; 
   Obj0004 = "0004" + tShortName ;  
   Obj0011 = "0001" + tShortName ; 
   Obj0012 = "0002" + tShortName ; 
   Obj0013 = "0003" + tShortName ; 
   Obj0014 = "0004" + tShortName ;     
   
   
   return(0);  
}

//+------------------------------------------------------------------+

int deinit()   {  


Refresh();   return(0);  }

//+------------------------------------------------------------------+

int start() 
{

   Refresh();
   
   if(Use_Std_Reg) 
   {                                                   //Time[STD.Rgres.length],Time[0]
   ObjectCreate("regression channel",OBJ_STDDEVCHANNEL,0,iTime(Symbol(),STD.Rgres.period,STD.Rgres.length),Bid,Time[0],Ask);
   ObjectSet("regression channel",OBJPROP_DEVIATION,STD.Rgres.width);
   ObjectSet("std channel",OBJPROP_COLOR,Orange);
   ObjectSet("regression channel",OBJPROP_RAY,true);
   ObjectCreate("std channel",OBJ_STDDEVCHANNEL,0,iTime(Symbol(),STD.Rgres.period,STD.Rgres.length),Bid,Time[0],Ask);
   ObjectSet("std channel",OBJPROP_DEVIATION,STD.width);
   ObjectSet("std channel",OBJPROP_COLOR,Olive);
   ObjectSet("std channel",OBJPROP_RAY,true);
   }
   
//p1 ma settings
   ma1.p1=iMA(Symbol(),p1.ma,ma1.Length,0,ma.Method,ma.applied.price,0);
   ma2.p1=iMA(Symbol(),p1.ma,ma2.Length,0,ma.Method,ma.applied.price,0);
   ma3.p1=iMA(Symbol(),p1.ma,ma3.Length,0,ma.Method,ma.applied.price,0);
   ma4.p1=iMA(Symbol(),p1.ma,ma4.Length,0,ma.Method,ma.applied.price,0);
   ma5.p1=iMA(Symbol(),p1.ma,ma5.Length,0,ma.Method,ma.applied.price,0);
   ma6.p1=iMA(Symbol(),p1.ma,ma6.Length,0,ma.Method,ma.applied.price,0);
   ma7.p1=iMA(Symbol(),p1.ma,ma7.Length,0,ma.Method,ma.applied.price,0);
//--------------
//p2 ma settings
   ma1.p2=iMA(Symbol(),p2.ma,ma1.Length,0,ma.Method,ma.applied.price,0);
   ma2.p2=iMA(Symbol(),p2.ma,ma2.Length,0,ma.Method,ma.applied.price,0);
   ma3.p2=iMA(Symbol(),p2.ma,ma3.Length,0,ma.Method,ma.applied.price,0);
   ma4.p2=iMA(Symbol(),p2.ma,ma4.Length,0,ma.Method,ma.applied.price,0);
   ma5.p2=iMA(Symbol(),p2.ma,ma5.Length,0,ma.Method,ma.applied.price,0);
   ma6.p2=iMA(Symbol(),p2.ma,ma6.Length,0,ma.Method,ma.applied.price,0);
   ma7.p2=iMA(Symbol(),p2.ma,ma7.Length,0,ma.Method,ma.applied.price,0);
//--------------
//p3 ma settings
   ma1.p3=iMA(Symbol(),p3.ma,ma1.Length,0,ma.Method,ma.applied.price,0);
   ma2.p3=iMA(Symbol(),p3.ma,ma2.Length,0,ma.Method,ma.applied.price,0);
   ma3.p3=iMA(Symbol(),p3.ma,ma3.Length,0,ma.Method,ma.applied.price,0);
   ma4.p3=iMA(Symbol(),p3.ma,ma4.Length,0,ma.Method,ma.applied.price,0);
   ma5.p3=iMA(Symbol(),p3.ma,ma5.Length,0,ma.Method,ma.applied.price,0);
   ma6.p3=iMA(Symbol(),p3.ma,ma6.Length,0,ma.Method,ma.applied.price,0);
   ma7.p3=iMA(Symbol(),p3.ma,ma7.Length,0,ma.Method,ma.applied.price,0);
//--------------
//p4 ma settings
   ma1.p4=iMA(Symbol(),p4.ma,ma1.Length,0,ma.Method,ma.applied.price,0);
   ma2.p4=iMA(Symbol(),p4.ma,ma2.Length,0,ma.Method,ma.applied.price,0);
   ma3.p4=iMA(Symbol(),p4.ma,ma3.Length,0,ma.Method,ma.applied.price,0);
   ma4.p4=iMA(Symbol(),p4.ma,ma4.Length,0,ma.Method,ma.applied.price,0);
   ma5.p4=iMA(Symbol(),p4.ma,ma5.Length,0,ma.Method,ma.applied.price,0);
   ma6.p4=iMA(Symbol(),p4.ma,ma6.Length,0,ma.Method,ma.applied.price,0);
   ma7.p4=iMA(Symbol(),p4.ma,ma7.Length,0,ma.Method,ma.applied.price,0);
   
//--------------
tmb1=iCCI(NULL,p1.ma,first_columnCCIperiods,cci.applied.price,0);
tmb2=iCCI(NULL,p2.ma,second_columnCCIperiods,cci.applied.price,0);
tmb3=iCCI(NULL,p3.ma,third_columnCCIperiods,cci.applied.price,0);
tmb4=iCCI(NULL,p4.ma,fourth_columnCCIperiods,cci.applied.price,0);

tmr1=iCCI(NULL,p1.ma,first_columnCCIperiods,cci.applied.price,0);
tmr2=iCCI(NULL,p2.ma,second_columnCCIperiods,cci.applied.price,0);
tmr3=iCCI(NULL,p3.ma,third_columnCCIperiods,cci.applied.price,0);
tmr4=iCCI(NULL,p4.ma,fourth_columnCCIperiods,cci.applied.price,0);

//Comment(p1.ma ,"Minutes CCI Level ",tmb1,"\n",p2.ma ,"Minutes CCI Level ",tmb2,"\n",p3.ma ,"Minutes Minutes CCI Level ",tmb3,"\n",p4.ma ,"Minutes Minutes CCI Level ",tmb4);

Time.Coordinate.Set();

p1.Fib.Plot();
support.p1 = support; resistance.p1 = resistance ; goShort.p1 = goShort; goLong.p1 = goLong ;
if( Show.p1 )  DoShowLines( p1.ma, Line_Style.p1 ) ;
     
p2.Fib.Plot();
support.p2 = support; resistance.p2 = resistance ; goShort.p2 = goShort; goLong.p2 = goLong ;
if( Show.p2 )  DoShowLines( p2.ma , Line_Style.p2 ) ;

p3.Fib.Plot();
support.p3 = support; resistance.p3 = resistance ; goShort.p3 = goShort; goLong.p3 = goLong ;
if( Show.p3 )  DoShowLines( p3.ma , Line_Style.p3 ) ;

p4.Fib.Plot();
support.p4 = support; resistance.p4 = resistance ; goShort.p4 = goShort; goLong.p4 = goLong ;
if( Show.p4 )  DoShowLines( p4.ma , Line_Style.p4 ) ;

if(Show.Freeway) { column(); }

return(0);}

//+------------------------------------------------------------------+

void Time.Coordinate.Set()   
{
//....Variable Settings for Object Spatial Placement.....
/*
   double time.frame.multiplier;
   double zoom.multiplier;
   int bpw=BarsPerWindow();
*/   

    bpw=BarsPerWindow(); 
   
   if(bpw<25)              {zoom.multiplier=0.05;}
   if(bpw>25 && bpw<50)    {zoom.multiplier=0.07;}
   if(bpw>50 && bpw<175)   {zoom.multiplier=0.12;}   
   if(bpw>175 && bpw<375)  {zoom.multiplier=0.25;}
   if(bpw>375 && bpw<750)  {zoom.multiplier=0.5;}
   if(bpw>750)             {zoom.multiplier=1;}

   if(Period()==1)      {time.frame.multiplier=0.65;}
   if(Period()==5)      {time.frame.multiplier=3.25;}
   if(Period()==15)     {time.frame.multiplier=9.75;}
   if(Period()==30)     {time.frame.multiplier=19.5;}
   if(Period()==60)     {time.frame.multiplier=39;}
   if(Period()==240)    {time.frame.multiplier=156;}
   if(Period()==1440)   {time.frame.multiplier=936;}
   if(Period()==10080)  {time.frame.multiplier=6552;}
   if(Period()==43200)  {time.frame.multiplier=28043;}

   t1.p1=Time[0]+(1200*time.frame.multiplier*zoom.multiplier); // was 1000
   t2.p1=Time[0]+(3200*time.frame.multiplier*zoom.multiplier); // was 3000
   
   t1.p2=Time[0]+(5000*time.frame.multiplier*zoom.multiplier);
   t2.p2=Time[0]+(7000*time.frame.multiplier*zoom.multiplier);

   t1.p3=Time[0]+(9000*time.frame.multiplier*zoom.multiplier);
   t2.p3=Time[0]+(11000*time.frame.multiplier*zoom.multiplier);

   t1.p4=Time[0]+(13000*time.frame.multiplier*zoom.multiplier);
   t2.p4=Time[0]+(15000*time.frame.multiplier*zoom.multiplier); // was 16000

}//end Time.Coordinate.Set()
   
//+------------------------------------------------------------------+

void SRRR( int period ) 
{ 

 resistance = iCustom(symbol,period,"TRO_SR_RR_X4",myBars,0,0);
 goShort    = iCustom(symbol,period,"TRO_SR_RR_X4",myBars,1,0);
 goLong     = iCustom(symbol,period,"TRO_SR_RR_X4",myBars,2,0);
 support    = iCustom(symbol,period,"TRO_SR_RR_X4",myBars,3,0); 
}

//+------------------------------------------------------------------+

void p1.Fib.Plot()   {
//p1 dynamic fibo levels
   double lo.ma.p1,hi.ma.p1;
   lo.ma.p1=ma1.p1;
   if(ma2.p1<lo.ma.p1)  {lo.ma.p1=ma2.p1;}
   if(ma3.p1<lo.ma.p1)  {lo.ma.p1=ma3.p1;}
   if(ma4.p1<lo.ma.p1)  {lo.ma.p1=ma4.p1;}
   if(ma5.p1<lo.ma.p1)  {lo.ma.p1=ma5.p1;}
   if(ma6.p1<lo.ma.p1)  {lo.ma.p1=ma6.p1;}
   if(ma7.p1<lo.ma.p1)  {lo.ma.p1=ma7.p1;}
   lo.ma.p1=NormalizeDouble(lo.ma.p1+(fib.SR.shadow.1*Point),Digits);

   hi.ma.p1=ma7.p1;
   if(ma6.p1>hi.ma.p1)  {hi.ma.p1=ma6.p1;}
   if(ma5.p1>hi.ma.p1)  {hi.ma.p1=ma5.p1;}
   if(ma4.p1>hi.ma.p1)  {hi.ma.p1=ma4.p1;}
   if(ma3.p1>hi.ma.p1)  {hi.ma.p1=ma3.p1;}
   if(ma2.p1>hi.ma.p1)  {hi.ma.p1=ma2.p1;}
   if(ma1.p1>hi.ma.p1)  {hi.ma.p1=ma1.p1;}
   hi.ma.p1=NormalizeDouble(hi.ma.p1-(fib.SR.shadow.1*Point),Digits);


      

//p1 center dynamic fib placement      
   if(lo.ma.p1-hi.ma.p1>Ask-Bid)   {
      ObjectCreate("lcf.p1",OBJ_TREND,0,t1.p1, lo.ma.p1, t2.p1, lo.ma.p1);
      ObjectSet("lcf.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lcf.p1",OBJPROP_WIDTH,2);
      ObjectSet("lcf.p1",OBJPROP_RAY,false);
      ObjectSet("lcf.p1",OBJPROP_COLOR,fib.SR.shadow.1.c);
      ObjectSetText("lcf.p1",DoubleToStr(lo.ma.p1,Digits),7,"Arial",fib.SR.shadow.1.c);

      ObjectCreate("hcf.p1",OBJ_TREND,0,t1.p1, hi.ma.p1, t2.p1, hi.ma.p1);
      ObjectSet("hcf.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hcf.p1",OBJPROP_WIDTH,2);
      ObjectSet("hcf.p1",OBJPROP_RAY,false);
      ObjectSet("hcf.p1",OBJPROP_COLOR,fib.SR.shadow.1.c);
      ObjectSetText("hcf.p1",DoubleToStr(hi.ma.p1,Digits),7,"Arial",fib.SR.shadow.1.c);   }      
 
   double lo.ma.p1.1, lo.ma.p1.2, lo.ma.p1.3, lo.ma.p1.4, lo.ma.p1.5, lo.ma.p1.6;
   lo.ma.p1.1=lo.ma.p1+(fib.SR.shadow.2*Point);
   lo.ma.p1.2=lo.ma.p1.1+(fib.SR.shadow.3*Point);
   lo.ma.p1.3=lo.ma.p1.2+(fib.SR.shadow.4*Point);
   lo.ma.p1.4=lo.ma.p1.3+(fib.SR.shadow.5*Point);
   lo.ma.p1.5=lo.ma.p1.4+(fib.SR.shadow.6*Point);
   lo.ma.p1.6=lo.ma.p1.5+(fib.SR.shadow.7*Point);
     
   double hi.ma.p1.1, hi.ma.p1.2, hi.ma.p1.3, hi.ma.p1.4, hi.ma.p1.5, hi.ma.p1.6;
   hi.ma.p1.1=hi.ma.p1-(fib.SR.shadow.2*Point);
   hi.ma.p1.2=hi.ma.p1.1-(fib.SR.shadow.3*Point);
   hi.ma.p1.3=hi.ma.p1.2-(fib.SR.shadow.4*Point);
   hi.ma.p1.4=hi.ma.p1.3-(fib.SR.shadow.5*Point);
   hi.ma.p1.5=hi.ma.p1.4-(fib.SR.shadow.6*Point);
   hi.ma.p1.6=hi.ma.p1.5-(fib.SR.shadow.7*Point);

//p1 1st level (hi.1.p1, lo.1.p1)
   if(lo.ma.p1.1-hi.ma.p1.1>Ask-Bid)   {
      ObjectCreate("lo.1.p1",OBJ_TREND,0,t1.p1, lo.ma.p1.1, t2.p1, lo.ma.p1.1);
      ObjectSet("lo.1.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.1.p1",OBJPROP_WIDTH,2);
      ObjectSet("lo.1.p1",OBJPROP_RAY,false);
      ObjectSet("lo.1.p1",OBJPROP_COLOR,fib.SR.shadow.2.c);
      ObjectSetText("lo.1.p1",DoubleToStr(lo.ma.p1.1,Digits),7,"Arial",fib.SR.shadow.2.c);

      ObjectCreate("hi.1.p1",OBJ_TREND,0,t1.p1, hi.ma.p1.1, t2.p1, hi.ma.p1.1);
      ObjectSet("hi.1.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.1.p1",OBJPROP_WIDTH,2);
      ObjectSet("hi.1.p1",OBJPROP_RAY,false);
      ObjectSet("hi.1.p1",OBJPROP_COLOR,fib.SR.shadow.2.c);
      ObjectSetText("hi.1.p1",DoubleToStr(hi.ma.p1.1,Digits),7,"Arial",fib.SR.shadow.2.c);   }

// 2st level (hi.2.p1, lo.2.p1)
   if(lo.ma.p1.2-hi.ma.p1.2>Ask-Bid)   {
      ObjectCreate("lo.2.p1",OBJ_TREND,0,t1.p1, lo.ma.p1.2, t2.p1, lo.ma.p1.2);
      ObjectSet("lo.2.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.2.p1",OBJPROP_WIDTH,2);
      ObjectSet("lo.2.p1",OBJPROP_RAY,false);
      ObjectSet("lo.2.p1",OBJPROP_COLOR,fib.SR.shadow.3.c);
      ObjectSetText("lo.2.p1",DoubleToStr(lo.ma.p1.2,Digits),7,"Arial",fib.SR.shadow.3.c);

      ObjectCreate("hi.2.p1",OBJ_TREND,0,t1.p1, hi.ma.p1.2, t2.p1, hi.ma.p1.2);
      ObjectSet("hi.2.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.2.p1",OBJPROP_WIDTH,2);
      ObjectSet("hi.2.p1",OBJPROP_RAY,false);
      ObjectSet("hi.2.p1",OBJPROP_COLOR,fib.SR.shadow.3.c);
      ObjectSetText("hi.2.p1",DoubleToStr(hi.ma.p1.2,Digits),7,"Arial",fib.SR.shadow.3.c);   }     

// 3rd level (hi.3.p1, lo.3.p1)
   if(lo.ma.p1.3-hi.ma.p1.3>Ask-Bid)   {
      ObjectCreate("lo.3.p1",OBJ_TREND,0,t1.p1, lo.ma.p1.3, t2.p1, lo.ma.p1.3);
      ObjectSet("lo.3.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.3.p1",OBJPROP_WIDTH,2);
      ObjectSet("lo.3.p1",OBJPROP_RAY,false);
      ObjectSet("lo.3.p1",OBJPROP_COLOR,fib.SR.shadow.4.c);
      ObjectSetText("lo.3.p1",DoubleToStr(lo.ma.p1.3,Digits),7,"Arial",fib.SR.shadow.4.c);

      ObjectCreate("hi.3.p1",OBJ_TREND,0,t1.p1, hi.ma.p1.3, t2.p1, hi.ma.p1.3);
      ObjectSet("hi.3.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.3.p1",OBJPROP_WIDTH,2);
      ObjectSet("hi.3.p1",OBJPROP_RAY,false);
      ObjectSet("hi.3.p1",OBJPROP_COLOR,fib.SR.shadow.4.c);
      ObjectSetText("hi.3.p1",DoubleToStr(hi.ma.p1.3,Digits),7,"Arial",fib.SR.shadow.4.c);   }    

// 4th level (hi.4.p1, lo.4.p1)
   if(lo.ma.p1.4-hi.ma.p1.4>Ask-Bid)   {
      ObjectCreate("lo.4.p1",OBJ_TREND,0,t1.p1, lo.ma.p1.4, t2.p1, lo.ma.p1.4);
      ObjectSet("lo.4.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.4.p1",OBJPROP_WIDTH,2);
      ObjectSet("lo.4.p1",OBJPROP_RAY,false);
      ObjectSet("lo.4.p1",OBJPROP_COLOR,fib.SR.shadow.5.c);
      ObjectSetText("lo.4.p1",DoubleToStr(lo.ma.p1.4,Digits),7,"Arial",fib.SR.shadow.5.c);

      ObjectCreate("hi.4.p1",OBJ_TREND,0,t1.p1, hi.ma.p1.4, t2.p1, hi.ma.p1.4);
      ObjectSet("hi.4.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.4.p1",OBJPROP_WIDTH,2);
      ObjectSet("hi.4.p1",OBJPROP_RAY,false);
      ObjectSet("hi.4.p1",OBJPROP_COLOR,fib.SR.shadow.5.c);
      ObjectSetText("hi.4.p1",DoubleToStr(hi.ma.p1.4,Digits),7,"Arial",fib.SR.shadow.5.c);   }

// 5th level (hi.5.p1, lo.5.p1)
   if(lo.ma.p1.5-hi.ma.p1.5>Ask-Bid)   {
      ObjectCreate("lo.5.p1",OBJ_TREND,0,t1.p1, lo.ma.p1.5, t2.p1, lo.ma.p1.5);
      ObjectSet("lo.5.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.5.p1",OBJPROP_WIDTH,2);
      ObjectSet("lo.5.p1",OBJPROP_RAY,false);
      ObjectSet("lo.5.p1",OBJPROP_COLOR,fib.SR.shadow.6.c);
      ObjectSetText("lo.5.p1",DoubleToStr(lo.ma.p1.5,Digits),7,"Arial",fib.SR.shadow.6.c);

      ObjectCreate("hi.5.p1",OBJ_TREND,0,t1.p1, hi.ma.p1.5, t2.p1, hi.ma.p1.5);
      ObjectSet("hi.5.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.5.p1",OBJPROP_WIDTH,2);
      ObjectSet("hi.5.p1",OBJPROP_RAY,false);
      ObjectSet("hi.5.p1",OBJPROP_COLOR,fib.SR.shadow.6.c);
      ObjectSetText("hi.5.p1",DoubleToStr(hi.ma.p1.5,Digits),7,"Arial",fib.SR.shadow.6.c);   }

// 6th level (hi.6.p1, lo.6.p1)
   if(lo.ma.p1.6-hi.ma.p1.6>Ask-Bid)   {
      ObjectCreate("lo.6.p1",OBJ_TREND,0,t1.p1, lo.ma.p1.6, t2.p1, lo.ma.p1.6);
      ObjectSet("lo.6.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.6.p1",OBJPROP_WIDTH,2);
      ObjectSet("lo.6.p1",OBJPROP_RAY,false);
      ObjectSet("lo.6.p1",OBJPROP_COLOR,fib.SR.shadow.7.c);
      ObjectSetText("lo.6.p1",DoubleToStr(lo.ma.p1.6,Digits),7,"Arial",fib.SR.shadow.7.c);

      ObjectCreate("hi.6.p1",OBJ_TREND,0,t1.p1, hi.ma.p1.6, t2.p1, hi.ma.p1.6);
      ObjectSet("hi.6.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.6.p1",OBJPROP_WIDTH,2);
      ObjectSet("hi.6.p1",OBJPROP_RAY,false);
      ObjectSet("hi.6.p1",OBJPROP_COLOR,fib.SR.shadow.7.c);
      ObjectSetText("hi.6.p1",DoubleToStr(hi.ma.p1.6,Digits),7,"Arial",fib.SR.shadow.7.c);   }
//...............Moving Average Support & Resistance Levels..............................
   string space="             ";
   //   ObjectCreate("ma1.p1",OBJ_TEXT,0,t1.p1,ma1.p1);//13 ma
      ObjectSetText("ma1.p1",space+DoubleToStr(ma1.p1,Digits),8,"Arial",White);

   //   ObjectCreate("ma2.p1",OBJ_TEXT,0,t1.p1,ma2.p1);//21 ma
      ObjectSetText("ma2.p1",space+DoubleToStr(ma2.p1,Digits),8,"Arial",White);      

   //   ObjectCreate("ma3.p1",OBJ_TEXT,0,t1.p1,ma3.p1);//34 ma
      if(Bid>ma3.p1) {ObjectSetText("ma3.p1",space+DoubleToStr(ma3.p1,Digits),8,"Arial",ColorAbove2);}
      if(Ask<ma3.p1) {ObjectSetText("ma3.p1",space+DoubleToStr(ma3.p1,Digits),8,"Arial",ColorBelow2);}
      if(Bid<=ma3.p1 && Ask>=ma3.p1)  {
         ObjectSetText("ma3.p1",space+DoubleToStr(ma3.p1,Digits),8,"Arial",Yellow);}

    //  ObjectCreate("ma4.p1",OBJ_TEXT,0,t1.p1,ma4.p1);//55 ma
      if(Bid>ma4.p1) {ObjectSetText("ma4.p1",space+DoubleToStr(ma4.p1,Digits),8,"Arial",ColorAbove2);}
      if(Ask<ma4.p1) {ObjectSetText("ma4.p1",space+DoubleToStr(ma4.p1,Digits),8,"Arial",ColorBelow2);}
      if(Bid<=ma4.p1 && Ask>=ma4.p1)  {
         ObjectSetText("ma4.p1",space+DoubleToStr(ma4.p1,Digits),8,"Arial",Yellow);}

   //   ObjectCreate("ma5.p1",OBJ_TEXT,0,t1.p1,ma5.p1);//89 ma
      if(Bid>ma5.p1) {ObjectSetText("ma5.p1",space+DoubleToStr(ma5.p1,Digits),8,"Arial",ColorAbove);}
      if(Ask<ma5.p1) {ObjectSetText("ma5.p1",space+DoubleToStr(ma5.p1,Digits),8,"Arial",ColorBelow);}
      if(Bid<=ma5.p1 && Ask>=ma5.p1)  {
         ObjectSetText("ma5.p1",space+DoubleToStr(ma5.p1,Digits),8,"Arial",Yellow);}

    //  ObjectCreate("ma6.p1",OBJ_TEXT,0,t1.p1,NormalizeDouble(ma6.p1,Digits));//144 ma
      if(Bid>ma6.p1) {ObjectSetText("ma6.p1",space+DoubleToStr(ma6.p1,Digits),8,"Arial",ColorAbove);}
      if(Ask<ma6.p1) {ObjectSetText("ma6.p1",space+DoubleToStr(ma6.p1,Digits),8,"Arial",ColorBelow);}
      if(Bid<=ma6.p1 && Ask>=ma6.p1)  {
         ObjectSetText("ma6.p1",space+DoubleToStr(ma6.p1,Digits),8,"Arial",Yellow);}

     // ObjectCreate("ma7.p1",OBJ_TEXT,0,t1.p1,NormalizeDouble(ma7.p1,Digits));//233 ma
      if(Bid>ma7.p1) {ObjectSetText("ma7.p1",space+DoubleToStr(ma7.p1,Digits),8,"Arial",ColorAbove);}
      if(Ask<ma7.p1) {ObjectSetText("ma7.p1",space+DoubleToStr(ma7.p1,Digits),8,"Arial",ColorBelow);}
      if(Bid<=ma7.p1 && Ask>=ma7.p1)  {
         ObjectSetText("ma7.p1",space+DoubleToStr(ma7.p1,Digits),8,"Arial",Yellow);}
         
         
SRRR(p1.ma) ; 

      ObjectCreate("resistance.p1",OBJ_TREND,0,t1.p1, resistance, t2.p1, resistance);
      ObjectSet("resistance.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("resistance.p1",OBJPROP_WIDTH,2);
      ObjectSet("resistance.p1",OBJPROP_RAY,false);
      ObjectSet("resistance.p1",OBJPROP_COLOR,ColorUpper);
      ObjectSetText("resistance.p1",DoubleToStr(resistance,Digits),7,"Arial",ColorUpper);


      ObjectCreate("goShort.p1",OBJ_TREND,0,t1.p1, goShort, t2.p1, goShort);
      ObjectSet("goShort.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("goShort.p1",OBJPROP_WIDTH,2);
      ObjectSet("goShort.p1",OBJPROP_RAY,false);
      ObjectSet("goShort.p1",OBJPROP_COLOR,ColorShort);
      ObjectSetText("goShort.p1",DoubleToStr(goShort,Digits),7,"Arial",ColorShort);
 

      ObjectCreate("goLong.p1",OBJ_TREND,0,t1.p1, goLong, t2.p1, goLong);
      ObjectSet("goLong.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("goLong.p1",OBJPROP_WIDTH,2);
      ObjectSet("goLong.p1",OBJPROP_RAY,false);
      ObjectSet("goLong.p1",OBJPROP_COLOR,ColorLong);
      ObjectSetText("goLong.p1",DoubleToStr(goLong,Digits),7,"Arial",ColorLong);


      ObjectCreate("support.p1",OBJ_TREND,0,t1.p1, support, t2.p1, support);
      ObjectSet("support.p1",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("support.p1",OBJPROP_WIDTH,2);
      ObjectSet("support.p1",OBJPROP_RAY,false);
      ObjectSet("support.p1",OBJPROP_COLOR,ColorLower);
      ObjectSetText("support.p1",DoubleToStr(support,Digits),7,"Arial",ColorLower);    
                        
}//end p1.Fib.Plot()

//+------------------------------------------------------------------+

void p2.Fib.Plot()   {
//p2 dynamic fibo levels
   double lo.ma.p2,hi.ma.p2;
   lo.ma.p2=ma1.p2;
   if(ma2.p2<lo.ma.p2)  {lo.ma.p2=ma2.p2;}
   if(ma3.p2<lo.ma.p2)  {lo.ma.p2=ma3.p2;}
   if(ma4.p2<lo.ma.p2)  {lo.ma.p2=ma4.p2;}
   if(ma5.p2<lo.ma.p2)  {lo.ma.p2=ma5.p2;}
   if(ma6.p2<lo.ma.p2)  {lo.ma.p2=ma6.p2;}
   if(ma7.p2<lo.ma.p2)  {lo.ma.p2=ma7.p2;}
   lo.ma.p2=NormalizeDouble(lo.ma.p2+(fib.SR.shadow.1*Point),Digits);

   hi.ma.p2=ma7.p2;
   if(ma6.p2>hi.ma.p2)  {hi.ma.p2=ma6.p2;}
   if(ma5.p2>hi.ma.p2)  {hi.ma.p2=ma5.p2;}
   if(ma4.p2>hi.ma.p2)  {hi.ma.p2=ma4.p2;}
   if(ma3.p2>hi.ma.p2)  {hi.ma.p2=ma3.p2;}
   if(ma2.p2>hi.ma.p2)  {hi.ma.p2=ma2.p2;}
   if(ma1.p2>hi.ma.p2)  {hi.ma.p2=ma1.p2;}
   hi.ma.p2=NormalizeDouble(hi.ma.p2-(fib.SR.shadow.1*Point),Digits); 


//p2 center dynamic fib placement      
   if(lo.ma.p2-hi.ma.p2>Ask-Bid)   {
      ObjectCreate("lcf.p2",OBJ_TREND,0,t1.p2, lo.ma.p2, t2.p2, lo.ma.p2);
      ObjectSet("lcf.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lcf.p2",OBJPROP_WIDTH,2);
      ObjectSet("lcf.p2",OBJPROP_RAY,false);
      ObjectSet("lcf.p2",OBJPROP_COLOR,fib.SR.shadow.1.c);
      ObjectSetText("lcf.p2",DoubleToStr(lo.ma.p2,Digits),7,"Arial",fib.SR.shadow.1.c);

      ObjectCreate("hcf.p2",OBJ_TREND,0,t1.p2, hi.ma.p2, t2.p2, hi.ma.p2);
      ObjectSet("hcf.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hcf.p2",OBJPROP_WIDTH,2);
      ObjectSet("hcf.p2",OBJPROP_RAY,false);
      ObjectSet("hcf.p2",OBJPROP_COLOR,fib.SR.shadow.1.c);
      ObjectSetText("hcf.p2",DoubleToStr(hi.ma.p2,Digits),7,"Arial",fib.SR.shadow.1.c);   }      
 
   double lo.ma.p2.1, lo.ma.p2.2, lo.ma.p2.3, lo.ma.p2.4, lo.ma.p2.5, lo.ma.p2.6;
   lo.ma.p2.1=lo.ma.p2+(fib.SR.shadow.2*Point);
   lo.ma.p2.2=lo.ma.p2.1+(fib.SR.shadow.3*Point);
   lo.ma.p2.3=lo.ma.p2.2+(fib.SR.shadow.4*Point);
   lo.ma.p2.4=lo.ma.p2.3+(fib.SR.shadow.5*Point);
   lo.ma.p2.5=lo.ma.p2.4+(fib.SR.shadow.6*Point);
   lo.ma.p2.6=lo.ma.p2.5+(fib.SR.shadow.7*Point);
     
   double hi.ma.p2.1, hi.ma.p2.2, hi.ma.p2.3, hi.ma.p2.4, hi.ma.p2.5, hi.ma.p2.6;
   hi.ma.p2.1=hi.ma.p2-(fib.SR.shadow.2*Point);
   hi.ma.p2.2=hi.ma.p2.1-(fib.SR.shadow.3*Point);
   hi.ma.p2.3=hi.ma.p2.2-(fib.SR.shadow.4*Point);
   hi.ma.p2.4=hi.ma.p2.3-(fib.SR.shadow.5*Point);
   hi.ma.p2.5=hi.ma.p2.4-(fib.SR.shadow.6*Point);
   hi.ma.p2.6=hi.ma.p2.5-(fib.SR.shadow.7*Point);

//p2 1st level (hi.1.p2, lo.1.p2)
   if(lo.ma.p2.1-hi.ma.p2.1>Ask-Bid)   {
      ObjectCreate("lo.1.p2",OBJ_TREND,0,t1.p2, lo.ma.p2.1, t2.p2, lo.ma.p2.1);
      ObjectSet("lo.1.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.1.p2",OBJPROP_WIDTH,2);
      ObjectSet("lo.1.p2",OBJPROP_RAY,false);
      ObjectSet("lo.1.p2",OBJPROP_COLOR,fib.SR.shadow.2.c);
      ObjectSetText("lo.1.p2",DoubleToStr(lo.ma.p2.1,Digits),7,"Arial",fib.SR.shadow.2.c);

      ObjectCreate("hi.1.p2",OBJ_TREND,0,t1.p2, hi.ma.p2.1, t2.p2, hi.ma.p2.1);
      ObjectSet("hi.1.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.1.p2",OBJPROP_WIDTH,2);
      ObjectSet("hi.1.p2",OBJPROP_RAY,false);
      ObjectSet("hi.1.p2",OBJPROP_COLOR,fib.SR.shadow.2.c);
      ObjectSetText("hi.1.p2",DoubleToStr(hi.ma.p2.1,Digits),7,"Arial",fib.SR.shadow.2.c);   }

// 2st level (hi.2.p2, lo.2.p2)
   if(lo.ma.p2.2-hi.ma.p2.2>Ask-Bid)   {
      ObjectCreate("lo.2.p2",OBJ_TREND,0,t1.p2, lo.ma.p2.2, t2.p2, lo.ma.p2.2);
      ObjectSet("lo.2.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.2.p2",OBJPROP_WIDTH,2);
      ObjectSet("lo.2.p2",OBJPROP_RAY,false);
      ObjectSet("lo.2.p2",OBJPROP_COLOR,fib.SR.shadow.3.c);
      ObjectSetText("lo.2.p2",DoubleToStr(lo.ma.p2.2,Digits),7,"Arial",fib.SR.shadow.3.c);

      ObjectCreate("hi.2.p2",OBJ_TREND,0,t1.p2, hi.ma.p2.2, t2.p2, hi.ma.p2.2);
      ObjectSet("hi.2.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.2.p2",OBJPROP_WIDTH,2);
      ObjectSet("hi.2.p2",OBJPROP_RAY,false);
      ObjectSet("hi.2.p2",OBJPROP_COLOR,fib.SR.shadow.3.c);
      ObjectSetText("hi.2.p2",DoubleToStr(hi.ma.p2.2,Digits),7,"Arial",fib.SR.shadow.3.c);   }     

// 3rd level (hi.3.p2, lo.3.p2)
   if(lo.ma.p2.3-hi.ma.p2.3>Ask-Bid)   {
      ObjectCreate("lo.3.p2",OBJ_TREND,0,t1.p2, lo.ma.p2.3, t2.p2, lo.ma.p2.3);
      ObjectSet("lo.3.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.3.p2",OBJPROP_WIDTH,2);
      ObjectSet("lo.3.p2",OBJPROP_RAY,false);
      ObjectSet("lo.3.p2",OBJPROP_COLOR,fib.SR.shadow.4.c);
      ObjectSetText("lo.3.p2",DoubleToStr(lo.ma.p2.3,Digits),7,"Arial",fib.SR.shadow.4.c);

      ObjectCreate("hi.3.p2",OBJ_TREND,0,t1.p2, hi.ma.p2.3, t2.p2, hi.ma.p2.3);
      ObjectSet("hi.3.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.3.p2",OBJPROP_WIDTH,2);
      ObjectSet("hi.3.p2",OBJPROP_RAY,false);
      ObjectSet("hi.3.p2",OBJPROP_COLOR,fib.SR.shadow.4.c);
      ObjectSetText("hi.3.p2",DoubleToStr(hi.ma.p2.3,Digits),7,"Arial",fib.SR.shadow.4.c);   }    

// 4th level (hi.4.p2, lo.4.p2)
   if(lo.ma.p2.4-hi.ma.p2.4>Ask-Bid)   {
      ObjectCreate("lo.4.p2",OBJ_TREND,0,t1.p2, lo.ma.p2.4, t2.p2, lo.ma.p2.4);
      ObjectSet("lo.4.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.4.p2",OBJPROP_WIDTH,2);
      ObjectSet("lo.4.p2",OBJPROP_RAY,false);
      ObjectSet("lo.4.p2",OBJPROP_COLOR,fib.SR.shadow.5.c);
      ObjectSetText("lo.4.p2",DoubleToStr(lo.ma.p2.4,Digits),7,"Arial",fib.SR.shadow.5.c);

      ObjectCreate("hi.4.p2",OBJ_TREND,0,t1.p2, hi.ma.p2.4, t2.p2, hi.ma.p2.4);
      ObjectSet("hi.4.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.4.p2",OBJPROP_WIDTH,2);
      ObjectSet("hi.4.p2",OBJPROP_RAY,false);
      ObjectSet("hi.4.p2",OBJPROP_COLOR,fib.SR.shadow.5.c);
      ObjectSetText("hi.4.p2",DoubleToStr(hi.ma.p2.4,Digits),7,"Arial",fib.SR.shadow.5.c);   }

// 5th level (hi.5.p2, lo.5.p2)
   if(lo.ma.p2.5-hi.ma.p2.5>Ask-Bid)   {
      ObjectCreate("lo.5.p2",OBJ_TREND,0,t1.p2, lo.ma.p2.5, t2.p2, lo.ma.p2.5);
      ObjectSet("lo.5.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.5.p2",OBJPROP_WIDTH,2);
      ObjectSet("lo.5.p2",OBJPROP_RAY,false);
      ObjectSet("lo.5.p2",OBJPROP_COLOR,fib.SR.shadow.6.c);
      ObjectSetText("lo.5.p2",DoubleToStr(lo.ma.p2.5,Digits),7,"Arial",fib.SR.shadow.6.c);

      ObjectCreate("hi.5.p2",OBJ_TREND,0,t1.p2, hi.ma.p2.5, t2.p2, hi.ma.p2.5);
      ObjectSet("hi.5.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.5.p2",OBJPROP_WIDTH,2);
      ObjectSet("hi.5.p2",OBJPROP_RAY,false);
      ObjectSet("hi.5.p2",OBJPROP_COLOR,fib.SR.shadow.6.c);
      ObjectSetText("hi.5.p2",DoubleToStr(hi.ma.p2.5,Digits),7,"Arial",fib.SR.shadow.6.c);   }

// 6th level (hi.6.p2, lo.6.p2)
   if(lo.ma.p2.6-hi.ma.p2.6>Ask-Bid)   {
      ObjectCreate("lo.6.p2",OBJ_TREND,0,t1.p2, lo.ma.p2.6, t2.p2, lo.ma.p2.6);
      ObjectSet("lo.6.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.6.p2",OBJPROP_WIDTH,2);
      ObjectSet("lo.6.p2",OBJPROP_RAY,false);
      ObjectSet("lo.6.p2",OBJPROP_COLOR,fib.SR.shadow.7.c);
      ObjectSetText("lo.6.p2",DoubleToStr(lo.ma.p2.6,Digits),7,"Arial",fib.SR.shadow.7.c);

      ObjectCreate("hi.6.p2",OBJ_TREND,0,t1.p2, hi.ma.p2.6, t2.p2, hi.ma.p2.6);
      ObjectSet("hi.6.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.6.p2",OBJPROP_WIDTH,2);
      ObjectSet("hi.6.p2",OBJPROP_RAY,false);
      ObjectSet("hi.6.p2",OBJPROP_COLOR,fib.SR.shadow.7.c);
      ObjectSetText("hi.6.p2",DoubleToStr(hi.ma.p2.6,Digits),7,"Arial",fib.SR.shadow.7.c);   }
//...............Moving Average Support & Resistance Levels..............................
   string space="             ";
     // ObjectCreate("ma1.p2",OBJ_TEXT,0,t1.p2,ma1.p2);//13 ma
      ObjectSetText("ma1.p2",space+DoubleToStr(ma1.p2,Digits),8,"Arial",White);

     // ObjectCreate("ma2.p2",OBJ_TEXT,0,t1.p2,ma2.p2);//21 ma
      ObjectSetText("ma2.p2",space+DoubleToStr(ma2.p2,Digits),8,"Arial",White);      

    //  ObjectCreate("ma3.p2",OBJ_TEXT,0,t1.p2,ma3.p2);//34 ma
      if(Bid>ma3.p2) {ObjectSetText("ma3.p2",space+DoubleToStr(ma3.p2,Digits),8,"Arial",ColorAbove2);}
      if(Ask<ma3.p2) {ObjectSetText("ma3.p2",space+DoubleToStr(ma3.p2,Digits),8,"Arial",ColorBelow2);}
      if(Bid<=ma3.p2 && Ask>=ma3.p2)  {
         ObjectSetText("ma3.p2",space+DoubleToStr(ma3.p2,Digits),8,"Arial",Yellow);}

     // ObjectCreate("ma4.p2",OBJ_TEXT,0,t1.p2,ma4.p2);//55 ma
      if(Bid>ma4.p2) {ObjectSetText("ma4.p2",space+DoubleToStr(ma4.p2,Digits),8,"Arial",ColorAbove2);}
      if(Ask<ma4.p2) {ObjectSetText("ma4.p2",space+DoubleToStr(ma4.p2,Digits),8,"Arial",ColorBelow2);}
      if(Bid<=ma4.p2 && Ask>=ma4.p2)  {
         ObjectSetText("ma4.p2",space+DoubleToStr(ma4.p2,Digits),8,"Arial",Yellow);}

      //ObjectCreate("ma5.p2",OBJ_TEXT,0,t1.p2,ma5.p2);//89 ma
      if(Bid>ma5.p2) {ObjectSetText("ma5.p2",space+DoubleToStr(ma5.p2,Digits),8,"Arial",ColorAbove);}
      if(Ask<ma5.p2) {ObjectSetText("ma5.p2",space+DoubleToStr(ma5.p2,Digits),8,"Arial",ColorBelow);}
      if(Bid<=ma5.p2 && Ask>=ma5.p2)  {
         ObjectSetText("ma5.p2",space+DoubleToStr(ma5.p2,Digits),8,"Arial",Yellow);}

     // ObjectCreate("ma6.p2",OBJ_TEXT,0,t1.p2,NormalizeDouble(ma6.p2,Digits));//144 ma
      if(Bid>ma6.p2) {ObjectSetText("ma6.p2",space+DoubleToStr(ma6.p2,Digits),8,"Arial",ColorAbove);}
      if(Ask<ma6.p2) {ObjectSetText("ma6.p2",space+DoubleToStr(ma6.p2,Digits),8,"Arial",ColorBelow);}
      if(Bid<=ma6.p2 && Ask>=ma6.p2)  {
         ObjectSetText("ma6.p2",space+DoubleToStr(ma6.p2,Digits),8,"Arial",Yellow);}

     // ObjectCreate("ma7.p2",OBJ_TEXT,0,t1.p2,NormalizeDouble(ma7.p2,Digits));//233 ma
      if(Bid>ma7.p2) {ObjectSetText("ma7.p2",space+DoubleToStr(ma7.p2,Digits),8,"Arial",ColorAbove);}
      if(Ask<ma7.p2) {ObjectSetText("ma7.p2",space+DoubleToStr(ma7.p2,Digits),8,"Arial",ColorBelow);}
      if(Bid<=ma7.p2 && Ask>=ma7.p2)  {
         ObjectSetText("ma7.p2",space+DoubleToStr(ma7.p2,Digits),8,"Arial",Yellow);}
         
         
SRRR(p2.ma) ; 

      ObjectCreate("resistance.p2",OBJ_TREND,0,t1.p2, resistance, t2.p2, resistance);
      ObjectSet("resistance.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("resistance.p2",OBJPROP_WIDTH,2);
      ObjectSet("resistance.p2",OBJPROP_RAY,false);
      ObjectSet("resistance.p2",OBJPROP_COLOR,ColorUpper);
      ObjectSetText("resistance.p2",DoubleToStr(resistance,Digits),7,"Arial",ColorUpper);


      ObjectCreate("goShort.p2",OBJ_TREND,0,t1.p2, goShort, t2.p2, goShort);
      ObjectSet("goShort.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("goShort.p2",OBJPROP_WIDTH,2);
      ObjectSet("goShort.p2",OBJPROP_RAY,false);
      ObjectSet("goShort.p2",OBJPROP_COLOR,ColorShort);
      ObjectSetText("goShort.p2",DoubleToStr(goShort,Digits),7,"Arial",ColorShort);
 

      ObjectCreate("goLong.p2",OBJ_TREND,0,t1.p2, goLong, t2.p2, goLong);
      ObjectSet("goLong.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("goLong.p2",OBJPROP_WIDTH,2);
      ObjectSet("goLong.p2",OBJPROP_RAY,false);
      ObjectSet("goLong.p2",OBJPROP_COLOR,ColorLong);
      ObjectSetText("goLong.p2",DoubleToStr(goLong,Digits),7,"Arial",ColorLong);


      ObjectCreate("support.p2",OBJ_TREND,0,t1.p2, support, t2.p2, support);
      ObjectSet("support.p2",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("support.p2",OBJPROP_WIDTH,2);
      ObjectSet("support.p2",OBJPROP_RAY,false);
      ObjectSet("support.p2",OBJPROP_COLOR,ColorLower);
      ObjectSetText("support.p2",DoubleToStr(support,Digits),7,"Arial",ColorLower);    

         
}//end p2.Fib.Plot()

//+------------------------------------------------------------------+

void p3.Fib.Plot()   {
//p3 dynamic fibo levels
   double lo.ma.p3,hi.ma.p3;
   lo.ma.p3=ma1.p3;
   if(ma2.p3<lo.ma.p3)  {lo.ma.p3=ma2.p3;}
   if(ma3.p3<lo.ma.p3)  {lo.ma.p3=ma3.p3;}
   if(ma4.p3<lo.ma.p3)  {lo.ma.p3=ma4.p3;}
   if(ma5.p3<lo.ma.p3)  {lo.ma.p3=ma5.p3;}
   if(ma6.p3<lo.ma.p3)  {lo.ma.p3=ma6.p3;}
   if(ma7.p3<lo.ma.p3)  {lo.ma.p3=ma7.p3;}
   lo.ma.p3=NormalizeDouble(lo.ma.p3+(fib.SR.shadow.1*Point),Digits);

   hi.ma.p3=ma7.p3;
   if(ma6.p3>hi.ma.p3)  {hi.ma.p3=ma6.p3;}
   if(ma5.p3>hi.ma.p3)  {hi.ma.p3=ma5.p3;}
   if(ma4.p3>hi.ma.p3)  {hi.ma.p3=ma4.p3;}
   if(ma3.p3>hi.ma.p3)  {hi.ma.p3=ma3.p3;}
   if(ma2.p3>hi.ma.p3)  {hi.ma.p3=ma2.p3;}
   if(ma1.p3>hi.ma.p3)  {hi.ma.p3=ma1.p3;}
   hi.ma.p3=NormalizeDouble(hi.ma.p3-(fib.SR.shadow.1*Point),Digits);

//p3 center dynamic fib placement      
   if(lo.ma.p3-hi.ma.p3>Ask-Bid)   {
      ObjectCreate("lcf.p3",OBJ_TREND,0,t1.p3, lo.ma.p3, t2.p3, lo.ma.p3);
      ObjectSet("lcf.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lcf.p3",OBJPROP_WIDTH,2);
      ObjectSet("lcf.p3",OBJPROP_RAY,false);
      ObjectSet("lcf.p3",OBJPROP_COLOR,fib.SR.shadow.1.c);
      ObjectSetText("lcf.p3",DoubleToStr(lo.ma.p3,Digits),7,"Arial",fib.SR.shadow.1.c);

      ObjectCreate("hcf.p3",OBJ_TREND,0,t1.p3, hi.ma.p3, t2.p3, hi.ma.p3);
      ObjectSet("hcf.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hcf.p3",OBJPROP_WIDTH,2);
      ObjectSet("hcf.p3",OBJPROP_RAY,false);
      ObjectSet("hcf.p3",OBJPROP_COLOR,fib.SR.shadow.1.c);
      ObjectSetText("hcf.p3",DoubleToStr(hi.ma.p3,Digits),7,"Arial",fib.SR.shadow.1.c);   }      
 
   double lo.ma.p3.1, lo.ma.p3.2, lo.ma.p3.3, lo.ma.p3.4, lo.ma.p3.5, lo.ma.p3.6;
   lo.ma.p3.1=lo.ma.p3+(fib.SR.shadow.2*Point);
   lo.ma.p3.2=lo.ma.p3.1+(fib.SR.shadow.3*Point);
   lo.ma.p3.3=lo.ma.p3.2+(fib.SR.shadow.4*Point);
   lo.ma.p3.4=lo.ma.p3.3+(fib.SR.shadow.5*Point);
   lo.ma.p3.5=lo.ma.p3.4+(fib.SR.shadow.6*Point);
   lo.ma.p3.6=lo.ma.p3.5+(fib.SR.shadow.7*Point);
     
   double hi.ma.p3.1, hi.ma.p3.2, hi.ma.p3.3, hi.ma.p3.4, hi.ma.p3.5, hi.ma.p3.6;
   hi.ma.p3.1=hi.ma.p3-(fib.SR.shadow.2*Point);
   hi.ma.p3.2=hi.ma.p3.1-(fib.SR.shadow.3*Point);
   hi.ma.p3.3=hi.ma.p3.2-(fib.SR.shadow.4*Point);
   hi.ma.p3.4=hi.ma.p3.3-(fib.SR.shadow.5*Point);
   hi.ma.p3.5=hi.ma.p3.4-(fib.SR.shadow.6*Point);
   hi.ma.p3.6=hi.ma.p3.5-(fib.SR.shadow.7*Point);

//p3 1st level (hi.1.p3, lo.1.p3)
   if(lo.ma.p3.1-hi.ma.p3.1>Ask-Bid)   {
      ObjectCreate("lo.1.p3",OBJ_TREND,0,t1.p3, lo.ma.p3.1, t2.p3, lo.ma.p3.1);
      ObjectSet("lo.1.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.1.p3",OBJPROP_WIDTH,2);
      ObjectSet("lo.1.p3",OBJPROP_RAY,false);
      ObjectSet("lo.1.p3",OBJPROP_COLOR,fib.SR.shadow.2.c);
      ObjectSetText("lo.1.p3",DoubleToStr(lo.ma.p3.1,Digits),7,"Arial",fib.SR.shadow.2.c);

      ObjectCreate("hi.1.p3",OBJ_TREND,0,t1.p3, hi.ma.p3.1, t2.p3, hi.ma.p3.1);
      ObjectSet("hi.1.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.1.p3",OBJPROP_WIDTH,2);
      ObjectSet("hi.1.p3",OBJPROP_RAY,false);
      ObjectSet("hi.1.p3",OBJPROP_COLOR,fib.SR.shadow.2.c);
      ObjectSetText("hi.1.p3",DoubleToStr(hi.ma.p3.1,Digits),7,"Arial",fib.SR.shadow.2.c);   }

// 2st level (hi.2.p3, lo.2.p3)
   if(lo.ma.p3.2-hi.ma.p3.2>Ask-Bid)   {
      ObjectCreate("lo.2.p3",OBJ_TREND,0,t1.p3, lo.ma.p3.2, t2.p3, lo.ma.p3.2);
      ObjectSet("lo.2.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.2.p3",OBJPROP_WIDTH,2);
      ObjectSet("lo.2.p3",OBJPROP_RAY,false);
      ObjectSet("lo.2.p3",OBJPROP_COLOR,fib.SR.shadow.3.c);
      ObjectSetText("lo.2.p3",DoubleToStr(lo.ma.p3.2,Digits),7,"Arial",fib.SR.shadow.3.c);

      ObjectCreate("hi.2.p3",OBJ_TREND,0,t1.p3, hi.ma.p3.2, t2.p3, hi.ma.p3.2);
      ObjectSet("hi.2.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.2.p3",OBJPROP_WIDTH,2);
      ObjectSet("hi.2.p3",OBJPROP_RAY,false);
      ObjectSet("hi.2.p3",OBJPROP_COLOR,fib.SR.shadow.3.c);
      ObjectSetText("hi.2.p3",DoubleToStr(hi.ma.p3.2,Digits),7,"Arial",fib.SR.shadow.3.c);   }     

// 3rd level (hi.3.p3, lo.3.p3)
   if(lo.ma.p3.3-hi.ma.p3.3>Ask-Bid)   {
      ObjectCreate("lo.3.p3",OBJ_TREND,0,t1.p3, lo.ma.p3.3, t2.p3, lo.ma.p3.3);
      ObjectSet("lo.3.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.3.p3",OBJPROP_WIDTH,2);
      ObjectSet("lo.3.p3",OBJPROP_RAY,false);
      ObjectSet("lo.3.p3",OBJPROP_COLOR,fib.SR.shadow.4.c);
      ObjectSetText("lo.3.p3",DoubleToStr(lo.ma.p3.3,Digits),7,"Arial",fib.SR.shadow.4.c);

      ObjectCreate("hi.3.p3",OBJ_TREND,0,t1.p3, hi.ma.p3.3, t2.p3, hi.ma.p3.3);
      ObjectSet("hi.3.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.3.p3",OBJPROP_WIDTH,2);
      ObjectSet("hi.3.p3",OBJPROP_RAY,false);
      ObjectSet("hi.3.p3",OBJPROP_COLOR,fib.SR.shadow.4.c);
      ObjectSetText("hi.3.p3",DoubleToStr(hi.ma.p3.3,Digits),7,"Arial",fib.SR.shadow.4.c);   }    

// 4th level (hi.4.p3, lo.4.p3)
   if(lo.ma.p3.4-hi.ma.p3.4>Ask-Bid)   {
      ObjectCreate("lo.4.p3",OBJ_TREND,0,t1.p3, lo.ma.p3.4, t2.p3, lo.ma.p3.4);
      ObjectSet("lo.4.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.4.p3",OBJPROP_WIDTH,2);
      ObjectSet("lo.4.p3",OBJPROP_RAY,false);
      ObjectSet("lo.4.p3",OBJPROP_COLOR,fib.SR.shadow.5.c);
      ObjectSetText("lo.4.p3",DoubleToStr(lo.ma.p3.4,Digits),7,"Arial",fib.SR.shadow.5.c);

      ObjectCreate("hi.4.p3",OBJ_TREND,0,t1.p3, hi.ma.p3.4, t2.p3, hi.ma.p3.4);
      ObjectSet("hi.4.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.4.p3",OBJPROP_WIDTH,2);
      ObjectSet("hi.4.p3",OBJPROP_RAY,false);
      ObjectSet("hi.4.p3",OBJPROP_COLOR,fib.SR.shadow.5.c);
      ObjectSetText("hi.4.p3",DoubleToStr(hi.ma.p3.4,Digits),7,"Arial",fib.SR.shadow.5.c);   }

// 5th level (hi.5.p3, lo.5.p3)
   if(lo.ma.p3.5-hi.ma.p3.5>Ask-Bid)   {
      ObjectCreate("lo.5.p3",OBJ_TREND,0,t1.p3, lo.ma.p3.5, t2.p3, lo.ma.p3.5);
      ObjectSet("lo.5.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.5.p3",OBJPROP_WIDTH,2);
      ObjectSet("lo.5.p3",OBJPROP_RAY,false);
      ObjectSet("lo.5.p3",OBJPROP_COLOR,fib.SR.shadow.6.c);
      ObjectSetText("lo.5.p3",DoubleToStr(lo.ma.p3.5,Digits),7,"Arial",fib.SR.shadow.6.c);

      ObjectCreate("hi.5.p3",OBJ_TREND,0,t1.p3, hi.ma.p3.5, t2.p3, hi.ma.p3.5);
      ObjectSet("hi.5.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.5.p3",OBJPROP_WIDTH,2);
      ObjectSet("hi.5.p3",OBJPROP_RAY,false);
      ObjectSet("hi.5.p3",OBJPROP_COLOR,fib.SR.shadow.6.c);
      ObjectSetText("hi.5.p3",DoubleToStr(hi.ma.p3.5,Digits),7,"Arial",fib.SR.shadow.6.c);   }

// 6th level (hi.6.p3, lo.6.p3)
   if(lo.ma.p3.6-hi.ma.p3.6>Ask-Bid)   {
      ObjectCreate("lo.6.p3",OBJ_TREND,0,t1.p3, lo.ma.p3.6, t2.p3, lo.ma.p3.6);
      ObjectSet("lo.6.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.6.p3",OBJPROP_WIDTH,2);
      ObjectSet("lo.6.p3",OBJPROP_RAY,false);
      ObjectSet("lo.6.p3",OBJPROP_COLOR,fib.SR.shadow.7.c);
      ObjectSetText("lo.6.p3",DoubleToStr(lo.ma.p3.6,Digits),7,"Arial",fib.SR.shadow.7.c);

      ObjectCreate("hi.6.p3",OBJ_TREND,0,t1.p3, hi.ma.p3.6, t2.p3, hi.ma.p3.6);
      ObjectSet("hi.6.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.6.p3",OBJPROP_WIDTH,2);
      ObjectSet("hi.6.p3",OBJPROP_RAY,false);
      ObjectSet("hi.6.p3",OBJPROP_COLOR,fib.SR.shadow.7.c);
      ObjectSetText("hi.6.p3",DoubleToStr(hi.ma.p3.6,Digits),7,"Arial",fib.SR.shadow.7.c);   }
//...............Moving Average Support & Resistance Levels..............................
   string space="             ";
    //  ObjectCreate("ma1.p3",OBJ_TEXT,0,t1.p3,ma1.p3);//13 ma
      ObjectSetText("ma1.p3",space+DoubleToStr(ma1.p3,Digits),8,"Arial",White);

    //  ObjectCreate("ma2.p3",OBJ_TEXT,0,t1.p3,ma2.p3);//21 ma
      ObjectSetText("ma2.p3",space+DoubleToStr(ma2.p3,Digits),8,"Arial",White);      

    //  ObjectCreate("ma3.p3",OBJ_TEXT,0,t1.p3,ma3.p3);//34 ma
      if(Bid>ma3.p3) {ObjectSetText("ma3.p3",space+DoubleToStr(ma3.p3,Digits),8,"Arial",ColorAbove2);}
      if(Ask<ma3.p3) {ObjectSetText("ma3.p3",space+DoubleToStr(ma3.p3,Digits),8,"Arial",ColorBelow2);}
      if(Bid<=ma3.p3 && Ask>=ma3.p3)  {
         ObjectSetText("ma3.p3",space+DoubleToStr(ma3.p3,Digits),8,"Arial",Yellow);}

    //  ObjectCreate("ma4.p3",OBJ_TEXT,0,t1.p3,ma4.p3);//55 ma
      if(Bid>ma4.p3) {ObjectSetText("ma4.p3",space+DoubleToStr(ma4.p3,Digits),8,"Arial",ColorAbove2);}
      if(Ask<ma4.p3) {ObjectSetText("ma4.p3",space+DoubleToStr(ma4.p3,Digits),8,"Arial",ColorBelow2);}
      if(Bid<=ma4.p3 && Ask>=ma4.p3)  {
         ObjectSetText("ma4.p3",space+DoubleToStr(ma4.p3,Digits),8,"Arial",Yellow);}

     // ObjectCreate("ma5.p3",OBJ_TEXT,0,t1.p3,ma5.p3);//89 ma
      if(Bid>ma5.p3) {ObjectSetText("ma5.p3",space+DoubleToStr(ma5.p3,Digits),8,"Arial",ColorAbove);}
      if(Ask<ma5.p3) {ObjectSetText("ma5.p3",space+DoubleToStr(ma5.p3,Digits),8,"Arial",ColorBelow);}
      if(Bid<=ma5.p3 && Ask>=ma5.p3)  {
         ObjectSetText("ma5.p3",space+DoubleToStr(ma5.p3,Digits),8,"Arial",Yellow);}

     // ObjectCreate("ma6.p3",OBJ_TEXT,0,t1.p3,NormalizeDouble(ma6.p3,Digits));//144 ma
      if(Bid>ma6.p3) {ObjectSetText("ma6.p3",space+DoubleToStr(ma6.p3,Digits),8,"Arial",ColorAbove);}
      if(Ask<ma6.p3) {ObjectSetText("ma6.p3",space+DoubleToStr(ma6.p3,Digits),8,"Arial",ColorBelow);}
      if(Bid<=ma6.p3 && Ask>=ma6.p3)  {
         ObjectSetText("ma6.p3",space+DoubleToStr(ma6.p3,Digits),8,"Arial",Yellow);}

     // ObjectCreate("ma7.p3",OBJ_TEXT,0,t1.p3,NormalizeDouble(ma7.p3,Digits));//233 ma
      if(Bid>ma7.p3) {ObjectSetText("ma7.p3",space+DoubleToStr(ma7.p3,Digits),8,"Arial",ColorAbove);}
      if(Ask<ma7.p3) {ObjectSetText("ma7.p3",space+DoubleToStr(ma7.p3,Digits),8,"Arial",ColorBelow);}
      if(Bid<=ma7.p3 && Ask>=ma7.p3)  {
         ObjectSetText("ma7.p3",space+DoubleToStr(ma7.p3,Digits),8,"Arial",Yellow);}
         
         



SRRR(p3.ma) ; 

      ObjectCreate("resistance.p3",OBJ_TREND,0,t1.p3, resistance, t2.p3, resistance);
      ObjectSet("resistance.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("resistance.p3",OBJPROP_WIDTH,2);
      ObjectSet("resistance.p3",OBJPROP_RAY,false);
      ObjectSet("resistance.p3",OBJPROP_COLOR,ColorUpper);
      ObjectSetText("resistance.p3",DoubleToStr(resistance,Digits),7,"Arial",ColorUpper);


      ObjectCreate("goShort.p3",OBJ_TREND,0,t1.p3, goShort, t2.p3, goShort);
      ObjectSet("goShort.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("goShort.p3",OBJPROP_WIDTH,2);
      ObjectSet("goShort.p3",OBJPROP_RAY,false);
      ObjectSet("goShort.p3",OBJPROP_COLOR,ColorShort);
      ObjectSetText("goShort.p3",DoubleToStr(goShort,Digits),7,"Arial",ColorShort);
 

      ObjectCreate("goLong.p3",OBJ_TREND,0,t1.p3, goLong, t2.p3, goLong);
      ObjectSet("goLong.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("goLong.p3",OBJPROP_WIDTH,2);
      ObjectSet("goLong.p3",OBJPROP_RAY,false);
      ObjectSet("goLong.p3",OBJPROP_COLOR,ColorLong);
      ObjectSetText("goLong.p3",DoubleToStr(goLong,Digits),7,"Arial",ColorLong);


      ObjectCreate("support.p3",OBJ_TREND,0,t1.p3, support, t2.p3, support);
      ObjectSet("support.p3",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("support.p3",OBJPROP_WIDTH,2);
      ObjectSet("support.p3",OBJPROP_RAY,false);
      ObjectSet("support.p3",OBJPROP_COLOR,ColorLower);
      ObjectSetText("support.p3",DoubleToStr(support,Digits),7,"Arial",ColorLower);    


}//end p3.Fib.Plot()

//+------------------------------------------------------------------+

void p4.Fib.Plot()   {
//p4 dynamic fibo levels
   double lo.ma.p4,hi.ma.p4;
   lo.ma.p4=ma1.p4;
   if(ma2.p4<lo.ma.p4)  {lo.ma.p4=ma2.p4;}
   if(ma3.p4<lo.ma.p4)  {lo.ma.p4=ma3.p4;}
   if(ma4.p4<lo.ma.p4)  {lo.ma.p4=ma4.p4;}
   if(ma5.p4<lo.ma.p4)  {lo.ma.p4=ma5.p4;}
   if(ma6.p4<lo.ma.p4)  {lo.ma.p4=ma6.p4;}
   if(ma7.p4<lo.ma.p4)  {lo.ma.p4=ma7.p4;}
   lo.ma.p4=NormalizeDouble(lo.ma.p4+(fib.SR.shadow.1*Point),Digits);

   hi.ma.p4=ma7.p4;
   if(ma6.p4>hi.ma.p4)  {hi.ma.p4=ma6.p4;}
   if(ma5.p4>hi.ma.p4)  {hi.ma.p4=ma5.p4;}
   if(ma4.p4>hi.ma.p4)  {hi.ma.p4=ma4.p4;}
   if(ma3.p4>hi.ma.p4)  {hi.ma.p4=ma3.p4;}
   if(ma2.p4>hi.ma.p4)  {hi.ma.p4=ma2.p4;}
   if(ma1.p4>hi.ma.p4)  {hi.ma.p4=ma1.p4;}
   hi.ma.p4=NormalizeDouble(hi.ma.p4-(fib.SR.shadow.1*Point),Digits);

//p4 center dynamic fib placement      
   if(lo.ma.p4-hi.ma.p4>Ask-Bid)   {
      ObjectCreate("lcf.p4",OBJ_TREND,0,t1.p4, lo.ma.p4, t2.p4, lo.ma.p4);
      ObjectSet("lcf.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lcf.p4",OBJPROP_WIDTH,2);
      ObjectSet("lcf.p4",OBJPROP_RAY,false);
      ObjectSet("lcf.p4",OBJPROP_COLOR,fib.SR.shadow.1.c);
      ObjectSetText("lcf.p4",DoubleToStr(lo.ma.p4,Digits),7,"Arial",fib.SR.shadow.1.c);

      ObjectCreate("hcf.p4",OBJ_TREND,0,t1.p4, hi.ma.p4, t2.p4, hi.ma.p4);
      ObjectSet("hcf.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hcf.p4",OBJPROP_WIDTH,2);
      ObjectSet("hcf.p4",OBJPROP_RAY,false);
      ObjectSet("hcf.p4",OBJPROP_COLOR,fib.SR.shadow.1.c);
      ObjectSetText("hcf.p4",DoubleToStr(hi.ma.p4,Digits),7,"Arial",fib.SR.shadow.1.c);   }      
 
   double lo.ma.p4.1, lo.ma.p4.2, lo.ma.p4.3, lo.ma.p4.4, lo.ma.p4.5, lo.ma.p4.6;
   lo.ma.p4.1=lo.ma.p4+(fib.SR.shadow.2*Point);
   lo.ma.p4.2=lo.ma.p4.1+(fib.SR.shadow.3*Point);
   lo.ma.p4.3=lo.ma.p4.2+(fib.SR.shadow.4*Point);
   lo.ma.p4.4=lo.ma.p4.3+(fib.SR.shadow.5*Point);
   lo.ma.p4.5=lo.ma.p4.4+(fib.SR.shadow.6*Point);
   lo.ma.p4.6=lo.ma.p4.5+(fib.SR.shadow.7*Point);
     
   double hi.ma.p4.1, hi.ma.p4.2, hi.ma.p4.3, hi.ma.p4.4, hi.ma.p4.5, hi.ma.p4.6;
   hi.ma.p4.1=hi.ma.p4-(fib.SR.shadow.2*Point);
   hi.ma.p4.2=hi.ma.p4.1-(fib.SR.shadow.3*Point);
   hi.ma.p4.3=hi.ma.p4.2-(fib.SR.shadow.4*Point);
   hi.ma.p4.4=hi.ma.p4.3-(fib.SR.shadow.5*Point);
   hi.ma.p4.5=hi.ma.p4.4-(fib.SR.shadow.6*Point);
   hi.ma.p4.6=hi.ma.p4.5-(fib.SR.shadow.7*Point);

//p4 1st level (hi.1.p4, lo.1.p4)
   if(lo.ma.p4.1-hi.ma.p4.1>Ask-Bid)   {
      ObjectCreate("lo.1.p4",OBJ_TREND,0,t1.p4, lo.ma.p4.1, t2.p4, lo.ma.p4.1);
      ObjectSet("lo.1.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.1.p4",OBJPROP_WIDTH,2);
      ObjectSet("lo.1.p4",OBJPROP_RAY,false);
      ObjectSet("lo.1.p4",OBJPROP_COLOR,fib.SR.shadow.2.c);
      ObjectSetText("lo.1.p4",DoubleToStr(lo.ma.p4.1,Digits),7,"Arial",fib.SR.shadow.2.c);

      ObjectCreate("hi.1.p4",OBJ_TREND,0,t1.p4, hi.ma.p4.1, t2.p4, hi.ma.p4.1);
      ObjectSet("hi.1.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.1.p4",OBJPROP_WIDTH,2);
      ObjectSet("hi.1.p4",OBJPROP_RAY,false);
      ObjectSet("hi.1.p4",OBJPROP_COLOR,fib.SR.shadow.2.c);
      ObjectSetText("hi.1.p4",DoubleToStr(hi.ma.p4.1,Digits),7,"Arial",fib.SR.shadow.2.c);   }

// 2st level (hi.2.p4, lo.2.p4)
   if(lo.ma.p4.2-hi.ma.p4.2>Ask-Bid)   {
      ObjectCreate("lo.2.p4",OBJ_TREND,0,t1.p4, lo.ma.p4.2, t2.p4, lo.ma.p4.2);
      ObjectSet("lo.2.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.2.p4",OBJPROP_WIDTH,2);
      ObjectSet("lo.2.p4",OBJPROP_RAY,false);
      ObjectSet("lo.2.p4",OBJPROP_COLOR,fib.SR.shadow.3.c);
      ObjectSetText("lo.2.p4",DoubleToStr(lo.ma.p4.2,Digits),7,"Arial",fib.SR.shadow.3.c);

      ObjectCreate("hi.2.p4",OBJ_TREND,0,t1.p4, hi.ma.p4.2, t2.p4, hi.ma.p4.2);
      ObjectSet("hi.2.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.2.p4",OBJPROP_WIDTH,2);
      ObjectSet("hi.2.p4",OBJPROP_RAY,false);
      ObjectSet("hi.2.p4",OBJPROP_COLOR,fib.SR.shadow.3.c);
      ObjectSetText("hi.2.p4",DoubleToStr(hi.ma.p4.2,Digits),7,"Arial",fib.SR.shadow.3.c);   }     

// 3rd level (hi.3.p4, lo.3.p4)
   if(lo.ma.p4.3-hi.ma.p4.3>Ask-Bid)   {
      ObjectCreate("lo.3.p4",OBJ_TREND,0,t1.p4, lo.ma.p4.3, t2.p4, lo.ma.p4.3);
      ObjectSet("lo.3.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.3.p4",OBJPROP_WIDTH,2);
      ObjectSet("lo.3.p4",OBJPROP_RAY,false);
      ObjectSet("lo.3.p4",OBJPROP_COLOR,fib.SR.shadow.4.c);
      ObjectSetText("lo.3.p4",DoubleToStr(lo.ma.p4.3,Digits),7,"Arial",fib.SR.shadow.4.c);

      ObjectCreate("hi.3.p4",OBJ_TREND,0,t1.p4, hi.ma.p4.3, t2.p4, hi.ma.p4.3);
      ObjectSet("hi.3.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.3.p4",OBJPROP_WIDTH,2);
      ObjectSet("hi.3.p4",OBJPROP_RAY,false);
      ObjectSet("hi.3.p4",OBJPROP_COLOR,fib.SR.shadow.4.c);
      ObjectSetText("hi.3.p4",DoubleToStr(hi.ma.p4.3,Digits),7,"Arial",fib.SR.shadow.4.c);   }    

// 4th level (hi.4.p4, lo.4.p4)
   if(lo.ma.p4.4-hi.ma.p4.4>Ask-Bid)   {
      ObjectCreate("lo.4.p4",OBJ_TREND,0,t1.p4, lo.ma.p4.4, t2.p4, lo.ma.p4.4);
      ObjectSet("lo.4.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.4.p4",OBJPROP_WIDTH,2);
      ObjectSet("lo.4.p4",OBJPROP_RAY,false);
      ObjectSet("lo.4.p4",OBJPROP_COLOR,fib.SR.shadow.5.c);
      ObjectSetText("lo.4.p4",DoubleToStr(lo.ma.p4.4,Digits),7,"Arial",fib.SR.shadow.5.c);

      ObjectCreate("hi.4.p4",OBJ_TREND,0,t1.p4, hi.ma.p4.4, t2.p4, hi.ma.p4.4);
      ObjectSet("hi.4.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.4.p4",OBJPROP_WIDTH,2);
      ObjectSet("hi.4.p4",OBJPROP_RAY,false);
      ObjectSet("hi.4.p4",OBJPROP_COLOR,fib.SR.shadow.5.c);
      ObjectSetText("hi.4.p4",DoubleToStr(hi.ma.p4.4,Digits),7,"Arial",fib.SR.shadow.5.c);   }

// 5th level (hi.5.p4, lo.5.p4)
   if(lo.ma.p4.5-hi.ma.p4.5>Ask-Bid)   {
      ObjectCreate("lo.5.p4",OBJ_TREND,0,t1.p4, lo.ma.p4.5, t2.p4, lo.ma.p4.5);
      ObjectSet("lo.5.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.5.p4",OBJPROP_WIDTH,2);
      ObjectSet("lo.5.p4",OBJPROP_RAY,false);
      ObjectSet("lo.5.p4",OBJPROP_COLOR,fib.SR.shadow.6.c);
      ObjectSetText("lo.5.p4",DoubleToStr(lo.ma.p4.5,Digits),7,"Arial",fib.SR.shadow.6.c);

      ObjectCreate("hi.5.p4",OBJ_TREND,0,t1.p4, hi.ma.p4.5, t2.p4, hi.ma.p4.5);
      ObjectSet("hi.5.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.5.p4",OBJPROP_WIDTH,2);
      ObjectSet("hi.5.p4",OBJPROP_RAY,false);
      ObjectSet("hi.5.p4",OBJPROP_COLOR,fib.SR.shadow.6.c);
      ObjectSetText("hi.5.p4",DoubleToStr(hi.ma.p4.5,Digits),7,"Arial",fib.SR.shadow.6.c);   }

// 6th level (hi.6.p4, lo.6.p4)
   if(lo.ma.p4.6-hi.ma.p4.6>Ask-Bid)   {
      ObjectCreate("lo.6.p4",OBJ_TREND,0,t1.p4, lo.ma.p4.6, t2.p4, lo.ma.p4.6);
      ObjectSet("lo.6.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("lo.6.p4",OBJPROP_WIDTH,2);
      ObjectSet("lo.6.p4",OBJPROP_RAY,false);
      ObjectSet("lo.6.p4",OBJPROP_COLOR,fib.SR.shadow.7.c);
      ObjectSetText("lo.6.p4",DoubleToStr(lo.ma.p4.6,Digits),7,"Arial",fib.SR.shadow.7.c);

      ObjectCreate("hi.6.p4",OBJ_TREND,0,t1.p4, hi.ma.p4.6, t2.p4, hi.ma.p4.6);
      ObjectSet("hi.6.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("hi.6.p4",OBJPROP_WIDTH,2);
      ObjectSet("hi.6.p4",OBJPROP_RAY,false);
      ObjectSet("hi.6.p4",OBJPROP_COLOR,fib.SR.shadow.7.c);
      ObjectSetText("hi.6.p4",DoubleToStr(hi.ma.p4.6,Digits),7,"Arial",fib.SR.shadow.7.c);   }
//...............Moving Average Support & Resistance Levels..............................
   string space="             ";
    //  ObjectCreate("ma1.p4",OBJ_TEXT,0,t1.p4,ma1.p4);//13 ma
      ObjectSetText("ma1.p4",space+DoubleToStr(ma1.p4,Digits),8,"Arial",White);

    //  ObjectCreate("ma2.p4",OBJ_TEXT,0,t1.p4,ma2.p4);//21 ma
      ObjectSetText("ma2.p4",space+DoubleToStr(ma2.p4,Digits),8,"Arial",White);      

    //  ObjectCreate("ma3.p4",OBJ_TEXT,0,t1.p4,ma3.p4);//34 ma
      if(Bid>ma3.p4) {ObjectSetText("ma3.p4",space+DoubleToStr(ma3.p4,Digits),8,"Arial",ColorAbove2);}
      if(Ask<ma3.p4) {ObjectSetText("ma3.p4",space+DoubleToStr(ma3.p4,Digits),8,"Arial",ColorBelow2);}
      if(Bid<=ma3.p4 && Ask>=ma3.p4)  {
         ObjectSetText("ma3.p4",space+DoubleToStr(ma3.p4,Digits),8,"Arial",Yellow);}

    //  ObjectCreate("ma4.p4",OBJ_TEXT,0,t1.p4,ma4.p4);//55 ma
      if(Bid>ma4.p4) {ObjectSetText("ma4.p4",space+DoubleToStr(ma4.p4,Digits),8,"Arial",ColorAbove2);}
      if(Ask<ma4.p4) {ObjectSetText("ma4.p4",space+DoubleToStr(ma4.p4,Digits),8,"Arial",ColorBelow2);}
      if(Bid<=ma4.p4 && Ask>=ma4.p4)  {
         ObjectSetText("ma4.p4",space+DoubleToStr(ma4.p4,Digits),8,"Arial",Yellow);}

    //  ObjectCreate("ma5.p4",OBJ_TEXT,0,t1.p4,ma5.p4);//89 ma
      if(Bid>ma5.p4) {ObjectSetText("ma5.p4",space+DoubleToStr(ma5.p4,Digits),8,"Arial",ColorAbove);}
      if(Ask<ma5.p4) {ObjectSetText("ma5.p4",space+DoubleToStr(ma5.p4,Digits),8,"Arial",ColorBelow);}
      if(Bid<=ma5.p4 && Ask>=ma5.p4)  {
         ObjectSetText("ma5.p4",space+DoubleToStr(ma5.p4,Digits),8,"Arial",Yellow);}

     // ObjectCreate("ma6.p4",OBJ_TEXT,0,t1.p4,NormalizeDouble(ma6.p4,Digits));//144 ma
      if(Bid>ma6.p4) {ObjectSetText("ma6.p4",space+DoubleToStr(ma6.p4,Digits),8,"Arial",ColorAbove);}
      if(Ask<ma6.p4) {ObjectSetText("ma6.p4",space+DoubleToStr(ma6.p4,Digits),8,"Arial",ColorBelow);}
      if(Bid<=ma6.p4 && Ask>=ma6.p4)  {
         ObjectSetText("ma6.p4",space+DoubleToStr(ma6.p4,Digits),8,"Arial",Yellow);}

    //  ObjectCreate("ma7.p4",OBJ_TEXT,0,t1.p4,NormalizeDouble(ma7.p4,Digits));//233 ma
      if(Bid>ma7.p4) {ObjectSetText("ma7.p4",space+DoubleToStr(ma7.p4,Digits),8,"Arial",ColorAbove);}
      if(Ask<ma7.p4) {ObjectSetText("ma7.p4",space+DoubleToStr(ma7.p4,Digits),8,"Arial",ColorBelow);}
      if(Bid<=ma7.p4 && Ask>=ma7.p4)  {
         ObjectSetText("ma7.p4",space+DoubleToStr(ma7.p4,Digits),8,"Arial",Yellow);}
         

SRRR(p4.ma) ; 

      ObjectCreate("resistance.p4",OBJ_TREND,0,t1.p4, resistance, t2.p4, resistance);
      ObjectSet("resistance.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("resistance.p4",OBJPROP_WIDTH,2);
      ObjectSet("resistance.p4",OBJPROP_RAY,false);
      ObjectSet("resistance.p4",OBJPROP_COLOR,ColorUpper);
      ObjectSetText("resistance.p4",DoubleToStr(resistance,Digits),7,"Arial",ColorUpper);


      ObjectCreate("goShort.p4",OBJ_TREND,0,t1.p4, goShort, t2.p4, goShort);
      ObjectSet("goShort.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("goShort.p4",OBJPROP_WIDTH,2);
      ObjectSet("goShort.p4",OBJPROP_RAY,false);
      ObjectSet("goShort.p4",OBJPROP_COLOR,ColorShort);
      ObjectSetText("goShort.p4",DoubleToStr(goShort,Digits),7,"Arial",ColorShort);
 

      ObjectCreate("goLong.p4",OBJ_TREND,0,t1.p4, goLong, t2.p4, goLong);
      ObjectSet("goLong.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("goLong.p4",OBJPROP_WIDTH,2);
      ObjectSet("goLong.p4",OBJPROP_RAY,false);
      ObjectSet("goLong.p4",OBJPROP_COLOR,ColorLong);
      ObjectSetText("goLong.p4",DoubleToStr(goLong,Digits),7,"Arial",ColorLong);


      ObjectCreate("support.p4",OBJ_TREND,0,t1.p4, support, t2.p4, support);
      ObjectSet("support.p4",OBJPROP_STYLE,STYLE_SOLID);
      ObjectSet("support.p4",OBJPROP_WIDTH,2);
      ObjectSet("support.p4",OBJPROP_RAY,false);
      ObjectSet("support.p4",OBJPROP_COLOR,ColorLower);
      ObjectSetText("support.p4",DoubleToStr(support,Digits),7,"Arial",ColorLower);    




      int vert = Highest(NULL,0,MODE_HIGH,bpw,0); 
      double vertv = High[vert] + 20 * Point ;
      
      
      DoBias( p1.ma ) ;
       
      ObjectCreate(Obj0001,OBJ_TEXT,0,t1.p1,vertv  ) ;  
      ObjectSetText(Obj0001,tp1.ma, 11, "Arial Bold", ColorBias ) ;          
      
      DoBias( p2.ma ) ;      
         
      ObjectCreate(Obj0002,OBJ_TEXT,0,t1.p2, vertv ) ;  
      ObjectSetText(Obj0002,tp2.ma, 11, "Arial Bold", ColorBias ) ;          

      DoBias( p3.ma ) ;
      
      ObjectCreate(Obj0003,OBJ_TEXT,0,t1.p3, vertv) ;  
      ObjectSetText(Obj0003,tp3.ma, 11, "Arial Bold", ColorBias ) ;  
        
      DoBias( p4.ma ) ;
      
      ObjectCreate(Obj0004,OBJ_TEXT,0,t1.p4, vertv ) ;  
      ObjectSetText(Obj0004,tp4.ma, 11, "Arial Bold", ColorBias ) ;    
     

         
}//end p4.Fib.Plot()

//+------------------------------------------------------------------+

void column()  {
//..................Time Frame Columns.................................................     
//Addition - uses Psar of that timeframe to colour the lanes
//Dull red-green psars are not with you
//brighter red-green psar in your favour

// because Psar appears with the new bar I thing i can use Bar 0 
// for faster notification.     
         //1st Column        
               if(tmb1>cciUpperTrigger)
         {
         ObjectCreate("up.p1",OBJ_RECTANGLE,0,t1.p1,Ask,t2.p1,resistance.p1); // was Ask*1.5
         ObjectSet("up.p1",OBJPROP_COLOR,ColorUpClear);
         }
         else 
               {
               ObjectCreate("up.p1",OBJ_RECTANGLE,0,t1.p1,Ask,t2.p1,resistance.p1); // was Ask*1.5
               ObjectSet("up.p1",OBJPROP_COLOR,ColorUpBlocked);
               }
        
               if(tmr1<cciLowerTrigger)
         {
         ObjectCreate("down.p1",OBJ_RECTANGLE,0,t1.p1,Bid,t2.p1,support.p1); // was 0 
         ObjectSet("down.p1",OBJPROP_COLOR,ColorDownClear);
         }
         else
             {
             ObjectCreate("down.p1",OBJ_RECTANGLE,0,t1.p1,Bid,t2.p1,support.p1); // was 0 
             ObjectSet("down.p1",OBJPROP_COLOR,ColorDnBlocked);
             }
         //2nd Column          
             if(tmb2>cciUpperTrigger)
         {
         ObjectCreate("up.p2",OBJ_RECTANGLE,0,t1.p2,Ask,t2.p2,resistance.p2); // was Ask*1.5
         ObjectSet("up.p2",OBJPROP_COLOR,ColorUpClear);
         }
               else
               {
               ObjectCreate("up.p2",OBJ_RECTANGLE,0,t1.p2,Ask,t2.p2,resistance.p2); // was Ask*1.5
               ObjectSet("up.p2",OBJPROP_COLOR,ColorUpBlocked);
               }
             if(tmr2<cciLowerTrigger)
         {
         ObjectCreate("down.p2",OBJ_RECTANGLE,0,t1.p2,support.p2,t2.p2,Bid); // was 0 
         ObjectSet("down.p2",OBJPROP_COLOR,ColorDownClear);
         }
               else
               {
               ObjectCreate("down.p2",OBJ_RECTANGLE,0,t1.p2,support.p2,t2.p2,Bid);
               ObjectSet("down.p2",OBJPROP_COLOR,ColorDnBlocked);               
               }
         //3rd Column         
           if(tmb3>cciUpperTrigger)
         {
         ObjectCreate("up.p3",OBJ_RECTANGLE,0,t1.p3,Ask,t2.p3,resistance.p3); // was Ask*1.5
         ObjectSet("up.p3",OBJPROP_COLOR,ColorUpClear);
         }
               else
               {
               ObjectCreate("up.p3",OBJ_RECTANGLE,0,t1.p3,Ask,t2.p3,resistance.p3); // was Ask*1.5
               ObjectSet("up.p3",OBJPROP_COLOR,ColorUpBlocked);
               }
           if(tmr3<cciLowerTrigger)
         {
          ObjectCreate("down.p3",OBJ_RECTANGLE,0,t1.p3,Bid,t2.p3,support.p3); // was 0 
          ObjectSet("down.p3",OBJPROP_COLOR,ColorDownClear);
         }
               else
               {
               ObjectCreate("down.p3",OBJ_RECTANGLE,0,t1.p3,Bid,t2.p3,support.p3); // was 0 
               ObjectSet("down.p3",OBJPROP_COLOR,ColorDnBlocked);
               }
         //4th column
               
            if(tmb4>cciUpperTrigger)
         {
         ObjectCreate("up.p4",OBJ_RECTANGLE,0,t1.p4,Ask,t2.p4,resistance.p4); // was Ask*1.5
         ObjectSet("up.p4",OBJPROP_COLOR,ColorUpClear);
         }
               else
               {
               ObjectCreate("up.p4",OBJ_RECTANGLE,0,t1.p4,Ask,t2.p4,resistance.p4); // was Ask*1.5
               ObjectSet("up.p4",OBJPROP_COLOR,ColorUpBlocked);
               }
          if(tmr4<cciLowerTrigger)
         {
         ObjectCreate("down.p4",OBJ_RECTANGLE,0,t1.p4,Bid,t2.p4,support.p4); // was 0 
         ObjectSet("down.p4",OBJPROP_COLOR,ColorDownClear);
         } 
               else
               {
               ObjectCreate("down.p4",OBJ_RECTANGLE,0,t1.p4,Bid,t2.p4,support.p4); // was 0 
               ObjectSet("down.p4",OBJPROP_COLOR,ColorDnBlocked);
               }  
         
         
         
         }//end Columns
         
//+------------------------------------------------------------------+         
         
void Refresh() {
   if (Use_Std_Reg)
   {
   ObjectDelete("regression channel");ObjectDelete("std channel");
   }
   
   
   if(ObjectFind(Obj0001) > -1 ) ObjectDelete(Obj0001);  
   if(ObjectFind(Obj0002) > -1 ) ObjectDelete(Obj0002); 
   if(ObjectFind(Obj0003) > -1 ) ObjectDelete(Obj0003);  
   if(ObjectFind(Obj0004) > -1 ) ObjectDelete(Obj0004); 



   if(ObjectFind(p1.ma+Obj0011) > -1 ) ObjectDelete(p1.ma+Obj0011);  
   if(ObjectFind(p1.ma+Obj0012) > -1 ) ObjectDelete(p1.ma+Obj0012); 
   if(ObjectFind(p1.ma+Obj0013) > -1 ) ObjectDelete(p1.ma+Obj0013);  
   if(ObjectFind(p1.ma+Obj0014) > -1 ) ObjectDelete(p1.ma+Obj0014);   
   
   if(ObjectFind(p2.ma+Obj0011) > -1 ) ObjectDelete(p2.ma+Obj0011);  
   if(ObjectFind(p2.ma+Obj0012) > -1 ) ObjectDelete(p2.ma+Obj0012); 
   if(ObjectFind(p2.ma+Obj0013) > -1 ) ObjectDelete(p2.ma+Obj0013);  
   if(ObjectFind(p2.ma+Obj0014) > -1 ) ObjectDelete(p2.ma+Obj0014);      
   
   if(ObjectFind(p3.ma+Obj0011) > -1 ) ObjectDelete(p3.ma+Obj0011);  
   if(ObjectFind(p3.ma+Obj0012) > -1 ) ObjectDelete(p3.ma+Obj0012); 
   if(ObjectFind(p3.ma+Obj0013) > -1 ) ObjectDelete(p3.ma+Obj0013);  
   if(ObjectFind(p3.ma+Obj0014) > -1 ) ObjectDelete(p3.ma+Obj0014);   
   
   if(ObjectFind(p4.ma+Obj0011) > -1 ) ObjectDelete(p4.ma+Obj0011);  
   if(ObjectFind(p4.ma+Obj0012) > -1 ) ObjectDelete(p4.ma+Obj0012); 
   if(ObjectFind(p4.ma+Obj0013) > -1 ) ObjectDelete(p4.ma+Obj0013);  
   if(ObjectFind(p4.ma+Obj0014) > -1 ) ObjectDelete(p4.ma+Obj0014);   
      
   ObjectDelete("support.p1");    ObjectDelete("resistance.p1");    
   ObjectDelete("goShort.p1");   ObjectDelete("goLong.p1");     

   ObjectDelete("support.p2");    ObjectDelete("resistance.p2");    
   ObjectDelete("goShort.p2");   ObjectDelete("goLong.p2");   

   ObjectDelete("support.p3");    ObjectDelete("resistance.p3");    
   ObjectDelete("goShort.p3");   ObjectDelete("goLong.p3");  
                    
   ObjectDelete("support.p4");    ObjectDelete("resistance.p4");    
   ObjectDelete("goShort.p4");   ObjectDelete("goLong.p4");          
   
   ObjectDelete("up.p1");     ObjectDelete("down.p1");
   ObjectDelete("lcf.p1");    ObjectDelete("hcf.p1");    ObjectDelete("ma1.p1");
   ObjectDelete("lo.1.p1");   ObjectDelete("hi.1.p1");   ObjectDelete("ma2.p1");
   ObjectDelete("lo.2.p1");   ObjectDelete("hi.2.p1");   ObjectDelete("ma3.p1");
   ObjectDelete("lo.3.p1");   ObjectDelete("hi.3.p1");   ObjectDelete("ma4.p1");
   ObjectDelete("lo.4.p1");   ObjectDelete("hi.4.p1");   ObjectDelete("ma5.p1");
   ObjectDelete("lo.5.p1");   ObjectDelete("hi.5.p1");   ObjectDelete("ma6.p1");
   ObjectDelete("lo.6.p1");   ObjectDelete("hi.6.p1");   ObjectDelete("ma7.p1");
   ObjectDelete("lo.7.p1");   ObjectDelete("hi.7.p1");

   ObjectDelete("up.p2");     ObjectDelete("down.p2");
   ObjectDelete("lcf.p2");    ObjectDelete("hcf.p2");    ObjectDelete("ma1.p2");
   ObjectDelete("lo.1.p2");   ObjectDelete("hi.1.p2");   ObjectDelete("ma2.p2");
   ObjectDelete("lo.2.p2");   ObjectDelete("hi.2.p2");   ObjectDelete("ma3.p2");
   ObjectDelete("lo.3.p2");   ObjectDelete("hi.3.p2");   ObjectDelete("ma4.p2");
   ObjectDelete("lo.4.p2");   ObjectDelete("hi.4.p2");   ObjectDelete("ma5.p2");
   ObjectDelete("lo.5.p2");   ObjectDelete("hi.5.p2");   ObjectDelete("ma6.p2");
   ObjectDelete("lo.6.p2");   ObjectDelete("hi.6.p2");   ObjectDelete("ma7.p2");
   ObjectDelete("lo.7.p2");   ObjectDelete("hi.7.p2");

   ObjectDelete("up.p3");     ObjectDelete("down.p3");
   ObjectDelete("lcf.p3");    ObjectDelete("hcf.p3");    ObjectDelete("ma1.p3");
   ObjectDelete("lo.1.p3");   ObjectDelete("hi.1.p3");   ObjectDelete("ma2.p3");
   ObjectDelete("lo.2.p3");   ObjectDelete("hi.2.p3");   ObjectDelete("ma3.p3");
   ObjectDelete("lo.3.p3");   ObjectDelete("hi.3.p3");   ObjectDelete("ma4.p3");
   ObjectDelete("lo.4.p3");   ObjectDelete("hi.4.p3");   ObjectDelete("ma5.p3");
   ObjectDelete("lo.5.p3");   ObjectDelete("hi.5.p3");   ObjectDelete("ma6.p3");
   ObjectDelete("lo.6.p3");   ObjectDelete("hi.6.p3");   ObjectDelete("ma7.p3");
   ObjectDelete("lo.7.p3");   ObjectDelete("hi.7.p3");

   ObjectDelete("up.p4");     ObjectDelete("down.p4");
   ObjectDelete("lcf.p4");    ObjectDelete("hcf.p4");    ObjectDelete("ma1.p4");
   ObjectDelete("lo.1.p4");   ObjectDelete("hi.1.p4");   ObjectDelete("ma2.p4");
   ObjectDelete("lo.2.p4");   ObjectDelete("hi.2.p4");   ObjectDelete("ma3.p4");
   ObjectDelete("lo.3.p4");   ObjectDelete("hi.3.p4");   ObjectDelete("ma4.p4");
   ObjectDelete("lo.4.p4");   ObjectDelete("hi.4.p4");   ObjectDelete("ma5.p4");
   ObjectDelete("lo.5.p4");   ObjectDelete("hi.5.p4");   ObjectDelete("ma6.p4");
   ObjectDelete("lo.6.p4");   ObjectDelete("hi.6.p4");   ObjectDelete("ma7.p4");
   ObjectDelete("lo.7.p4");   ObjectDelete("hi.7.p4");
   
}
   
 
//+------------------------------------------------------------------+ 

void DoShowLines(int iTF , int Line_Style )
{
 
      ObjectDelete(iTF+Obj0014);
      ObjectCreate(iTF+Obj0014,OBJ_HLINE,0,0,0);
      ObjectSet(iTF+Obj0014,OBJPROP_COLOR,ColorUpper);
      ObjectSet(iTF+Obj0014,OBJPROP_STYLE,Line_Style);
 

      ObjectDelete(iTF+Obj0013);
      ObjectCreate(iTF+Obj0013,OBJ_HLINE,0,0,0);
      ObjectSet(iTF+Obj0013,OBJPROP_COLOR,ColorShort);
      ObjectSet(iTF+Obj0013,OBJPROP_STYLE,Line_Style);
      

      ObjectDelete(iTF+Obj0012);
      ObjectCreate(iTF+Obj0012,OBJ_HLINE,0,0,0);
      ObjectSet(iTF+Obj0012,OBJPROP_COLOR,ColorLong);
      ObjectSet(iTF+Obj0012,OBJPROP_STYLE,Line_Style);
 


      ObjectDelete(iTF+Obj0011);
      ObjectCreate(iTF+Obj0011,OBJ_HLINE,0,0,0);
      ObjectSet(iTF+Obj0011,OBJPROP_COLOR,ColorLower);
      ObjectSet(iTF+Obj0011,OBJPROP_STYLE,Line_Style);
  
 
      ObjectMove(iTF+Obj0014,0,Time[0],resistance);
 
      ObjectMove(iTF+Obj0013,0,Time[0],goShort);      
 
      ObjectMove(iTF+Obj0012,0,Time[0],goLong);
 
      ObjectMove(iTF+Obj0011,0,Time[0],support);
            
            
}
//+------------------------------------------------------------------+ 

void DoBias(int bPeriod )
{ 
      Bias_Open    = iOpen(NULL,bPeriod,0) ;       
      Bias_Close   = iClose(NULL,bPeriod,0) ;
      Bias_High    = iHigh(NULL,bPeriod,1) ; 
      Bias_Low     = iLow(NULL,bPeriod,1) ;
  
      Bias_Diff    = Bias_Close - Bias_Open ;
      Bias_Mid     = ( Bias_High + Bias_Low ) * 0.50 ;
      Bias_Mid     = NormalizeDouble( Bias_Mid , digits ) ;
      
 
while( true )
{
   if (Bias_Diff > 0 && Bias_Close > Bias_Mid ) { BiasArrow = Arrow12; ColorBias = UpS_color ; break; } // strong up
   if (Bias_Diff > 0 && Bias_Close < Bias_Mid ) { BiasArrow = Arrow2 ; ColorBias = UpW_color ; break; } // weak up
   if (Bias_Diff < 0 && Bias_Close > Bias_Mid ) { BiasArrow = Arrow5 ; ColorBias = DnW_color ; break; } // weak down
   if (Bias_Diff < 0 && Bias_Close < Bias_Mid ) { BiasArrow = Arrow6 ; ColorBias = DnS_color ; break; } // strong down
                                                  BiasArrow = Arrow3 ; ColorBias = Eq_color  ; break;   // no bias
                                               
}
 
} 
//+------------------------------------------------------------------+
 
string TimeFrameToString(int tf)
{
   string tfs;
   switch(tf) {
      case PERIOD_M1:  tfs="M1"  ; break;
      case PERIOD_M5:  tfs="M5"  ; break;
      case PERIOD_M15: tfs="M15" ; break;
      case PERIOD_M30: tfs="M30" ; break;
      case PERIOD_H1:  tfs="H1"  ; break;
      case PERIOD_H4:  tfs="H4"  ; break;
      case PERIOD_D1:  tfs="D1"  ; break;
      case PERIOD_W1:  tfs="W1"  ; break;
      case PERIOD_MN1: tfs="MN";
   }
   return(tfs);
}
 
//+------------------------------------------------------------------+

/*

Comment(

 

"symbol = ",symbol, "\n",
"period = ",period, "\n",
 


"resistance = ",DoubleToStr(resistance,Digits), "\n",
"goShort = ",DoubleToStr(goShort,Digits), "\n",
"goLong = ",DoubleToStr(goLong,Digits), "\n",
"support = ",DoubleToStr(support,Digits), "\n",

"MarketInfo(symbol,MODE_ASK) = ",DoubleToStr(MarketInfo(symbol,MODE_ASK),Digits), "\n",
"MarketInfo(symbol,MODE_BID) = ",DoubleToStr(MarketInfo(symbol,MODE_BID),Digits), "\n",
 

"") ;  

*/