# Camarilla Charting

#### 1morerep

##### New member
VIP
I can't seem to get the TOS-made Camarilla points to calculate correctly so I redid it. I removed the aggregation periods and now it only uses the previous day data. I have scripted the actual formula but need some help aligning the calculated points (on left axis) with the actual price (on right axis). Wonder if anyone can help me fix the code so it aligns correctly.

declare hide_on_daily;

input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = no;

def PH = high(period = aggregationPeriod)[1];
def PL = low(period = aggregationPeriod)[1];
def PC = close(period = aggregationPeriod)[1];

plot R5;
plot R4;
plot R3;
plot R2;
plot R1;
plot S1;
plot S2;
plot S3;
plot S4;
plot S5;

R1 = PC + (PH-PL)*1.1/12;
R2 = PC + (PH-PL)*1.1/6;
R3 = PC + (PH-PL)*1.1/4;
R4 = PC + (PH-PL)*1.1/2;
R5 = R4+1.168*(R4-R3);
S1 = PC - (PH-PL)*1.1/12;
S2 = PC - (PH-PL)*1.1/6;
S3 = PC - (PH-PL)*1.1/4;
S4 = PC - (PH-PL)*1.1/2;
S5 = S4+1.168*(s3-s4);

R5.SetDefaultColor(GetColor(5));
R4.SetDefaultColor(GetColor(5));
R3.SetDefaultColor(GetColor(5));
R2.SetDefaultColor(GetColor(5));
R1.SetDefaultColor(GetColor(5));
S1.SetDefaultColor(GetColor(6));
S2.SetDefaultColor(GetColor(6));
S3.SetDefaultColor(GetColor(6));
S4.SetDefaultColor(GetColor(6));
S5.SetDefaultColor(GetColor(6));

R5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
s5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

R5.SetStyle(Curve.SHORT_DASH);
R4.SetStyle(Curve.SHORT_DASH);
R3.SetStyle(Curve.SHORT_DASH);
R2.SetStyle(Curve.SHORT_DASH);
R1.SetStyle(Curve.SHORT_DASH);
S1.SetStyle(Curve.SHORT_DASH);
S2.SetStyle(Curve.SHORT_DASH);
S3.SetStyle(Curve.SHORT_DASH);
S4.SetStyle(Curve.SHORT_DASH);
S5.SetStyle(Curve.SHORT_DASH);

#### SleepyZ

##### Active member
I can't seem to get the TOS-made Camarilla points to calculate correctly so I redid it. I removed the aggregation periods and now it only uses the previous day data. I have scripted the actual formula but need some help aligning the calculated points (on left axis) with the actual price (on right axis). Wonder if anyone can help me fix the code so it aligns correctly.
You appear to have the 'left axis' enabled. Please uncheck/disable it at the 'inputs and options' settings at the 'gear' for the indicator. It is not meant to be used for this type of upper panel indicator. It is used primarily for lower panel indicators to be displayed 'proportionally' on the upper panel.

#### 1morerep

##### New member
VIP
Thanks. yes that was simple. seemed to work!