Type : Indicator, Name : Quarterly Pivots
Vars:
Mo(0),
RefHi(0),
RefLo(0),
QuarterC(0),
QuarterH(0),
QuarterL(0),
QPivot(0) ;
{ uses Mod function to detect new quarter: month = 1,4,7, or 10}
Mo = Mod(Month(Date)-1, 3) ;
{ new quarter detected}
If Mo < Mo[1] then begin
QuarterC = C[1] ;
QuarterH = RefHi ;
QuarterL = RefLo ;
RefHi = H ;
RefLo = L ;
QPivot = (QuarterC + QuarterH + QuarterL) / 3 ;
End ;
{ update quarterly high / low}
If H > RefHi then RefHi = H ;
If L < RefLo then RefLo = L ;
If QPivot > 0 then
Plot1(QPivot, «Pivot») ;