// Downloaded From https://www.WiseStockTrader.com
_SECTION_BEGIN("ALL PIVOT POINT");

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 



k=IIf(ParamList("select type day","DAILY|next day")=="DAILY",-1,0);

k1=-1;
K2=-2;


TimeFrameSet(inDaily);
day_h= LastValue(Ref(H,K));
day_l= LastValue(Ref(L,K));
TimeFrameRestore();

TimeFrameSet(inWeekly);
Week_h= LastValue(Ref(H,K1));
Week_l= LastValue(Ref(L,K1));
TWOWEEK_h= LastValue(Ref(H,K2));
TWOWEEK_l= LastValue(Ref(L,K2));
TimeFrameRestore();

TimeFrameSet(inMonthly);
month_h= LastValue(Ref(H,K1));
month_l= LastValue(Ref(L,K1));
TimeFrameRestore();

TimeFrameSet(inQuarterly);
QUARTER_h= LastValue(Ref(H,K1));
QUARTER_l= LastValue(Ref(L,K1));
TimeFrameRestore();

TimeFrameSet(inYearly);
YEAR_h= LastValue(Ref(H,K1));
YEAR_l= LastValue(Ref(L,K1));
TimeFrameRestore();


// day
DH=Day_h;
DL=Day_L;
DR = DH-DL;
// DAY PIVOT Calculation
DH5 = DH + DR;
DH4 = DH + DR*0.62;
DH3 = DH + DR*0.38;
DH2 = DH;
DH1 = DH - DR*0.38;
DMID = (DH + DL) / 2;
DL1 = DL + DR*0.38;
DL2 = DL;
DL3 = DL - DR*0.38;
DL4 = DL - DR*0.62;
DL5 = DL - DR;


// week
WH=Week_h;
WL=Week_l;
WR=WH-WL;

// WEEK PIVOT Calculation
WH5 = WH + WR;
WH4 = WH + WR*0.62;
WH3 = WH + WR*0.38;
WH2 = WH;
WH1 = WH - WR*0.38;
WMID = (WH + WL) / 2;
WL1 = WL + WR*0.38;
WL2 = WL;
WL3 = WL - WR*0.38;
WL4 = WL - WR*0.62;
WL5 = WL - WR;

// TWO week
TWH=TWOWEEK_h;
TWL=TWOWEEK_l;
TWR=TWH-TWL;

//TWO WEEK PIVOT Calculation

TWH5 = TWH + TWR;
TWH4 = TWH + TWR*0.62;
TWH3 = TWH + TWR*0.38;
TWH2 = TWH;
TWH1 = TWH - TWR*0.38;
TWMID = (TWH + TWL) / 2;
TWL1 = TWL + TWR*0.38;
TWL2 = TWL;
TWL3 = TWL - TWR*0.38;
TWL4 = TWL - TWR*0.62;
TWL5 = TWL - TWR;

// month
MH=month_h;
ML=month_l;
MR=MH-ML;
// MONTH PIVOT Calculation

MH5 = MH + MR;
MH4 = MH + MR*0.62;
MH3 = MH + MR*0.38;
MH2 = MH;
MH1 = MH - MR*0.38;
MMID = (MH + ML) / 2;
ML1 = ML + MR*0.38;
ML2 = ML;
ML3 = ML - MR*0.38;
ML4 = ML - MR*0.62;
ML5 = ML - MR;

// QUARTER
QH=QUARTER_h;
QL=QUARTER_l;
QR=QH-QL;
// QUARTER PIVOT Calculation

QH5 = QH + QR;
QH4 = QH + QR*0.62;
QH3 = QH + QR*0.38;
QH2 = QH;
QH1 = QH - QR*0.38;
QMID = (QH + QL) / 2;
QL1 = QL + QR*0.38;
QL2 = QL;
QL3 = QL - QR*0.38;
QL4 = QL - QR*0.62;
QL5 = QL - QR;

// YEAR
YH=YEAR_h;
YL=YEAR_l;
YR=YH-YL;
// YEAR PIVOT Calculation

YH5 = YH + YR;
YH4 = YH + YR*0.62;
YH3 = YH + YR*0.38;
YH2 = YH;
YH1 = YH - YR*0.38;
YMID = (YH + YL) / 2;
YL1 = YL + YR*0.38;
YL2 = YL;
YL3 = YL - YR*0.38;
YL4 = YL - YR*0.62;
YL5 = YL - YR;



/*--------------------------------------*/
// PARAMETERS
slide =  Param("slide all",20,-1000,1000,1);
slide1 = Param("slide_day",22,0,1000,1);
slide2 = Param("slide_week",16,0,1000,1);
slide3 = Param("slide_TWOweek",26,0,1000,1);
slide4 = Param("slide_month",13,0,1000,1);
slide5 = Param("slide_QUARTER",29,0,1000,1);
slide6 = Param("slide_YEAR",33,0,1000,1);
slide7 = Param("slide_HOUR",19,0,1000,1);
slide_Hight =  Param("slide_Hight",0,-1000,1000,1);



SHALDH = ParamList("HOURLY Pivots", "selected only|all|hide" );
SHALD = ParamList("DAILY Pivots", "selected only|all|hide" );
SHALW = ParamList("weekly Pivots", "selected only|all|hide" );
SHALTW = ParamList("TWO weekly Pivots", "selected only|all|hide" );
SHALM = ParamList("monthly Pivots", "selected only|all|hide" ); 
SHALQ = ParamList("QUARTERLY Pivots", "selected only|all|hide" );
SHALY = ParamList("YEARLY Pivots", "selected only|all|hide" );

//HOUR

PHH5 = ParamList("HH5",   "HIDE|SHOW" );
PHH4 = ParamList("HH4",   "HIDE|SHOW" );
PHH3 = ParamList("HH3",   "HIDE|SHOW" );
PHH2 = ParamList("HH2",   "SHOW|HIDE" );
PHH1 = ParamList("HH1",   "HIDE|SHOW" );
PHMID = ParamList("HMID", "SHOW|HIDE" ); 
PHL1 = ParamList("HL1",   "HIDE|SHOW" );
PHL2 = ParamList("HL2",   "SHOW|HIDE" );
PHL3 = ParamList("HL3",   "HIDE|SHOW" );
PHL4 = ParamList("HL4",   "HIDE|SHOW" );
PHL5 = ParamList("HL5",   "HIDE|SHOW" );



//day

PDH5 = ParamList("DH5",   "HIDE|SHOW" );
PDH4 = ParamList("DH4",   "HIDE|SHOW" );
PDH3 = ParamList("DH3",   "HIDE|SHOW" );
PDH2 = ParamList("DH2",   "SHOW|HIDE" );
PDH1 = ParamList("DH1",   "HIDE|SHOW" );
PDMID = ParamList("DMID", "SHOW|HIDE" ); 
PDL1 = ParamList("DL1",   "HIDE|SHOW" );
PDL2 = ParamList("DL2",   "SHOW|HIDE" );
PDL3 = ParamList("DL3",   "HIDE|SHOW" );
PDL4 = ParamList("DL4",   "HIDE|SHOW" );
PDL5 = ParamList("DL5",   "HIDE|SHOW" );

//WEEK

PWH5 = ParamList("WH5",   "HIDE|SHOW" );
PWH4 = ParamList("WH4",   "HIDE|SHOW" );
PWH3 = ParamList("WH3",   "HIDE|SHOW" );
PWH2 = ParamList("WH2",   "SHOW|HIDE" );
PWH1 = ParamList("WH1",   "HIDE|SHOW" );
PWMID = ParamList("WMID", "HIDE|SHOW" ); 
PWL1 = ParamList("WL1",   "HIDE|SHOW" );
PWL2 = ParamList("WL2",   "SHOW|HIDE" );
PWL3 = ParamList("WL3",   "HIDE|SHOW" );
PWL4 = ParamList("WL4",   "HIDE|SHOW" );
PWL5 = ParamList("WL5",   "HIDE|SHOW" );

// TWO WEEK

PTWH5 = ParamList("TWH5",   "HIDE|SHOW" );
PTWH4 = ParamList("TWH4",   "HIDE|SHOW" );
PTWH3 = ParamList("TWH3",   "HIDE|SHOW" );
PTWH2 = ParamList("TWH2",   "SHOW|HIDE" );
PTWH1 = ParamList("TWH1",   "HIDE|SHOW" );
PTWMID = ParamList("TWMID", "HIDE|SHOW" ); 
PTWL1 = ParamList("TWL1",   "HIDE|SHOW" );
PTWL2 = ParamList("TWL2",   "SHOW|HIDE" );
PTWL3 = ParamList("TWL3",   "HIDE|SHOW" );
PTWL4 = ParamList("TWL4",   "HIDE|SHOW" );
PTWL5 = ParamList("TWL5",   "HIDE|SHOW" );

// MONTH

PMH5 = ParamList("MH5",   "HIDE|SHOW" );
PMH4 = ParamList("MH4",   "HIDE|SHOW" );
PMH3 = ParamList("MH3",   "HIDE|SHOW" );
PMH2 = ParamList("MH2",   "SHOW|HIDE");
PMH1 = ParamList("MH1",   "HIDE|SHOW" );
PMMID = ParamList("MMID", "HIDE|SHOW" ); 
PML1 = ParamList("ML1",   "HIDE|SHOW" );
PML2 = ParamList("ML2",   "SHOW|HIDE" );
PML3 = ParamList("ML3",   "HIDE|SHOW" );
PML4 = ParamList("ML4",   "HIDE|SHOW" );
PML5 = ParamList("ML5",   "HIDE|SHOW" );

// QUARTER

PQH5 = ParamList("QH5",   "HIDE|SHOW" );
PQH4 = ParamList("QH4",   "HIDE|SHOW" );
PQH3 = ParamList("QH3",   "HIDE|SHOW" );
PQH2 = ParamList("QH2",   "HIDE|SHOW" );
PQH1 = ParamList("QH1",   "HIDE|SHOW" );
PQMID = ParamList("QMID", "HIDE|SHOW" ); 
PQL1 = ParamList("QL1",   "HIDE|SHOW" );
PQL2 = ParamList("QL2",   "HIDE|SHOW" );
PQL3 = ParamList("QL3",   "HIDE|SHOW" );
PQL4 = ParamList("QL4",   "HIDE|SHOW" );
PQL5 = ParamList("QL5",   "HIDE|SHOW" );

// YEAR

PYH5 = ParamList("YH5",   "HIDE|SHOW" );
PYH4 = ParamList("YH4",   "HIDE|SHOW" );
PYH3 = ParamList("YH3",   "HIDE|SHOW" );
PYH2 = ParamList("YH2",   "HIDE|SHOW" );
PYH1 = ParamList("YH1",   "HIDE|SHOW" );
PYMID = ParamList("YMID", "HIDE|SHOW" ); 
PYL1 = ParamList("YL1",   "HIDE|SHOW" );
PYL2 = ParamList("YL2",   "HIDE|SHOW" );
PYL3 = ParamList("YL3",   "HIDE|SHOW" );
PYL4 = ParamList("YL4",   "HIDE|SHOW" );
PYL5 = ParamList("YL5",   "HIDE|SHOW" );

DayCOLOR = 10;
weekCOLOR =7; 
TWOWEEKCOLOR =9;
monthCOLOR =11;
QUARTERCOLOR = 14;
YearCOLOR = 6;
L2COLOR = 5;
H2COLOR = 4;

/*--------------------------------------*/

