Hi,
Is it possible to add single chart bubble for each of the Daily Dynamic pivot points?
I'm getting multiple bubbles instead of 1 chart bubble.
Thanks
Is it possible to add single chart bubble for each of the Daily Dynamic pivot points?
I'm getting multiple bubbles instead of 1 chart bubble.
Thanks
Code:
# SOURCE: Unknown
# TYPE: Study Trendlines
# CREDITS: Unknown
input timeFrame = {default DAY, WEEK, MONTH};
input showOnlyCurrent = yes;
input DynamicHide = yes;
def h = dynamichide;
input ShowPivots = YES;
input ShowBubbles = YES;
def NA = Double.NaN;
#
# Define lclose = last completed bar close:
#
rec lclose = if IsNaN(close) then lclose[1] else close;
plot R3;
plot R2;
plot R1;
plot PP;
plot S1;
plot S2;
plot S3;
if (showOnlyCurrent and !IsNaN(close(period = timeFrame)[-1]) or IsNaN(close))
then {
R1 = Double.NaN;
R2 = Double.NaN;
R3 = Double.NaN;
PP = Double.NaN;
S1 = Double.NaN;
S2 = Double.NaN;
S3 = Double.NaN;
} else {
PP = (high(period = timeFrame)[1] + low(period = timeFrame)[1] + close(period=timeframe)[1]) / 3;
R1 = 2 * PP - low(period = timeFrame)[1];
R2 = PP + high(period = timeFrame)[1] - low(period = timeFrame)[1];
R3 = R2 + high(period = timeFrame)[1] - low(period = timeFrame)[1];
S1 = 2 * PP - high(period = timeFrame)[1];
S2 = PP - high(period = timeFrame)[1] + low(period = timeFrame)[1];
S3 = S2 - high(period = timeFrame)[1] + low(period = timeFrame)[1];
}
#
# Formatting:
# Set color, line weight, style and hiding parameters
# for each pivot level
#
PP.SetDefaultColor(color.gray);
pp.SetLineWeight(2);
pp.SetStyle(curve.POINTS);
pp.setHiding(h and (lclose > r2 or lclose < s2));
pp.setpaintingStrategy(paintingStrategy.POINTS);
pp.setHiding();
#
r1.SetDefaultColor(color.red);
r1.SetLineWeight(2);
r1.SetStyle(curve.long_DASH);
r1.setHiding(h and lclose < s1);
r1.setpaintingStrategy(paintingStrategy.POINTS);
#
r2.SetDefaultColor(color.red);
r2.SetLineWeight(3);
r2.SetStyle(curve.long_DASH);
r2.setHiding(h and lclose < r1);
r2.setpaintingStrategy(paintingStrategy.POINTS);
#
r3.SetDefaultColor(color.red);
r3.SetLineWeight(4);
r3.SetStyle(curve.short_DASH);
r3.setHiding(h and lclose < r2);
r3.setpaintingStrategy(paintingStrategy.POINTS);
#
s1.SetDefaultColor(color.GREEN);
s1.SetLineWeight(2);
s1.SetStyle(curve.long_DASH);
s1.setHiding(h and lclose > r1);
s1.setpaintingStrategy(paintingStrategy.POINTS);
#
s2.SetDefaultColor(color.GREEN);
s2.SetLineWeight(3);
s2.SetStyle(curve.long_DASH);
s2.setHiding(h and lclose > s1);
s2.setpaintingStrategy(paintingStrategy.POINTS);
#
s3.SetDefaultColor(color.GREEN);
s3.SetLineWeight(4);
s3.SetStyle(curve.short_DASH);
s3.setHiding(h and lclose > s2);
s3.setpaintingStrategy(paintingStrategy.POINTS);
def std = ROund(s3,2);
addchartBubble(yes,STD, "Daily 3 STD PIVOT_"+STD, COLOR.YELLOW);
Last edited by a moderator: