Hi Team,
Is there anyway possible to extend and project all previous days plots towards the right side of the chart when is not in showonexpansion mode?
input showonlyLastPeriod = no;
input showexpansiononly = yes;
input show_bubble = yes;
input show_price = no;
input showbubbles_rightedge = yes;
def aggregationPeriod = if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN then AggregationPeriod.DAY
else if GetAggregationPeriod() >= AggregationPeriod.FIFTEEN_MIN and GetAggregationPeriod() < AggregationPeriod.DAY then AggregationPeriod.WEEK
else if GetAggregationPeriod() == AggregationPeriod.DAY then AggregationPeriod.MONTH
else if GetAggregationPeriod() == AggregationPeriod.WEEK and GetAggregationPeriod() == AggregationPeriod.MONTH then AggregationPeriod.YEAR
else AggregationPeriod.MONTH;
def dayCount = CompoundValue(1, if GetYYYYMMDD() != GetYYYYMMDD()[1] then dayCount[1] + 1 else dayCount[1], 0);
def thisDay = (HighestAll(dayCount) - dayCount) ;
def HIGHprev = high(period = aggregationPeriod)[1];
def LOWprev = low(period = aggregationPeriod)[1];
def CLOSEprev = close(period = aggregationPeriod)[1];
plot PP = if showexpansiononly and !IsNaN(close) or showonlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1])
then Double.NaN
else (HIGHprev + LOWprev + CLOSEprev) / 3;
#plot R1 = PP * 2 - LOWprev;
#plot S1 = PP * 2 - HIGHprev;
#plot R2 = PP + (HIGHprev - LOWprev);
#plot S2 = PP - (HIGHprev - LOWprev);
#plot R3 = PP * 2 + (HIGHprev - 2 * LOWprev);
#plot S3 = PP * 2 - (2 * HIGHprev - LOWprev);
#plot R4 = PP * 3 + (HIGHprev - 3 * LOWprev);
#plot S4 = PP * 3 - (3 * HIGHprev - LOWprev);
#plot R5 = PP * 4 + (HIGHprev - 4 * LOWprev);
#plot S5 = PP * 4 - (4 * HIGHprev - LOWprev);
PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#R4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#S4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#R5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#S5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#AddChartBubble(show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else R5 != R5[1], R5, "R5: " + if !show_price then "" else AsText(Round(R5 / TickSize(), 0) * TickSize()), Color.GRAY);
#AddChartBubble( show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else R4 != R4[1], R4, "R4: " + if !show_price then "" else AsText(Round(R4 / TickSize(), 0) * TickSize()), Color.GRAY);
#AddChartBubble( show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else R3 != R3[1], R3, "R3: " + if !show_price then "" else AsText(Round(R3 / TickSize(), 0) * TickSize()), Color.GRAY);
#AddChartBubble( show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else R2 != R2[1], R2, "R2: " + if !show_price then "" else AsText(Round(R2 / TickSize(), 0) * TickSize()), Color.GRAY);
#AddChartBubble(show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else R1 != R1[1], R1, "R1: " + if !show_price then "" else AsText(Round(R1 / TickSize(), 0) * TickSize()), Color.GRAY);
AddChartBubble( show_bubble and
if showonlyLastPeriod or showexpansiononly
then BarNumber() == HighestAll(BarNumber())
else if showbubbles_rightedge
then thisday!=thisday[-1]
else PP != PP[1]
,
PP,
"PP_"+thisday+": " + if !show_price then ""
else AsText(Round(PP / TickSize(), 0) * TickSize()), Color.ORANGE);
#AddChartBubble( show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else S5 != S5[1], S5, "S5: " + if !show_price then "" else AsText(Round(S5 / TickSize(), 0) * TickSize()), Color.GRAY, no);
#AddChartBubble( show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else S4 != S4[1], S4, "S4: " + if !show_price then "" else AsText(Round(S4 / TickSize(), 0) * TickSize()), Color.GRAY, no);
#AddChartBubble( show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else S3 != S3[1], S3, "S3: " + if !show_price then "" else AsText(Round(S3 / TickSize(), 0) * TickSize()), Color.GRAY, no);
#AddChartBubble( show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else S2 != S2[1], S2, "S2: " + if !show_price then "" else AsText(Round(S2 / TickSize(), 0) * TickSize()), Color.GRAY, no);
#AddChartBubble(show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else S1 != S1[1],S1, "S1: " + if !show_price then "" else AsText(Round(S1 / TickSize(), 0) * TickSize()), Color.GRAY, no);
#
Is there anyway possible to extend and project all previous days plots towards the right side of the chart when is not in showonexpansion mode?
input showonlyLastPeriod = no;
input showexpansiononly = yes;
input show_bubble = yes;
input show_price = no;
input showbubbles_rightedge = yes;
def aggregationPeriod = if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN then AggregationPeriod.DAY
else if GetAggregationPeriod() >= AggregationPeriod.FIFTEEN_MIN and GetAggregationPeriod() < AggregationPeriod.DAY then AggregationPeriod.WEEK
else if GetAggregationPeriod() == AggregationPeriod.DAY then AggregationPeriod.MONTH
else if GetAggregationPeriod() == AggregationPeriod.WEEK and GetAggregationPeriod() == AggregationPeriod.MONTH then AggregationPeriod.YEAR
else AggregationPeriod.MONTH;
def dayCount = CompoundValue(1, if GetYYYYMMDD() != GetYYYYMMDD()[1] then dayCount[1] + 1 else dayCount[1], 0);
def thisDay = (HighestAll(dayCount) - dayCount) ;
def HIGHprev = high(period = aggregationPeriod)[1];
def LOWprev = low(period = aggregationPeriod)[1];
def CLOSEprev = close(period = aggregationPeriod)[1];
plot PP = if showexpansiononly and !IsNaN(close) or showonlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1])
then Double.NaN
else (HIGHprev + LOWprev + CLOSEprev) / 3;
#plot R1 = PP * 2 - LOWprev;
#plot S1 = PP * 2 - HIGHprev;
#plot R2 = PP + (HIGHprev - LOWprev);
#plot S2 = PP - (HIGHprev - LOWprev);
#plot R3 = PP * 2 + (HIGHprev - 2 * LOWprev);
#plot S3 = PP * 2 - (2 * HIGHprev - LOWprev);
#plot R4 = PP * 3 + (HIGHprev - 3 * LOWprev);
#plot S4 = PP * 3 - (3 * HIGHprev - LOWprev);
#plot R5 = PP * 4 + (HIGHprev - 4 * LOWprev);
#plot S5 = PP * 4 - (4 * HIGHprev - LOWprev);
PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#R4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#S4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#R5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#S5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#AddChartBubble(show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else R5 != R5[1], R5, "R5: " + if !show_price then "" else AsText(Round(R5 / TickSize(), 0) * TickSize()), Color.GRAY);
#AddChartBubble( show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else R4 != R4[1], R4, "R4: " + if !show_price then "" else AsText(Round(R4 / TickSize(), 0) * TickSize()), Color.GRAY);
#AddChartBubble( show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else R3 != R3[1], R3, "R3: " + if !show_price then "" else AsText(Round(R3 / TickSize(), 0) * TickSize()), Color.GRAY);
#AddChartBubble( show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else R2 != R2[1], R2, "R2: " + if !show_price then "" else AsText(Round(R2 / TickSize(), 0) * TickSize()), Color.GRAY);
#AddChartBubble(show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else R1 != R1[1], R1, "R1: " + if !show_price then "" else AsText(Round(R1 / TickSize(), 0) * TickSize()), Color.GRAY);
AddChartBubble( show_bubble and
if showonlyLastPeriod or showexpansiononly
then BarNumber() == HighestAll(BarNumber())
else if showbubbles_rightedge
then thisday!=thisday[-1]
else PP != PP[1]
,
PP,
"PP_"+thisday+": " + if !show_price then ""
else AsText(Round(PP / TickSize(), 0) * TickSize()), Color.ORANGE);
#AddChartBubble( show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else S5 != S5[1], S5, "S5: " + if !show_price then "" else AsText(Round(S5 / TickSize(), 0) * TickSize()), Color.GRAY, no);
#AddChartBubble( show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else S4 != S4[1], S4, "S4: " + if !show_price then "" else AsText(Round(S4 / TickSize(), 0) * TickSize()), Color.GRAY, no);
#AddChartBubble( show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else S3 != S3[1], S3, "S3: " + if !show_price then "" else AsText(Round(S3 / TickSize(), 0) * TickSize()), Color.GRAY, no);
#AddChartBubble( show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else S2 != S2[1], S2, "S2: " + if !show_price then "" else AsText(Round(S2 / TickSize(), 0) * TickSize()), Color.GRAY, no);
#AddChartBubble(show_bubble and if showonlyLastPeriod or showexpansiononly then BarNumber() == HighestAll(BarNumber()) else if showbubbles_rightedge then thisday!=thisday[-1] else S1 != S1[1],S1, "S1: " + if !show_price then "" else AsText(Round(S1 / TickSize(), 0) * TickSize()), Color.GRAY, no);
#