/*PRICE ANALYSIS OF STOCKS */
YH = Ref(HHV(High,255),-1);
YL =  Ref(LLV(Low,255),-1);
THREEYEARHIGH = Ref(HHV(High,760),-1);
THREEYEARLOW = Ref(LLV(Low,760),-1);
PQH = TimeFrameGetPrice( "H", inQuarterly, -1 );
PQL=  TimeFrameGetPrice( "L", inQuarterly, -1 );
PMH = TimeFrameGetPrice( "H", inMonthly, -1 );
PML =  TimeFrameGetPrice( "L", inMonthly, -1 );
PTWH = TimeFrameGetPrice( "H", inWeekly*2, -1 );
PTWL =  TimeFrameGetPrice( "L", inWeekly*2, -1 );
PWH = TimeFrameGetPrice( "H", inWeekly, -1 );
PWL =  TimeFrameGetPrice( "L", inWeekly, -1 );
PDH = TimeFrameGetPrice( "H", inDaily, -1 );
PDL =  TimeFrameGetPrice( "L", inDaily, -1 );



//      Add Pivot levels AND PRICE LEVELS on charts as text
Title = EncodeColor(colorDarkTeal)+ "\n"+ "\n"+"\n"+ "\n" +

EncodeColor(DayCOLOR)+"DH5 = "+ DH5 +"\n"+
EncodeColor(DayCOLOR)+"DH4 = "+ DH4 +"\n"+
EncodeColor(DayCOLOR)+"DH3 = "+ DH3 +"\n"+
EncodeColor(H2COLOR)+"DH2 = "+ DH2 + "\n"+
EncodeColor(DayCOLOR)+"DH1 = "+ DH1 + "\n"+ "\n"+
EncodeColor(DayCOLOR)+"DMID = "+ DMID + "\n"+ "\n" +
EncodeColor(DayCOLOR)+"DL1 = "+ DL1 + "\n"+
EncodeColor(L2COLOR)+"DL2 = "+ DL2 + "\n"+
EncodeColor(DayCOLOR)+"DL3 = "+ DL3 + "\n"+
EncodeColor(DayCOLOR)+"DL4 = "+ DL4 + " \n"+
EncodeColor(DayCOLOR)+"DL5 = "+ DL5 + "\n"+ "\n"+

EncodeColor(weekCOLOR)+"WH5 = "+ WH5 +"\n"+
EncodeColor(weekCOLOR)+"WH4 = "+ WH4 +"\n"+
EncodeColor(weekCOLOR)+"WH3 = "+ WH3 +"\n"+
EncodeColor(H2COLOR)+"WH2 = "+ WH2 + "\n"+
EncodeColor(weekCOLOR)+"WH1 = "+ WH1 + "\n"+ "\n"+
EncodeColor(weekCOLOR)+"WMID = "+ QMID + "\n"+ "\n" +
EncodeColor(weekCOLOR)+"WL1 = "+ WL1 + "\n"+
EncodeColor(L2COLOR)+"WL2 = "+ WL2 + "\n"+
EncodeColor(weekCOLOR)+"WL3 = "+ WL3 + "\n"+
EncodeColor(weekCOLOR)+"WL4 = "+ WL4 + " \n"+
EncodeColor(weekCOLOR)+"WL5 = "+ WL5 + "\n"+ "\n"+ 

EncodeColor(H2COLOR)+"THREE YEARLY HIGH = "+ THREEYEARHIGH +"\n"+
EncodeColor(H2COLOR)+"YEARLY HIGH = "+ YH +"\n"+
EncodeColor(H2COLOR)+"PQH = "+ PQH+"\n"+
EncodeColor(H2COLOR)+"PMH = "+ PMH +"\n"+
EncodeColor(H2COLOR)+"PTWH = "+ PTWH + "\n"+
EncodeColor(H2COLOR)+"PWH = "+ PWH + "\n"+
EncodeColor(H2COLOR)+"PDH = "+ PDH + "\n"+ "\n" +
EncodeColor(L2COLOR)+"PDL = "+ PDL + "\n"+
EncodeColor(L2COLOR)+"PWL = "+ PWL + " \n"+
EncodeColor(L2COLOR)+"PTWL = "+ PTWL + "\n"+ 
EncodeColor(L2COLOR)+"PML = "+ PML + "\n"+
EncodeColor(L2COLOR)+"PQL= "+ PQL + "\n"+
EncodeColor(L2COLOR)+"YEARLY LOW = "+ YL  + "\n"+
EncodeColor(L2COLOR)+"THREE YEARLY LOW = "+ THREEYEARLOW + " \n" ;

/*--------------------------------------*/
// LABELS
for( i = 0; i < BarCount; i++ ) 
{

  //day
 if(i+slide1== BarCount && (PDH5=="SHOW" OR SHALD=="all") && SHALD!="hide")
PlotText( "DAILY H5 =   "+DH5 ,i+slide,DH5+slide_Hight ,DayCOLOR);

 if(i+slide1== BarCount && (PDH4=="SHOW" OR SHALD=="all") && SHALD!="hide")
PlotText( "DAILY H4 =   "+DH4 ,i+slide,DH4+slide_Hight ,DayCOLOR);

 if(i+slide1== BarCount && (PDH3=="SHOW" OR SHALD=="all") && SHALD!="hide")
PlotText( "DAILY H3 =   "+DH3 ,i+slide,DH3+slide_Hight ,DayCOLOR);

 if(i+slide1== BarCount && (PDH2=="SHOW" OR SHALD=="all") && SHALD!="hide")
PlotText( "DAILY H2 =   "+DH2 ,i+slide,DH2+slide_Hight ,DayCOLOR);

 if(i+slide1== BarCount && (PDH1=="SHOW" OR SHALD=="all") && SHALD!="hide")
PlotText( "DAILY H1 =   "+DH1 ,i+slide,DH1+slide_Hight ,DayCOLOR);

 if(i+slide1== BarCount && (PDMID=="SHOW" OR SHALD=="all") && SHALD!="hide")
PlotText( "DAILY MID =   "+DMID ,i+slide,DMID+slide_Hight ,DayCOLOR);

 if(i+slide1== BarCount && (PDL1=="SHOW" OR SHALD=="all") && SHALD!="hide")
PlotText( "DAILY L1 =   "+DL1 ,i+slide,DL1+slide_Hight ,DayCOLOR);

if(i+slide1== BarCount && (PDL2=="SHOW" OR SHALD=="all") && SHALD!="hide")
PlotText( "DAILY L2 =   "+DL2 ,i+slide,DL2+slide_Hight ,DayCOLOR);

if(i+slide1== BarCount && (PDL3=="SHOW" OR SHALD=="all") && SHALD!="hide")
PlotText( "DAILY L3 =   "+DL3 ,i+slide,DL3+slide_Hight ,DayCOLOR);

if(i+slide1== BarCount && (PDL4=="SHOW" OR SHALD=="all") && SHALD!="hide")
PlotText( "DAILY L4 =   "+DL4 ,i+slide,DL4+slide_Hight ,DayCOLOR);

if(i+slide1== BarCount && (PDL5=="SHOW" OR SHALD=="all") && SHALD!="hide")
PlotText( "DAILY L5 =   "+DL5 ,i+slide,DL5+slide_Hight ,DayCOLOR);

 
 //WEEK
 if(i+slide2== BarCount && (PWH5=="SHOW" OR SHALW=="all") && SHALW!="hide")
PlotText( "WEEKLY H5 =   "+WH5 ,i+slide,WH5+slide_Hight ,WEEKCOLOR);

 if(i+slide2== BarCount && (PWH4=="SHOW" OR SHALW=="all") && SHALW!="hide")
PlotText( "WEEKLY H4 =   "+WH4 ,i+slide,WH4+slide_Hight ,WEEKCOLOR);

 if(i+slide2== BarCount && (PWH3=="SHOW" OR SHALW=="all") && SHALW!="hide")
PlotText( "WEEKLY H3 =   "+WH3 ,i+slide,WH3+slide_Hight ,WEEKCOLOR);

 if(i+slide2== BarCount && (PWH2=="SHOW" OR SHALW=="all") && SHALW!="hide")
PlotText( "WEEKLY H2 =   "+WH2 ,i+slide,WH2+slide_Hight ,WEEKCOLOR);

 if(i+slide2== BarCount && (PWH1=="SHOW" OR SHALW=="all") && SHALW!="hide")
PlotText( "WEEKLY H1 "+WH1 ,i+slide,WH1+slide_Hight ,WEEKCOLOR);

 if(i+slide2== BarCount && (PWMID=="SHOW" OR SHALW=="all") && SHALW!="hide")
PlotText( "WEEKLY MID =   "+WMID ,i+slide,WMID+slide_Hight ,WEEKCOLOR);

 if(i+slide2== BarCount && (PWL1=="SHOW" OR SHALW=="all") && SHALW!="hide")
PlotText( "WEEKLY L1 =   "+WL1 ,i+slide,WL1+slide_Hight ,WEEKCOLOR);

if(i+slide2== BarCount && (PWL2=="SHOW" OR SHALW=="all") && SHALW!="hide")
PlotText( "WEEKLY L2 "+WL2 ,i+slide,WL2+slide_Hight ,WEEKCOLOR);

if(i+slide2== BarCount && (PWL3=="SHOW" OR SHALW=="all") && SHALW!="hide")
PlotText( "WEEKLY L3 =   "+WL3 ,i+slide,WL3+slide_Hight ,WEEKCOLOR);

if(i+slide2== BarCount && (PWL4=="SHOW" OR SHALW=="all") && SHALW!="hide")
PlotText( "WEEKLY L4 =   "+WL4 ,i+slide,WL4+slide_Hight ,WEEKCOLOR);

if(i+slide2== BarCount && (PWL5=="SHOW" OR SHALW=="all") && SHALW!="hide")
PlotText( "WEEKLY L5 =   "+WL5 ,i+slide,WL5+slide_Hight ,WEEKCOLOR);

 // TWO WEEK
 if(i+slide3== BarCount && (PTWH5=="SHOW" OR SHALTW=="all") && SHALTW!="hide")
PlotText( "TWO WEEK H5 =   "+TWH5 ,i+slide,TWH5+slide_Hight ,TWOWEEKCOLOR);

 if(i+slide3== BarCount && (PTWH4=="SHOW" OR SHALTW=="all") && SHALTW!="hide")
PlotText( "TWO WEEK H4 =   "+TWH4 ,i+slide,TWH4+slide_Hight ,TWOWEEKCOLOR);

 if(i+slide3== BarCount && (PTWH3=="SHOW" OR SHALTW=="all") && SHALTW!="hide")
PlotText( "TWO WEEK H3 =   "+TWH3 ,i+slide,TWH3+slide_Hight ,TWOWEEKCOLOR);

 if(i+slide3== BarCount && (PTWH2=="SHOW" OR SHALTW=="all") && SHALTW!="hide")
PlotText( "TWO WEEK H2 =   "+TWH2 ,i+slide,TWH2+slide_Hight ,TWOWEEKCOLOR);

 if(i+slide3== BarCount && (PTWH1=="SHOW" OR SHALTW=="all") && SHALTW!="hide")
PlotText( "TWO WEEK H1 =   "+TWH1 ,i+slide,TWH1+slide_Hight ,TWOWEEKCOLOR);

 if(i+slide3== BarCount && (PTWMID=="SHOW" OR SHALTW=="all") && SHALTW!="hide")
PlotText( "TWO WEEK MID =   "+TWMID ,i+slide,TWMID+slide_Hight ,TWOWEEKCOLOR);

 if(i+slide3== BarCount && (PTWL1=="SHOW" OR SHALTW=="all") && SHALTW!="hide")
PlotText( "TWO WEEK L1 =   "+TWL1 ,i+slide,TWL1+slide_Hight ,TWOWEEKCOLOR);

if(i+slide3== BarCount && (PTWL2=="SHOW" OR SHALTW=="all") && SHALTW!="hide")
PlotText( "TWO WEEK L2 =   "+TWL2 ,i+slide,TWL2+slide_Hight ,TWOWEEKCOLOR);

if(i+slide3== BarCount && (PTWL3=="SHOW" OR SHALTW=="all") && SHALTW!="hide")
PlotText( "TWO WEEK L3 =   "+TWL3 ,i+slide,TWL3+slide_Hight ,TWOWEEKCOLOR);

if(i+slide3== BarCount && (PTWL4=="SHOW" OR SHALTW=="all") && SHALTW!="hide")
PlotText( "TWO WEEK L4 =   "+TWL4 ,i+slide,TWL4+slide_Hight ,TWOWEEKCOLOR);

if(i+slide3== BarCount && (PTWL5=="SHOW" OR SHALTW=="all") && SHALTW!="hide")
PlotText( "TWO WEEK L5 =   "+TWL5 ,i+slide,TWL5+slide_Hight ,TWOWEEKCOLOR);

// MONTHLY
 if(i+slide4== BarCount && (PMH5=="SHOW" OR SHALM=="all") && SHALM!="hide")
PlotText( "MONTHLY H5 =   "+MH5 ,i+slide,MH5+slide_Hight ,MONTHCOLOR);

 if(i+slide4== BarCount && (PMH4=="SHOW" OR SHALM=="all") && SHALM!="hide")
PlotText( "MONTHLY H4 =   "+MH4 ,i+slide,MH4+slide_Hight ,MONTHCOLOR);

 if(i+slide4== BarCount && (PMH3=="SHOW" OR SHALM=="all") && SHALM!="hide")
PlotText( "MONTHLY H3 =   "+MH3 ,i+slide,MH3+slide_Hight ,MONTHCOLOR);

 if(i+slide4== BarCount && (PMH2=="SHOW" OR SHALM=="all") && SHALM!="hide")
PlotText( "MONTHLY H2 =   "+MH2 ,i+slide,MH2+slide_Hight ,MONTHCOLOR);

 if(i+slide4== BarCount && (PMH1=="SHOW" OR SHALM=="all") && SHALM!="hide")
PlotText( "MONTHLY H1 =   "+MH1 ,i+slide,MH1+slide_Hight ,MONTHCOLOR);

 if(i+slide4== BarCount && (PMMID=="SHOW" OR SHALM=="all") && SHALM!="hide")
PlotText( "MONTHLY MID =   "+MMID ,i+slide,MMID+slide_Hight ,MONTHCOLOR);

 if(i+slide4== BarCount && (PML1=="SHOW" OR SHALM=="all") && SHALM!="hide")
PlotText( "MONTHLY L1 =   "+ML1 ,i+slide,ML1+slide_Hight ,MONTHCOLOR);

if(i+slide4== BarCount && (PML2=="SHOW" OR SHALM=="all") && SHALM!="hide")
PlotText( "MONTHLY L2 =   "+ML2 ,i+slide,ML2+slide_Hight ,MONTHCOLOR);

if(i+slide4== BarCount && (PML3=="SHOW" OR SHALM=="all") && SHALM!="hide")
PlotText( "MONTHLY L3 =   "+ML3 ,i+slide,ML3+slide_Hight ,MONTHCOLOR);

if(i+slide4== BarCount && (PML4=="SHOW" OR SHALM=="all") && SHALM!="hide")
PlotText( "MONTHLY L4 =   "+ML4 ,i+slide,ML4+slide_Hight ,MONTHCOLOR);

if(i+slide4== BarCount && (PML5=="SHOW" OR SHALM=="all") && SHALM!="hide")
PlotText( "MONTHLY L5 =   "+ML5 ,i+slide,ML5+slide_Hight ,MONTHCOLOR);


 // QUARTERLY
 if(i+slide5== BarCount && (PQH5=="SHOW" OR SHALQ=="all") && SHALQ!="hide")
PlotText( "QUARTERLY H5 =   "+QH5 ,i+slide,QH5+slide_Hight ,QUARTERCOLOR);

 if(i+slide5== BarCount && (PQH4=="SHOW" OR SHALQ=="all") && SHALQ!="hide")
PlotText( "QUARTERLY H4 =   "+QH4 ,i+slide,QH4+slide_Hight ,QUARTERCOLOR);

 if(i+slide5== BarCount && (PQH3=="SHOW" OR SHALQ=="all") && SHALQ!="hide")
PlotText( "QUARTERLY H3 "+QH3 ,i+slide,QH3+slide_Hight ,QUARTERCOLOR);

 if(i+slide5== BarCount && (PQH2=="SHOW" OR SHALQ=="all") && SHALQ!="hide")
PlotText( "QUARTERLY H2 =   "+QH2 ,i+slide,QH2+slide_Hight ,QUARTERCOLOR);

 if(i+slide5== BarCount && (PQH1=="SHOW" OR SHALQ=="all") && SHALQ!="hide")
PlotText( "QUARTERLY H1 =   "+QH1 ,i+slide,QH1+slide_Hight ,QUARTERCOLOR);

 if(i+slide5== BarCount && (PQMID=="SHOW" OR SHALQ=="all") && SHALQ!="hide")
PlotText( "QUARTERLY MID =   "+QMID ,i+slide,QMID+slide_Hight ,QUARTERCOLOR);

 if(i+slide5== BarCount && (PQL1=="SHOW" OR SHALQ=="all") && SHALQ!="hide")
PlotText( "QUARTERLY L1 =   "+QL1 ,i+slide,QL1+slide_Hight ,QUARTERCOLOR);

if(i+slide5== BarCount && (PQL2=="SHOW" OR SHALQ=="all") && SHALQ!="hide")
PlotText( "QUARTERLY L2 =   "+QL2 ,i+slide,QL2+slide_Hight ,QUARTERCOLOR);

if(i+slide5== BarCount && (PQL3=="SHOW" OR SHALQ=="all") && SHALQ!="hide")
PlotText( "QUARTERLY L3 =   "+QL3 ,i+slide,QL3+slide_Hight ,QUARTERCOLOR);

if(i+slide5== BarCount && (PQL4=="SHOW" OR SHALQ=="all") && SHALQ!="hide")
PlotText( "QUARTERLY L4 =   "+QL4 ,i+slide,QL4+slide_Hight ,QUARTERCOLOR);

if(i+slide5== BarCount && (PQL5=="SHOW" OR SHALQ=="all") && SHALQ!="hide")
PlotText( "QUARTERLY L5 =   "+QL5 ,i+slide,QL5+slide_Hight ,QUARTERCOLOR);

 // YAERLY
// YAERLY
 if(i+slide6== BarCount && (PYH5=="SHOW" OR SHALY=="all") && SHALY!="hide")
PlotText( "YAERLY H5 =   "+YH5 ,i+slide,YH5+slide_Hight ,YEARCOLOR);

 if(i+slide6== BarCount && (PYH4=="SHOW" OR SHALY=="all") && SHALY!="hide")
PlotText( "YAERLY H4 =   "+YH4 ,i+slide,YH4+slide_Hight ,YEARCOLOR);

 if(i+slide6== BarCount && (PYH3=="SHOW" OR SHALY=="all") && SHALY!="hide")
PlotText( "YAERLY H3  "+YH3 ,i+slide,YH3+slide_Hight ,YEARCOLOR);

 if(i+slide6== BarCount && (PYH2=="SHOW" OR SHALY=="all") && SHALY!="hide")
PlotText( "YAERLY H2 =   "+YH2 ,i+slide,YH2+slide_Hight ,YEARCOLOR);

 if(i+slide6== BarCount && (PYH1=="SHOW" OR SHALY=="all") && SHALY!="hide")
PlotText( "YAERLY H1 =   "+YH1 ,i+slide,YH1+slide_Hight ,YEARCOLOR);

 if(i+slide6== BarCount && (PYMID=="SHOW" OR SHALY=="all") && SHALY!="hide")
PlotText( "YAERLY MID =   "+YMID ,i+slide,YMID+slide_Hight ,YEARCOLOR);

 if(i+slide6== BarCount && (PYL1=="SHOW" OR SHALY=="all") && SHALY!="hide")
PlotText( "YAERLY L1 =   "+YL1 ,i+slide,YL1+slide_Hight ,YEARCOLOR);

if(i+slide6== BarCount && (PYL2=="SHOW" OR SHALY=="all") && SHALY!="hide")
PlotText( "YAERLY L2 =   "+YL2 ,i+slide,YL2+slide_Hight ,YEARCOLOR);

if(i+slide6== BarCount && (PYL3=="SHOW" OR SHALY=="all") && SHALY!="hide")
PlotText( "YAERLY L3 =   "+YL3 ,i+slide,YL3+slide_Hight ,YEARCOLOR);

if(i+slide6== BarCount && (PYL4=="SHOW" OR SHALY=="all") && SHALY!="hide")
PlotText( "YAERLY L4 =   "+YL4 ,i+slide,YL4+slide_Hight ,YEARCOLOR);

if(i+slide6== BarCount && (PYL5=="SHOW" OR SHALY=="all") && SHALY!="hide")
PlotText( "YAERLY L5 =   "+YL5 ,i+slide,YL5+slide_Hight ,YEARCOLOR);
}
/*--------------------------------------*/
// PLOTS


