-- Capital Synergy Automated Pivot Points V2.6.1; @SETVALUETEXTMODE('None'); @SETNAME('CSPP7', True); @SHOWYGRIDLINE(True); -- OHLC; CD := "C#DAY1"; HD := "H#DAY1"; LD := "L#DAY1"; OD := "O#DAY1"; RD := HD-LD; CS := If(MTMUse,MTM(),CD); Extend(If(IsLastDay & ShowHLC,CD,NaN)),StyleSolid,ColorBlack,Horizontal,Width1; Extend(If(IsLastDay & ShowHLC,MTM(),NaN)),StyleSolid,ColorGray,Horizontal,Width1; Extend(If(IsLastDay & ShowHLC,HD,NaN)),StyleSolid,ColorTeal,Horizontal,Width1; Extend(If(IsLastDay & ShowHLC,LD,NaN)),StyleSolid,ColorTeal,Horizontal,Width1; Extend(If(IsLastDay & ShowHLC,OD,NaN)),StyleSolid,ColorTeal,Horizontal,Width1; DrawText(BarsSince(IsLastDay)==1 & ShowL & ShowHLC,Ref(CD,1),'Close'),Label4,VCenter,Right,ColorBlack; DrawText(BarsSince(IsLastDay)==1 & ShowL & ShowHLC,MTM(),'MTM'),Label4,VCenter,Right,ColorGray; DrawText(BarsSince(IsLastDay)==1 & ShowL & ShowHLC,Ref(HD,1),'High'),Label4,VCenter,Right,ColorTeal; DrawText(BarsSince(IsLastDay)==1 & ShowL & ShowHLC,Ref(LD,1),'Low'),Label4,VCenter,Right,ColorTeal; DrawText(BarsSince(IsLastDay)==1 & ShowL & ShowHLC,Ref(OD,1),'Open'),Label4,VCenter,Right,ColorTeal; -- Pivot Point; PP := Round((CS+HD+LD)/3); DPP := ShowL==1 & (ABS(C-Ref(PP,1)) < PLimit | PLimitUse!=1); Extend(If(IsLastDay & DPP,PP,NaN)),Styledots,ColorBlue,Horizontal,Width2; DrawText(IsLastBar & DPP,Ref(PP,1),'PP'),Label4,VCenter,Left,ColorBlue; -- Balance Point; BPC := CD+FML('Ref(C,1)#DAY1')+FML('Ref(C,2)#DAY1'); BPH := HD+FML('Ref(H,1)#DAY1')+FML('Ref(H,2)#DAY1'); BPL := LD+FML('Ref(L,1)#DAY1')+FML('Ref(L,2)#DAY1'); BP := (BPC+BPH+BPL)/9; DBP := (ABS(C-Ref(BP,1)) < PLimit | PLimitUse!=1); Extend(If(IsLastDay & DBP,BP,NaN)),StyleSolid,ColorOrange,Horizontal,Width1; DrawText(IsLastBar & DBP & ShowL,Ref(BP,1),'BP'),Label4,VCenter,Left,ColorOrange; -- Resistance Levels; R1 := Round((2 * PP) - LD); DR1 := ShowR==1 & ShowNL>=1 & (ABS(C-Ref(R1,1)) < PLimit | PLimitUse!=1); LR1 := If(DR1,Ref(R1,1),C); Extend(If(IsLastDay & DR1,R1,NaN)),StyleSolid,ColorGreen,Horizontal,Width2; DrawText(IsLastBar & DR1 & ShowL,LR1,'R1'),Label4,VCenter,Left,ColorGreen; R1M := Round((PP + R1)/2); Extend(If(IsLastDay & ShowR & ShowMid & (ShowNL>=1) & (ABS(C-Ref(R1M,1)) < PLimit | PLimitUse!=1),R1M,NaN)),StyleDash,ColorGreen,Horizontal,Width1; R2 := Round(PP + RD); DR2 := ShowR==1 & ShowNL>=2 & (ABS(C-Ref(R2,1)) < PLimit | PLimitUse!=1); LR2 := If(DR2 & ShowL,Ref(R2,1),C); Extend(If(IsLastDay & DR2,R2,NaN)),StyleSolid,ColorGreen,Horizontal,Width2; DrawText(IsLastBar & DR2 & ShowL,LR2,'R2'),Label4,VCenter,Left,ColorGreen; R2M := Round((R1 + R2)/2); Extend(If(IsLastDay & ShowR & ShowMid & (ShowNL>=2) & (ABS(C-Ref(R2M,1)) < PLimit | PLimitUse!=1),R2M,NaN)),StyleDash,ColorGreen,Horizontal,Width1; R3 := Round(R1 + RD); DR3 := ShowR==1 & ShowNL>=3 & (ABS(C-Ref(R3,1)) < PLimit | PLimitUse!=1); LR3 := If(DR3,Ref(R3,1),C); Extend(If(IsLastDay & DR3,R3,NaN)),StyleSolid,ColorGreen,Horizontal,Width2; DrawText(IsLastBar & DR3 & ShowL,LR3,'R3'),Label4,VCenter,Left,ColorGreen; R3M := Round((R2 + R3)/2); Extend(If(IsLastDay & ShowR & ShowMid & (ShowNL>=3) & (ABS(C-Ref(R3M,1)) < PLimit | PLimitUse!=1),R3M,NaN)),StyleDash,ColorGreen,Horizontal,Width1; R4 := Round(R2 + RD); DR4 := ShowR==1 & ShowNL>=4 & (ABS(C-Ref(R4,1)) < PLimit | PLimitUse!=1); LR4 := If(DR4,Ref(R4,1),C); Extend(If(IsLastDay & DR4,R4,NaN)),StyleSolid,ColorGreen,Horizontal,Width2; DrawText(IsLastBar & DR4 & ShowL,LR4,'R4'),Label4,VCenter,Left,ColorGreen; R4M := Round((R3 + R4)/2); Extend(If(IsLastDay & ShowR & ShowMid & (ShowNL>=4) & (ABS(C-Ref(R4M,1)) < PLimit | PLimitUse!=1),R4M,NaN)),StyleDash,ColorGreen,Horizontal,Width1; R5 := Round(R3 + RD); DR5 := ShowR==1 & ShowNL>=5 & (ABS(C-Ref(R5,1)) < PLimit | PLimitUse!=1); LR5 := If(DR5,Ref(R5,1),C); Extend(If(IsLastDay & DR5,R5,NaN)),StyleSolid,ColorGreen,Horizontal,Width2; DrawText(IsLastBar & DR5 & ShowL,LR5,'R5'),Label4,VCenter,Left,ColorGreen; R5M := Round((R4 + R5)/2); Extend(If(IsLastDay & ShowR & ShowMid & (ShowNL>=5) & (ABS(C-Ref(R5M,1)) < PLimit | PLimitUse!=1),R5M,NaN)),StyleDash,ColorGreen,Horizontal,Width1; R6 := Round(R4 + RD); DR6 := ShowR==1 & ShowNL>=6 & (ABS(C-Ref(R6,1)) < PLimit | PLimitUse!=1); LR6 := If(DR6,Ref(R6,1),C); Extend(If(IsLastDay & DR6,R6,NaN)),StyleSolid,ColorGreen,Horizontal,Width2; DrawText(IsLastBar & DR6 & ShowL,LR6,'R6'),Label4,VCenter,Left,ColorGreen; R6M := Round((R5 + R6)/2); Extend(If(IsLastDay & ShowR & ShowMid & (ShowNL>=6) & (ABS(C-Ref(R6M,1)) < PLimit | PLimitUse!=1),R6M,NaN)),StyleDash,ColorGreen,Horizontal,Width1; R7 := Round(R5 + RD); DR7 := ShowR==1 & ShowNL>=7 & (ABS(C-Ref(R7,1)) < PLimit | PLimitUse!=1); LR7 := If(DR7,Ref(R7,1),C); Extend(If(IsLastDay & DR7,R7,NaN)),StyleSolid,ColorGreen,Horizontal,Width2; DrawText(IsLastBar & DR7 & ShowL,LR7,'R7'),Label4,VCenter,Left,ColorGreen; R7M := Round((R6 + R7)/2); Extend(If(IsLastDay & ShowR & ShowMid & (ShowNL>=7) & (ABS(C-Ref(R7M,1)) < PLimit | PLimitUse!=1),R7M,NaN)),StyleDash,ColorGreen,Horizontal,Width1; -- Support Levels; S1 := Round((2 * PP) - HD); DS1 := ShowS==1 & ShowNL>=1 & (ABS(C-Ref(S1,1)) < PLimit | PLimitUse!=1); LS1 := If(DS1,Ref(S1,1),C); Extend(If(IsLastDay & DS1,S1,NaN)),StyleSolid,ColorRed,Horizontal,Width2; DrawText(IsLastBar & DS1 & ShowL,LS1,'S1'),Label4,VCenter,Left,ColorRed; S1M := Round((PP + S1)/2); Extend(If(IsLastDay & ShowS & ShowMid & (ShowNL>=1) & (ABS(C-S1M) < PLimit | PLimitUse!=1),S1M,NaN)),StyleDash,ColorRed,Horizontal,Width1; S2 := Round(PP - RD); DS2 := ShowS==1 & ShowNL>=2 & (ABS(C-Ref(S2,1)) < PLimit | PLimitUse!=1); LS2 := If(DS2,Ref(S2,1),C); Extend(If(IsLastDay & DS2,S2,NaN)),StyleSolid,ColorRed,Horizontal,Width2; DrawText(IsLastBar & DS2 & ShowL,LS2,'S2'),Label4,VCenter,Left,ColorRed; S2M := Round((S1 + S2)/2); Extend(If(IsLastDay & ShowS & ShowMid & (ShowNL>=2) & (ABS(C-Ref(S2M,1)) < PLimit | PLimitUse!=1),S2M,NaN)),StyleDash,ColorRed,Horizontal,Width1; S3 := Round(S1 - RD); DS3 := ShowS==1 & ShowNL>=3 & (ABS(C-Ref(S3,1)) < PLimit | PLimitUse!=1); LS3 := If(DS3,Ref(S3,1),C); Extend(If(IsLastDay & DS3,S3,NaN)),StyleSolid,ColorRed,Horizontal,Width2; DrawText(IsLastBar & DS3 & ShowL,LS3,'S3'),Label4,VCenter,Left,ColorRed; S3M := Round((S2 + S3)/2); Extend(If(IsLastDay & ShowS & ShowMid & (ShowNL>=3) & (ABS(C-Ref(S3M,1)) < PLimit | PLimitUse!=1),S3M,NaN)),StyleDash,ColorRed,Horizontal,Width1; S4 := Round(S2 - RD); DS4 := ShowS==1 & ShowNL>=4 & (ABS(C-Ref(S4,1)) < PLimit | PLimitUse!=1); LS4 := If(DS4,Ref(S4,1),C); Extend(If(IsLastDay & DS4,S4,NaN)),StyleSolid,ColorRed,Horizontal,Width2; DrawText(IsLastBar & DS4 & ShowL,LS4,'S4'),Label4,VCenter,Left,ColorRed; S4M := Round((S3 + S4)/2); Extend(If(IsLastDay & ShowS & ShowMid & (ShowNL>=4) & (ABS(C-Ref(S4M,1)) < PLimit | PLimitUse!=1),S4M,NaN)),StyleDash,ColorRed,Horizontal,Width1; S5 := Round(S3 - RD); DS5 := ShowS==1 & ShowNL>=5 & (ABS(C-Ref(S5,1)) < PLimit | PLimitUse!=1); LS5 := If(DS5,Ref(S5,1),C); Extend(If(IsLastDay & DS5,S5,NaN)),StyleSolid,ColorRed,Horizontal,Width2; DrawText(IsLastBar & DS5 & ShowL,LS5,'S5'),Label4,VCenter,Left,ColorRed; S5M := Round((S4 + S5)/2); Extend(If(IsLastDay & ShowS & ShowMid & (ShowNL>=5) & (ABS(C-Ref(S5M,1)) < PLimit | PLimitUse!=1),S5M,NaN)),StyleDash,ColorRed,Horizontal,Width1; S6 := Round(S4 - RD); DS6 := ShowS==1 & ShowNL>=6 & (ABS(C-Ref(S6,1)) < PLimit | PLimitUse!=1); LS6 := If(DS6,Ref(S6,1),C); Extend(If(IsLastDay & DS6,S6,NaN)),StyleSolid,ColorRed,Horizontal,Width2; DrawText(IsLastBar & DS6 & ShowL,LS6,'S6'),Label4,VCenter,Left,ColorRed; S6M := Round((S5 + S6)/2); Extend(If(IsLastDay & ShowS & ShowMid & (ShowNL>=6) & (ABS(C-Ref(S6M,1)) < PLimit | PLimitUse!=1),S6M,NaN)),StyleDash,ColorRed,Horizontal,Width1; S7 := Round(S5 - RD); DS7 := ShowS==1 & ShowNL>=7 & (ABS(C-Ref(S7,1)) < PLimit | PLimitUse!=1); LS7 := If(DS7,Ref(S7,1),C); Extend(If(IsLastDay & DS7,S7,NaN)),StyleSolid,ColorRed,Horizontal,Width2; DrawText(IsLastBar & DS7 & ShowL,LS7,'S7'),Label4,VCenter,Left,ColorRed; S7M := Round((S6 + S7)/2); Extend(If(IsLastDay & ShowS & ShowMid & (ShowNL>=7) & (ABS(C-Ref(S7M,1)) < PLimit | PLimitUse!=1),S7M,NaN)),StyleDash,ColorRed,Horizontal,Width1;