Error on this all inclusive Pivot Point indicator

kyuts

New member
Hello,

I recently took a Pivot Point class from Jeff York and was very excited to cobble together the following code - inspirations are from this website (unattributed when I found it) and elsewhere, and I inserted the variety of Pivot formulas that I learnt in Jeff York's class. I am unable to figure out how to attach a screenshot of the Pivot formulas for reference to this thread, but I am quite sure that the code is simple enough to understand each formula.

The number of Rs and Ss that are to be plotted are different for the different types of Pivots. I am unable to run this code without keeping the number of Rs and Ss exactly the same. Can someone please help? I have annotated the code at the lines where I am facing issues. Please ask me questions that would help in assisting me with this problem. I appreciate your time, and thanks in advance.

Update: I will also request help with stretching the Pivots to a few periods in the past (akin to what can be accomplished on Trading View).
Update2: Code updated to reflect Quarter aggregation

Code:
input timeFrame = {DAY, default WEEK, MONTH, QUARTER, YEAR};
input pivotType = {Camarilla, Demarks, Fibonacci, default Traditional, Woodies};
input showOnlyToday = no;

#COMMON
def H = high(period = timeFrame);
def L = low(period = timeFrame);
def C = close(period = timeFrame);

#DEMARKS
def O = open(period = timeFrame);
def X = if C < O then (H + (2 * L) + C) else if C > O then ((2 * H) + L + C) else (H + L + (2 * C));

#WOODIES
def T = open(period = "DAY");

plot R3;
plot R2;
plot R1;
plot PP;
plot S1;
plot S2;
plot S3;

if (showOnlyToday and !IsNaN(close(period = timeFrame)[-1])) or
(GetAggregationPeriod() > if timeFrame == timeFrame.DAY
then AggregationPeriod.DAY
else if timeFrame == timeFrame.WEEK
then AggregationPeriod.WEEK
else if timeFrame == timeFrame.MONTH
then AggregationPeriod.MONTH
else if timeFrame == timeFrame.QUARTER
then AggregationPeriod.QUARTER
else AggregationPeriod.YEAR)

then {

R1 = Double.NaN;

R2 = Double.NaN;

R3 = Double.NaN;

PP = Double.NaN;

S1 = Double.NaN;

S2 = Double.NaN;

S3 = Double.NaN;

}
else {

switch (pivotType) {

case Camarilla:

PP = (H + L + C) / 3;
R1 = (0.0916 * (H - L)) + C;
R2 = (0.1830 * (H - L)) + C;
R3 = (0.2750 * (H - L)) + C;
#R4 = (0.5500 * (H - L)) + C;
S1 = C - (0.0916 * (H - L));
S2 = C - (0.1830 * (H - L));
S3 = C - (0.2750 * (H - L));
#S4 = C - (0.5500 * (H - L));

case Fibonacci:

PP = (H + L + C) / 3;
R1 = PP + (0.382 * (H - L));
R2 = PP + (0.618 * (H - L));
R3 = PP + (1.000 * (H - L));
S1 = PP - (0.382 * (H - L));
S2 = PP - (0.618 * (H - L));
S3 = PP - (1.000 * (H - L));

case Demarks:

PP = X / 4;
R1 = (X / 2) - L;
R2 = R1 + (R1 - PP); #filler formula to avoid error
R3 = R2 + (R2 - PP); #filler formula to avoid error
S1 = (X / 2) - H;
S2 = S1 - (PP - S1); #filler formula to avoid error
S3 = S2 - (PP - S2); #filler formula to avoid error

PP = (H + L + C) / 3;
R1 =  (2 * PP) - L;
R2 = PP + H - L;
R3 = H + 2 * (PP - L);
S1 = (2 * PP) - H;
S2 = PP - H + L;
S3 = L - 2 * (H - PP);

case Woodies:

PP = (H + L + (T * 2)) / 4;
R1 = (2 * PP) - L;
R2 = PP + (H - L);
R3 = H + (2 * (PP - L));
#R4 = R3 + (H - L); #remarked to avoid error
S1 = (2 * PP) - H;
S2 = PP - (H - L);
S3 = L - (2 * (PP - L));
#S4 = S3 - (H - L); #remarked to avoid error

} #/switch

} #/ifte

