// POINT PIVOT HEBDOMADAIRE
IF dayofweek < dayofweek[1] THEN
weekhigh = prevweekhigh
weeklow = prevweeklow
weekclose = prevweekclose
prevweekhigh = high
prevweeklow = low
ENDIF
prevweekhigh = max(prevweekhigh, high)
prevweeklow = min(prevweeklow, low)
prevweekclose = close
PPWeek = (weekhigh + weeklow + weekclose) / 3
Res3 = Res1 + (weekhigh - weeklow)
Res2 = PPWeek + weekhigh - weeklow
Res1 = (2 * PPWeek) - weeklow
Sup1 = (2 * PPWeek) - weekhigh
Sup2 = PPWeek - (weekhigh - weeklow)
Sup3 = Sup1 - (weekhigh - weeklow)
Return Res1 AS "Res1" coloured("green"), Res2 AS "Res2" coloured("green"), Res3 AS "Res3" coloured("green"), PPWeek AS "Pivot" coloured("black"), Sup1 AS "Sup1" coloured("red"), Sup2 AS "Sup2" coloured("red"), Sup3 AS "Sup3" coloured("red"), PPWeek COLOURED(50,50,220) AS"Pivot Week"