//day


if ((PDH5=="SHOW" OR SHALD=="all")  && SHALD!="hide") Plot (DH5,"daily H5",DayCOLOR,1);

if ((PDH4=="SHOW" OR SHALD=="all")  && SHALD!="hide") Plot (DH4,"daily H4",DayCOLOR,1);

if ((PDH3=="SHOW" OR SHALD=="all")  && SHALD!="hide") Plot (DH3,"daily H3",DayCOLOR,1);

if ((PDH2=="SHOW" OR SHALD=="all")  && SHALD!="hide") Plot (DH2,"daily H2",H2COLOR,32);

if ((PDH1=="SHOW" OR SHALD=="all")  && SHALD!="hide") Plot (DH1,"daily H1",DayCOLOR,1);

if ((PDMID=="SHOW" OR SHALD=="all")  && SHALD!="hide") Plot (DMID,"daily MID",DayCOLOR,1);

if ((PDL1=="SHOW" OR SHALD=="all")  && SHALD!="hide") Plot (DL1,"daily L1",DayCOLOR,1);

if ((PDL2=="SHOW" OR SHALD=="all")  && SHALD!="hide") Plot (DL2,"daily L2",L2COLOR,32);

if ((PDL3=="SHOW" OR SHALD=="all")  && SHALD!="hide") Plot (DL3,"daily L3",DayCOLOR,1);