R1.SetDefaultColor(Color.RED);
R2.SetDefaultColor(Color.RED);
R3.SetDefaultColor(Color.RED);
S1.SetDefaultColor(Color.GREEN);
S2.SetDefaultColor(Color.GREEN);
S3.SetDefaultColor(Color.GREEN);

R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
;

PP.DefineColor("Color", CreateColor(0, 102, 204));
PP.AssignValueColor(PP.Color("Color"));
PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

Last edited:
Solution
Hello SleepyZ,

I very much appreciate your help. I will test this code out and provide feedback.

I am unable to figure out how to post a screenshot here. So, I will explain it as best as I can.

On TV, add a Pivot, go into the Settings > Inputs. There is an option called Number of Pivots Back. When you set the number to 1, it will only show relevant Pivot for the current bar. When you set it to 2, it will show Pivot for the previous bar also. And so on...

This helps in the way that, on a 1 Y 1 D chart, I can set the Monthly Pivot to go back 2 periods and it will only show this month's and prior month's Pivots, which gives a good indication on how price is meandering...

Is there such a functionality on ToS? Many thanks.
...

SleepyZ

Well-known member
VIP
Hello,

I recently took a Pivot Point class from Jeff York and was very excited to cobble together the following code - inspirations are from this website (unattributed when I found it) and elsewhere, and I inserted the variety of Pivot formulas that I learnt in Jeff York's class. I am unable to figure out how to attach a screenshot of the Pivot formulas for reference to this thread, but I am quite sure that the code is simple enough to understand each formula.

The number of Rs and Ss that are to be plotted are different for the different types of Pivots. I am unable to run this code without keeping the number of Rs and Ss exactly the same. Can someone please help? I have annotated the code at the lines where I am facing issues. Please ask me questions that would help in assisting me with this problem. I appreciate your time, and thanks in advance.

Update: I will also request help with stretching the Pivots to a few periods in the past (akin to what can be accomplished on Trading View).
Update2: Code updated to reflect Quarter aggregation
Here is your code with revisions to eliminate your annotated issues. When using a switch, each case must contain all of the plots (defs if that were the case). Just equate the pivots that have no pivot formula with double.nan.

I am not familiar with the tradingview function you are referring. Perhaps provide a link or some more in depth description.

Ruby:
input timeFrame = {DAY, default WEEK, MONTH, QUARTER, YEAR};
input pivotType = {Camarilla, Demarks, Fibonacci, default Traditional, Woodies};
input showOnlyToday = no;

#COMMON
def H = high(period = timeFrame);
def L = low(period = timeFrame);
def C = close(period = timeFrame);

#DEMARKS
def O = open(period = timeFrame);
def X = if C < O then (H + (2 * L) + C) else if C > O then ((2 * H) + L + C) else (H + L + (2 * C));

#WOODIES
def T = open(period = "DAY");

plot R4;
plot R3;
plot R2;
plot R1;
plot PP;
plot S1;
plot S2;
plot S3;
plot S4;

if (showOnlyToday and !IsNaN(close(period = timeFrame)[-1])) or
(GetAggregationPeriod() > if timeFrame == timeFrame.DAY
then AggregationPeriod.DAY
else if timeFrame == timeFrame.WEEK
then AggregationPeriod.WEEK
else if timeFrame == timeFrame.MONTH
then AggregationPeriod.MONTH
else if timeFrame == timeFrame.QUARTER
then AggregationPeriod.QUARTER
else AggregationPeriod.YEAR)

then {

R1 = Double.NaN;

R2 = Double.NaN;

R3 = Double.NaN;

R4 = double.nan;

PP = Double.NaN;

S1 = Double.NaN;

S2 = Double.NaN;

S3 = Double.NaN;

S4 = Double.nan;

}
else {

switch (pivotType) {

case Camarilla:

PP = (H + L + C) / 3;
R1 = (0.0916 * (H - L)) + C;
R2 = (0.1830 * (H - L)) + C;
R3 = (0.2750 * (H - L)) + C;
R4 = (0.5500 * (H - L)) + C;
S1 = C - (0.0916 * (H - L));
S2 = C - (0.1830 * (H - L));
S3 = C - (0.2750 * (H - L));
S4 = C - (0.5500 * (H - L));

case Fibonacci:

PP = (H + L + C) / 3;
R1 = PP + (0.382 * (H - L));
R2 = PP + (0.618 * (H - L));
R3 = PP + (1.000 * (H - L));
R4 = double.nan;
S1 = PP - (0.382 * (H - L));
S2 = PP - (0.618 * (H - L));
S3 = PP - (1.000 * (H - L));
S4 = double.nan;

case Demarks:

PP = X / 4;
R1 = (X / 2) - L;
R2 = double.nan;
R3 = double.nan;
R4 = double.nan;
S1 = (X / 2) - H;
S2 = double.nan;
S3 = double.nan;
S4 = double.nan;

PP = (H + L + C) / 3;
R1 =  (2 * PP) - L;
R2 = PP + H - L;
R3 = H + 2 * (PP - L);
R4 = double.nan;
S1 = (2 * PP) - H;
S2 = PP - H + L;
S3 = L - 2 * (H - PP);
S4 = double.nan;

case Woodies:

PP = (H + L + (T * 2)) / 4;
R1 = (2 * PP) - L;
R2 = PP + (H - L);
R3 = H + (2 * (PP - L));
R4 = R3 + (H - L);
S1 = (2 * PP) - H;
S2 = PP - (H - L);
S3 = L - (2 * (PP - L));
S4 = S3 - (H - L);

} #/switch

} #/ifte

R1.SetDefaultColor(Color.RED);
R2.SetDefaultColor(Color.RED);
R3.SetDefaultColor(Color.RED);
R4.setdefaultColor(color.red);
S1.SetDefaultColor(Color.GREEN);
S2.SetDefaultColor(Color.GREEN);
S3.SetDefaultColor(Color.GREEN);
S4.setdefaultColor(color.green);

R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R4.SetPaintingStrategy(paintingStrategy.HORIZONTAL);
S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S4.setpaintingStrategy(paintingStrategy.HORIZONTAL);

PP.DefineColor("Color", CreateColor(0, 102, 204));
PP.AssignValueColor(PP.Color("Color"));
PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

• kyuts

kyuts

New member
Hello SleepyZ,

I very much appreciate your help. I will test this code out and provide feedback.

I am unable to figure out how to post a screenshot here. So, I will explain it as best as I can.

On TV, add a Pivot, go into the Settings > Inputs. There is an option called Number of Pivots Back. When you set the number to 1, it will only show relevant Pivot for the current bar. When you set it to 2, it will show Pivot for the previous bar also. And so on...

This helps in the way that, on a 1 Y 1 D chart, I can set the Monthly Pivot to go back 2 periods and it will only show this month's and prior month's Pivots, which gives a good indication on how price is meandering...

Is there such a functionality on ToS? Many thanks.

kyuts

New member
It just occurred to me that in order to have the Pivots span back a qualified number of prior bars, I would have to setup the code to look back and calculate on the basis of 1 period prior. That is just too much of complication; I think, unless there is a simpler way, such as checking a flag, I will let that go.

kyuts

New member
I tested the code, sleepyz, runs well, no issues. Thank you.

SleepyZ

Well-known member
VIP
Hello SleepyZ,

I very much appreciate your help. I will test this code out and provide feedback.

I am unable to figure out how to post a screenshot here. So, I will explain it as best as I can.

On TV, add a Pivot, go into the Settings > Inputs. There is an option called Number of Pivots Back. When you set the number to 1, it will only show relevant Pivot for the current bar. When you set it to 2, it will show Pivot for the previous bar also. And so on...

This helps in the way that, on a 1 Y 1 D chart, I can set the Monthly Pivot to go back 2 periods and it will only show this month's and prior month's Pivots, which gives a good indication on how price is meandering...

Is there such a functionality on ToS? Many thanks.

Thank you.. I looked at TV and saw how that Pivots Back was limiting how many pivots where being plotted.

There is no built-in function in TOS to do that, but it can be coded. In the following code, to accomplish that, all your original plot statement were changed to def (eg: def R4; etc, ....) statements. All the plots where renamed by adding a P to the def statements (eg: plot R4P, etc ....).

In the picture below, Pivots Back was set to 3 Traditional Pivots set to DAY on a 5m chart. Ruby:
input timeFrame = {DAY, default WEEK, MONTH, QUARTER, YEAR};
input pivotType = {Camarilla, Demarks, Fibonacci, default Traditional, Woodies};
input showOnlyToday = no;

#COMMON
def H = high(period = timeFrame);
def L = low(period = timeFrame);
def C = close(period = timeFrame);

#DEMARKS
def O = open(period = timeFrame);
def X = if C < O then (H + (2 * L) + C) else if C > O then ((2 * H) + L + C) else (H + L + (2 * C));

#WOODIES
def T = open(period = "DAY");

def R4;
def R3;
def R2;
def R1;
def PP;
def S1;
def S2;
def S3;
def S4;

if (showOnlyToday and !IsNaN(close(period = timeFrame)[-1])) or
(GetAggregationPeriod() > if timeFrame == timeFrame.DAY
then AggregationPeriod.DAY
else if timeFrame == timeFrame.WEEK
then AggregationPeriod.WEEK
else if timeFrame == timeFrame.MONTH
then AggregationPeriod.MONTH
else if timeFrame == timeFrame.QUARTER
then AggregationPeriod.QUARTER
else AggregationPeriod.YEAR)

then {

R1 = Double.NaN;

R2 = Double.NaN;

R3 = Double.NaN;

R4 = Double.NaN;

PP = Double.NaN;

S1 = Double.NaN;

S2 = Double.NaN;

S3 = Double.NaN;

S4 = Double.NaN;

}
else {

switch (pivotType) {
case Camarilla:

PP = (H + L + C) / 3;
R1 = (0.0916 * (H - L)) + C;
R2 = (0.1830 * (H - L)) + C;
R3 = (0.2750 * (H - L)) + C;
R4 = (0.5500 * (H - L)) + C;
S1 = C - (0.0916 * (H - L));
S2 = C - (0.1830 * (H - L));
S3 = C - (0.2750 * (H - L));
S4 = C - (0.5500 * (H - L));
case Fibonacci:

PP = (H + L + C) / 3;
R1 = PP + (0.382 * (H - L));
R2 = PP + (0.618 * (H - L));
R3 = PP + (1.000 * (H - L));
R4 = Double.NaN;
S1 = PP - (0.382 * (H - L));
S2 = PP - (0.618 * (H - L));
S3 = PP - (1.000 * (H - L));
S4 = Double.NaN;
case Demarks:

PP = X / 4;
R1 = (X / 2) - L;
R2 = Double.NaN;
R3 = Double.NaN;
R4 = Double.NaN;
S1 = (X / 2) - H;
S2 = Double.NaN;
S3 = Double.NaN;
S4 = Double.NaN;

PP = (H + L + C) / 3;
R1 =  (2 * PP) - L;
R2 = PP + H - L;
R3 = H + 2 * (PP - L);
R4 = Double.NaN;
S1 = (2 * PP) - H;
S2 = PP - H + L;
S3 = L - 2 * (H - PP);
S4 = Double.NaN;
case Woodies:

PP = (H + L + (T * 2)) / 4;
R1 = (2 * PP) - L;
R2 = PP + (H - L);
R3 = H + (2 * (PP - L));
R4 = R3 + (H - L);
S1 = (2 * PP) - H;
S2 = PP - (H - L);
S3 = L - (2 * (PP - L));
S4 = S3 - (H - L);

} #/switch

} #/ifte

def capture     = !IsNaN(close) and PP != PP;
def dayCount    = CompoundValue(1, if capture then dayCount + 1 else dayCount, 0);
def pivot       = (HighestAll(dayCount) - dayCount) + 1 ;

input pivotsback = 3;
plot ppp = if pivot > pivotsback then Double.NaN else PP;
plot R4P = if pivot > pivotsback then Double.NaN else R4;
plot R3P = if pivot > pivotsback then Double.NaN else R3;
plot R2P = if pivot > pivotsback then Double.NaN else R2;
plot R1P = if pivot > pivotsback then Double.NaN else R1;

plot S1P = if pivot > pivotsback then Double.NaN else S1;
plot S2P = if pivot > pivotsback then Double.NaN else S2;
plot S3P = if pivot > pivotsback then Double.NaN else S3;
plot S4P = if pivot > pivotsback then Double.NaN else S4;

R1P.SetDefaultColor(Color.RED);
R2P.SetDefaultColor(Color.RED);
R3P.SetDefaultColor(Color.RED);
R4P.SetDefaultColor(Color.RED);
S1P.SetDefaultColor(Color.GREEN);
S2P.SetDefaultColor(Color.GREEN);
S3P.SetDefaultColor(Color.GREEN);
S4P.SetDefaultColor(Color.GREEN);

R1P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R4P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S4P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

ppp.DefineColor("Color", CreateColor(0, 102, 204));
ppp.AssignValueColor(ppp.Color("Color"));
ppp.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

Last edited:
• kyuts

kyuts

New member
SleepyZ, this is awesome! May I ask what the DaysBack or Today does? I did not see either being called anywhere. Thank you very much.

• SleepyZ

SleepyZ

Well-known member
VIP
SleepyZ, this is awesome! May I ask what the DaysBack or Today does? I did not see either being called anywhere. Thank you very much.
Thanks.

They were a part of counting snippet I used and did not delete them when I cut the remainder of the code to the bottom portion of the script. I have corrected the above code.

kyuts

New member
Thanks.

They were a part of counting snippet I used and did not delete them when I cut the remainder of the code to the bottom portion of the script. I have corrected the above code.
Hello SleepyZ,

I included a 3 period moving average of the central PP in this because I read somewhere that it helps. So far it is meh...

Thanks for everything.

Best Regards.

Code:

input timeFrame = {DAY, default WEEK, MONTH, QUARTER, YEAR};
input pivotType = {Camarilla, Demarks, Fibonacci, default Traditional, Woodies};
input showOnlyToday = no;

#COMMON
def H = high(period = timeFrame);
def L = low(period = timeFrame);
def C = close(period = timeFrame);

def H2 = high(period = timeFrame);
def L2 = low(period = timeFrame);
def C2 = close(period = timeFrame);

def H3 = high(period = timeFrame);
def L3 = low(period = timeFrame);
def C3 = close(period = timeFrame);

#DEMARKS
def O = open(period = timeFrame);
def X = if C < O then (H + (2 * L) + C) else if C > O then ((2 * H) + L + C) else (H + L + (2 * C));

#WOODIES
def T = open(period = "DAY");

def R4;
def R3;
def R2;
def R1;
def PP;
def S1;
def S2;
def S3;
def S4;
def AP;

if (showOnlyToday and !IsNaN(close(period = timeFrame)[-1])) or
(GetAggregationPeriod() > if timeFrame == timeFrame.DAY
then AggregationPeriod.DAY
else if timeFrame == timeFrame.WEEK
then AggregationPeriod.WEEK
else if timeFrame == timeFrame.MONTH
then AggregationPeriod.MONTH
else if timeFrame == timeFrame.QUARTER
then AggregationPeriod.QUARTER
else AggregationPeriod.YEAR)

