DEFPARAM DrawOnLastBarOnly = true
//
IF OpenDay <> OpenDay[1] THEN
//
Pips = 20 * pipsize
StartBar = BarIndex
//
// PredeEndDated PRT calculation (H+L+C)/3
Pivt = (DHigh(1) + DLow(1) + DClose(1))/3 // - Pivot
Res3 = DHigh(1)+(2*(Pivt-DLow(1))) //Res3
Res2 = Pivt+(DHigh(1)-DLow(1)) //Res2
Res1 = (2*Pivt) - DLow(1) //Res1
Sup1 = (2*Pivt) - DHigh(1) //Sup1
Sup2 = Pivt-(DHigh(1)-DLow(1)) //Sup2
Sup3 = DLow(1)-(2*(DHigh(1)-Pivt)) //Sup3
//
MyYear = OpenYear
MyMonth = OpenMonth
MyDay = OpenDay
// pack Year, Month and Day into YYYYMMDD
MyDate = (MyYear * 10000000000) + (MyMonth * 100000000) + (MyDay * 1000000)
// add HHMMSS
EndDate = MyDate + (23 * 10000) + (0 * 100) + 0
ENDIF
// plot Pivot at (unknown)barindex of date YYYYMMMDDHHMMSS
DRAWSEGMENT(StartBar,Pivt,DateToBarIndex(EndDate),Pivt) coloured(0,128,0,255) STYLE(dottedline,1)
DRAWTEXT("Pvt #Pivt#",DateToBarIndex(EndDate),Pivt+Pips) coloured(0,128,0,255)
// plot Resistance levels
DRAWSEGMENT(StartBar,Res1,DateToBarIndex(EndDate),Res1) coloured(255,0,0,255) STYLE(dottedline,1)
DRAWTEXT("R1 #Res1#",DateToBarIndex(EndDate),Res1+Pips) coloured(255,0,0,255)
DRAWSEGMENT(StartBar,Res2,DateToBarIndex(EndDate),Res2) coloured(0,0,255,255) STYLE(dottedline,1)
DRAWTEXT("R2 #Res2#",DateToBarIndex(EndDate),Res2+Pips) coloured(0,0,255,255)
DRAWSEGMENT(StartBar,Res3,DateToBarIndex(EndDate),Res3) coloured(0,128,128,255) STYLE(dottedline,1)
DRAWTEXT("R3 #Res3#",DateToBarIndex(EndDate),Res3+Pips) coloured(0,128,128,255)
// plot Support levels
DRAWSEGMENT(StartBar,Sup1,DateToBarIndex(EndDate),Sup1) coloured(255,0,0,64) STYLE(dottedline,1)
DRAWTEXT("S1 #Sup1#",DateToBarIndex(EndDate),Sup1+Pips) coloured(255,0,0,64)
DRAWSEGMENT(StartBar,Sup2,DateToBarIndex(EndDate),Sup2) coloured(0,0,255,64) STYLE(dottedline,1)
DRAWTEXT("S2 #Sup2#",DateToBarIndex(EndDate),Sup2+Pips) coloured(0,0,255,64)
DRAWSEGMENT(StartBar,Sup3,DateToBarIndex(EndDate),Sup3) coloured(0,128,128,64) STYLE(dottedline,1)
DRAWTEXT("S3 #Sup3#",DateToBarIndex(EndDate),Sup3+Pips) coloured(0,128,128,64)
RETURN