if ((PDL4=="SHOW" OR SHALD=="all")  && SHALD!="hide") Plot (DL4,"daily L4",DayCOLOR,1);

if ((PDL5=="SHOW" OR SHALD=="all")  && SHALD!="hide") Plot (DL5,"daily L5",DayCOLOR,1);

//WEEK


if ((PWH5=="SHOW" OR SHALW=="all")  && SHALW!="hide") Plot (WH5,"WEEKLY H5",WEEKCOLOR,1);

if ((PWH4=="SHOW" OR SHALW=="all")  && SHALW!="hide") Plot (WH4,"WEEKLY H4",WEEKCOLOR,1);

if ((PWH3=="SHOW" OR SHALW=="all")  && SHALW!="hide") Plot (WH3,"WEEKLY H3",WEEKCOLOR,1);

if ((PWH2=="SHOW" OR SHALW=="all")  && SHALW!="hide") Plot (WH2,"WEEKLY H2",H2COLOR,32);

if ((PWH1=="SHOW" OR SHALW=="all")  && SHALW!="hide") Plot (WH1,"WEEKLY H1",WEEKCOLOR,1);

if ((PWMID=="SHOW" OR SHALW=="all")  && SHALW!="hide") Plot (WMID,"WEEKLY MID",WEEKCOLOR,1);

if ((PWL1=="SHOW" OR SHALW=="all")  && SHALW!="hide") Plot (WL1,"WEEKLY L1",WEEKCOLOR,1);

if ((PWL2=="SHOW" OR SHALW=="all")  && SHALW!="hide") Plot (WL2,"WEEKLY L2",L2COLOR,32);

if ((PWL3=="SHOW" OR SHALW=="all")  && SHALW!="hide") Plot (WL3,"WEEKLY L3",WEEKCOLOR,1);

if ((PWL4=="SHOW" OR SHALW=="all")  && SHALW!="hide") Plot (WL4,"WEEKLY L4",WEEKCOLOR,1);

if ((PWL5=="SHOW" OR SHALW=="all")  && SHALW!="hide") Plot (WL5,"WEEKLY L5",WEEKCOLOR,1);

//TWO WEEK

if ((PTWH5=="SHOW" OR SHALTW=="all")  && SHALTW!="hide") Plot (TWH5,"TWOWEEKLY H5",TWOWEEKCOLOR,1);

if ((PTWH4=="SHOW" OR SHALTW=="all")  && SHALTW!="hide") Plot (TWH4,"TWOWEEKLY H4",TWOWEEKCOLOR,1);

if ((PTWH3=="SHOW" OR SHALTW=="all")  && SHALTW!="hide") Plot (TWH3,"TWOWEEKLY H3",TWOWEEKCOLOR,1);

if ((PTWH2=="SHOW" OR SHALTW=="all")  && SHALTW!="hide") Plot (TWH2,"TWOWEEKLY H2",H2COLOR,32);

if ((PTWH1=="SHOW" OR SHALTW=="all")  && SHALTW!="hide") Plot (TWH1,"TWOWEEKLY H1",TWOWEEKCOLOR,1);

if ((PTWMID=="SHOW" OR SHALTW=="all")  && SHALTW!="hide") Plot (TWMID,"TWOWEEKLY MID",TWOWEEKCOLOR,1);

if ((PTWL1=="SHOW" OR SHALTW=="all")  && SHALTW!="hide") Plot (TWL1,"TWOWEEKLY L1",TWOWEEKCOLOR,1);

if ((PTWL2=="SHOW" OR SHALTW=="all")  && SHALTW!="hide") Plot (TWL2,"TWOWEEKLY L2",L2COLOR,32);

if ((PTWL3=="SHOW" OR SHALTW=="all")  && SHALTW!="hide") Plot (TWL3,"TWOWEEKLY L3",TWOWEEKCOLOR,1);

if ((PTWL4=="SHOW" OR SHALTW=="all")  && SHALTW!="hide") Plot (TWL4,"TWOWEEKLY L4",TWOWEEKCOLOR,1);

if ((PTWL5=="SHOW" OR SHALTW=="all")  && SHALTW!="hide") Plot (TWL5,"TWOWEEKLY L5",TWOWEEKCOLOR,1);

//MONTH


if ((PMH5=="SHOW" OR SHALM=="all")  && SHALM!="hide") Plot (MH5,"MONTHLY H5",MONTHCOLOR,1);

if ((PMH4=="SHOW" OR SHALM=="all")  && SHALM!="hide") Plot (MH4,"MONTHLY H4",MONTHCOLOR,1);

if ((PMH3=="SHOW" OR SHALM=="all")  && SHALM!="hide") Plot (MH3,"MONTHLY H3",MONTHCOLOR,1);

if ((PMH2=="SHOW" OR SHALM=="all")  && SHALM!="hide") Plot (MH2,"MONTHLY H2",H2COLOR,32);

if ((PMH1=="SHOW" OR SHALM=="all")  && SHALM!="hide") Plot (MH1,"MONTHLY H1",MONTHCOLOR,1);

if ((PMMID=="SHOW" OR SHALM=="all")  && SHALM!="hide") Plot (MMID,"MONTHLY MID",MONTHCOLOR,1);

if ((PML1=="SHOW" OR SHALM=="all")  && SHALM!="hide") Plot (ML1,"MONTHLY L1",MONTHCOLOR,1);

if ((PML2=="SHOW" OR SHALM=="all")  && SHALM!="hide") Plot (ML2,"MONTHLY L2",L2COLOR,32);

if ((PML3=="SHOW" OR SHALM=="all")  && SHALM!="hide") Plot (ML3,"MONTHLY L3",MONTHCOLOR,1);

if ((PML4=="SHOW" OR SHALM=="all")  && SHALM!="hide") Plot (ML4,"MONTHLY L4",MONTHCOLOR,1);

if ((PML5=="SHOW" OR SHALM=="all")  && SHALM!="hide") Plot (ML5,"MONTHLY L5",MONTHCOLOR,1);


//QUARTER


if ((PQH5=="SHOW" OR SHALQ=="all")  && SHALQ!="hide") Plot (QH5,"QUARTERLY H5",QUARTERCOLOR,1);

if ((PQH4=="SHOW" OR SHALQ=="all")  && SHALQ!="hide") Plot (QH4,"QUARTERLY H4",QUARTERCOLOR,1);

if ((PQH3=="SHOW" OR SHALQ=="all")  && SHALQ!="hide") Plot (QH3,"QUARTERLY H3",QUARTERCOLOR,1);

if ((PQH2=="SHOW" OR SHALQ=="all")  && SHALQ!="hide") Plot (QH2,"QUARTERLY H2",H2COLOR,32);

if ((PQH1=="SHOW" OR SHALQ=="all")  && SHALQ!="hide") Plot (QH1,"QUARTERLY H1",QUARTERCOLOR,1);

