-- Capital Synergy Automated Weekly Camarilla Pivot Points V2.1; @SETVALUETEXTMODE('None'); @SETNAME('CSCP6W', True); @SHOWYGRIDLINE(True); -- OHLC; CD := "C#WEEK1"; HD := "H#WEEK1"; LD := "L#WEEK1"; OD := "O#WEEK1"; RD := HD-LD; 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,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; -- Range; Range := (HD - LD); -- Pivot Point; PP := Round((CD+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; -- Resistance Levels; R1 := Round(CD + Range * 1.1/12); 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; R2 := Round(CD + Range * 1.1/6); 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(CD + Range * 1.1/4); 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(CD + Range * 1.1/2); 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; -- Support Levels; S1 := Round(CD - Range * 1.1/12); 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; S2 := Round(CD - Range * 1.1/6); 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(CD - Range * 1.1/4); 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(CD - Range * 1.1/2); 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; -- Camarilla Mid Point; MP := Round((R1+S1)/2); DMP := ShowL==1 & (ABS(C-Ref(MP,1)) < PLimit | PLimitUse!=1); Extend(If(IsLastDay & DMP,MP,NaN)),Styledots,ColorGray,Horizontal,Width2; DrawText(IsLastBar & DMP,Ref(MP,1),'Mid'),Label4,VCenter,Left,ColorGray;