then {

R1 = Double.NaN;
R2 = Double.NaN;
R3 = Double.NaN;
R4 = Double.NaN;
PP = Double.NaN;
S1 = Double.NaN;
S2 = Double.NaN;
S3 = Double.NaN;
S4 = Double.NaN;
AP = Double.Nan;

}
else {

switch (pivotType) {

case Camarilla:

PP = (H + L + C) / 3;
R1 = (0.0916 * (H - L)) + C;
R2 = (0.1830 * (H - L)) + C;
R3 = (0.2750 * (H - L)) + C;
R4 = (0.5500 * (H - L)) + C;
S1 = C - (0.0916 * (H - L));
S2 = C - (0.1830 * (H - L));
S3 = C - (0.2750 * (H - L));
S4 = C - (0.5500 * (H - L));
AP = (((H + L + C) / 3) + ((H2 + L2 + C2) / 3) + ((H3 + L3 + C3) / 3)) / 3;

case Demarks:

PP = X / 4;
R1 = (X / 2) - L;
R2 = Double.NaN;
R3 = Double.NaN;
R4 = Double.NaN;
S1 = (X / 2) - H;
S2 = Double.NaN;
S3 = Double.NaN;
S4 = Double.NaN;
AP = (PP + PP + PP) / 3;

case Fibonacci:

PP = (H + L + C) / 3;
R1 = PP + (0.382 * (H - L));
R2 = PP + (0.618 * (H - L));
R3 = PP + (1.000 * (H - L));
R4 = Double.NaN;
S1 = PP - (0.382 * (H - L));
S2 = PP - (0.618 * (H - L));
S3 = PP - (1.000 * (H - L));
S4 = Double.NaN;
AP = (((H + L + C) / 3) + ((H2 + L2 + C2) / 3) + ((H3 + L3 + C3) / 3)) / 3;

PP = (H + L + C) / 3;
R1 =  (2 * PP) - L;
R2 = PP + H - L;
R3 = H + 2 * (PP - L);
R4 = Double.NaN;
S1 = (2 * PP) - H;
S2 = PP - H + L;
S3 = L - 2 * (H - PP);
S4 = Double.NaN;
AP = (((H + L + C) / 3) + ((H2 + L2 + C2) / 3) + ((H3 + L3 + C3) / 3)) / 3;

case Woodies:

PP = (H + L + (T * 2)) / 4;
R1 = (2 * PP) - L;
R2 = PP + (H - L);
R3 = H + (2 * (PP - L));
R4 = R3 + (H - L);
S1 = (2 * PP) - H;
S2 = PP - (H - L);
S3 = L - (2 * (PP - L));
S4 = S3 - (H - L);
AP = (PP + PP + PP) / 3;

} #/switch

} #/ifte

#number of prior period(s) to display Pivots for, including current period
input pivotsBack = 3;

def capture     = !IsNaN(close) and PP != PP;
def dayCount    = CompoundValue(1, if capture then dayCount + 1 else dayCount, 0);
def pivot       = (HighestAll(dayCount) - dayCount) + 1 ;

plot PPP = if pivot > pivotsBack then Double.NaN else PP;
plot R4P = if pivot > pivotsBack then Double.NaN else R4;
plot R3P = if pivot > pivotsBack then Double.NaN else R3;
plot R2P = if pivot > pivotsBack then Double.NaN else R2;
plot R1P = if pivot > pivotsBack then Double.NaN else R1;
plot S1P = if pivot > pivotsBack then Double.NaN else S1;
plot S2P = if pivot > pivotsBack then Double.NaN else S2;
plot S3P = if pivot > pivotsBack then Double.NaN else S3;
plot S4P = if pivot > pivotsBack then Double.NaN else S4;
plot SAP = if pivot > pivotsBack then Double.NaN else AP;

R1P.SetDefaultColor(Color.RED);
R2P.SetDefaultColor(Color.RED);
R3P.SetDefaultColor(Color.RED);
R4P.SetDefaultColor(Color.RED);
S1P.SetDefaultColor(Color.GREEN);
S2P.SetDefaultColor(Color.GREEN);
S3P.SetDefaultColor(Color.GREEN);
S4P.SetDefaultColor(Color.GREEN);

R1P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R4P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S4P.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

PPP.DefineColor("Color", CreateColor(230, 190, 0));
PPP.AssignValueColor(PPP.Color("Color"));
PPP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

SAP.DefineColor("Color", CreateColor(143, 239, 191));
SAP.AssignValueColor(SAP.Color("Color"));
SAP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);