REM PIVOT BANDS
//Created by ChrisMoody 11/11/2014
//Current Timeframe, Daily, Weekly, Monthly Pivot Bands
//Special Thanks to Michael S. For Providing Original Code.
// adapted for the platform Prorealtimev10.3 by bolsatrilera
lengthMA=7 // title="EMA Length To Calculate Bands")
PP = (high + low + close)/ 3
PPEMA = ExponentialAverage[lengthMA](PP)
HP1 = (PP + (PP-low))
LP1 = (PP - (high-PP))
HP2 = (PP +
2*(PP-low))
LP2 = (PP - 2*(high-PP))
// PPD71 = Difference from HP1 and LP1 for the last 7 days
PPD71 = (((HP1-LP1)+(HP1[1]-LP1[1])+(HP1[2]-LP1[2])+(HP1[3]-LP1[3])+(HP1[4]-LP1[4])+(HP1[5]-LP1[5])+(HP1[6]-LP1[6]))/7)
// PPD72 = Difference from HP2 and LP2 for the last 7 days
PPD72 = (((HP2-LP2)+(HP2[1]-LP2[1])+(HP2[2]-LP2[2])+(HP2[3]-LP2[3])+(HP2[4]-LP2[4])+(HP2[5]-LP2[5])+(HP2[6]-LP2 [6]))/7)
r1 = PPEMA + PPD71
s1 = PPEMA - PPD71
re2 = PPEMA + PPD72
s2 = PPEMA - PPD72
return r1 coloured(255,0,0)as "R1",s1 coloured(0,255,0)as "S1",re2 coloured(128,0,0)as "R2",s2 coloured(0,128,0)as "S2", PPEMA coloured(255,0,255)as "PIVOT POI