if ((PQMID=="SHOW" OR SHALQ=="all")  && SHALQ!="hide") Plot (QMID,"QUARTERLY MID",QUARTERCOLOR,1);

if ((PQL1=="SHOW" OR SHALQ=="all")  && SHALQ!="hide") Plot (QL1,"QUARTERLY L1",QUARTERCOLOR,1);

if ((PQL2=="SHOW" OR SHALQ=="all")  && SHALQ!="hide") Plot (QL2,"QUARTERLY L2",L2COLOR,32);

if ((PQL3=="SHOW" OR SHALQ=="all")  && SHALQ!="hide") Plot (QL3,"QUARTERLY L3",QUARTERCOLOR,1);

if ((PQL4=="SHOW" OR SHALQ=="all")  && SHALQ!="hide") Plot (QL4,"QUARTERLY L4",QUARTERCOLOR,1);

if ((PQL5=="SHOW" OR SHALQ=="all")  && SHALQ!="hide") Plot (QL5,"QUARTERLY L5",QUARTERCOLOR,1);


//YEAR


if ((PYH5=="SHOW" OR SHALY=="all")  && SHALY!="hide") Plot (YH5,"YEARLY H5",YEARCOLOR,1);

if ((PYH4=="SHOW" OR SHALY=="all")  && SHALY!="hide") Plot (YH4,"YEARLY H4",YEARCOLOR,1);

if ((PYH3=="SHOW" OR SHALY=="all")  && SHALY!="hide") Plot (YH3,"YEARLY H3",YEARCOLOR,1);

if ((PYH2=="SHOW" OR SHALY=="all")  && SHALY!="hide") Plot (YH2,"YEARLY H2",H2COLOR,32);

if ((PYH1=="SHOW" OR SHALY=="all")  && SHALY!="hide") Plot (YH1,"YEARLY H1",YEARCOLOR,1);

if ((PYMID=="SHOW" OR SHALY=="all")  && SHALY!="hide") Plot (YMID,"YEARLY MID",YEARCOLOR,1);

if ((PYL1=="SHOW" OR SHALY=="all")  && SHALY!="hide") Plot (YL1,"YEARLY L1",YEARCOLOR,1);

if ((PYL2=="SHOW" OR SHALY=="all")  && SHALY!="hide") Plot (YL2,"YEARLY L2",L2COLOR,32);

if ((PYL3=="SHOW" OR SHALY=="all")  && SHALY!="hide") Plot (YL3,"YEARLY L3",YEARCOLOR,1);

if ((PYL4=="SHOW" OR SHALY=="all")  && SHALY!="hide") Plot (YL4,"YEARLY L4",YEARCOLOR,1);

if ((PYL5=="SHOW" OR SHALY=="all")  && SHALY!="hide") Plot (YL5,"YEARLY L5",YEARCOLOR,1);

/*--------------------------------------*/
// TEXT
"high  = "+H;
"low   =  "+L;
"close = "+C;


GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/8 );
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ColorHSB( 42, 42, 42 ) );
GfxSetBkMode(1); // transparent
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/12 );

C11=ParamColor("up panel",colorBlack );
C12=ParamColor("dn panel",colorBlack );
C13=Param("fonts",100,10,30,1 );
C14=Param("left-right",1.2,1.0,5.0,0.1 );
C15=Param("up-down",9,1,30,1 );
Miny = Status("axisminy");
Maxy = Status("axismaxy");
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");
GfxSetBkMode( 0 ); 
GfxSelectFont("Tahoma", 12, 500, False, False, 0);
GfxSetTextColor(colorCustom12); 
GfxSetTextAlign( 6 );
GfxSelectFont("Tahoma", 40, 600, False, False, 0);
GfxSetTextColor(colorWhite); 
GfxSetTextAlign( 6 );
GfxTextOut( "LTP: "+WriteVal(C,1.2), Status("pxwidth")/C14, Status("pxheight")/C15);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorBrightGreen);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorRed);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorYellow);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorGreen);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorGreen);


pricechange=(C-Ref(C,-1))*100/Ref(C,-1);
changeponit=C-Ref(C,-1);
Vlp=Param("Volume lookback period",5,10,15,300,10);
Vrg=MA(V,Vlp);
St = StDev(Vrg,Vlp); 
VOC = Ref(HHV(Volume,10),-1);
Vp3 = Vrg + 3*st; 

x=Param("xposn",1,0,1000,1);
y=Param("yposn",1,0,1000,1);

GfxGradientRect( 1, 1, 1400, 40, colorGrey50, colorDarkGrey);
GfxSetBkMode(0);
GfxSelectFont( "Georgia", 18, 800, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "ALL PIVOT POINT EOD", x+600, y+10 );
GfxSelectFont( "Tahoma", 16, 800, False );
GfxSetTextColor( colorGold );
GfxTextOut( Name(), x+100, y+10 );
GfxSelectFont( "Century Gothic", 15, 100, False );
GfxSetTextColor( colorWhite );
GfxTextOut( Date(), x+1000, y+10 );
GfxSelectFont( "Comic Sans MS", 15, 500, False );
GfxSetTextColor( colorYellow );
GfxTextOut( Interval(2), x+275, y+10 );
//------------------------------------------------------------ H, L, O, C----------------------
GfxGradientRect( 1, 40, 1400, 55, colorGrey50, colorDarkGrey );
GfxSetBkMode(0);
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "High:"+WriteVal(H,1.2), x+100, y+40 );
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Low:"+WriteVal(L,1.2), x+200, y+40 );
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Open:"+WriteVal(O,1.2), x+300, y+40 );
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Close:"+WriteVal(C,1.2), x+400, y+40 );
//-----------------------------------------------------------VOlume-------------------------------
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Volume="+WriteVal(V,1.2), x+550, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(V>Vp3,"VOLUME CONFIRMATION",""), x+1000, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorLime );
GfxTextOut( "VOC="+WriteVal(VOC,1.2), x+800, y+40 );


_SECTION_END();