But isn't the pivot point indicator basic as far as its how it is calculated?@gabrobro It is not that they are 'wrong'. It is that they are calculated differently. If you are asking how the ToS PivotPoints is calculated, ToS does not share the code for that particular indicator so we can't know that.
There are dozens of pivot point studies on this forum though. If this one is not fitting your strategy, perhaps plugging and playing some others would help.
But isn't the pivot point indicator basic as far as its how it is calculated?
The calculation for the pivot point is: pivot point = (High+Low+close)/3
Try this link that I did recently https://usethinkscript.com/threads/...nts-indicator-for-thinkorswim.4860/post-77472Hey @SleepyZ
Can you also modify the code for Pivot Points to painting strategy , show bubbles and within the bubbles whether to show the price like you did for the other Pivot? I tried modiying the code as per your logic, but it didnt return anything.
#
# TD Ameritrade IP Company, Inc. (c) 2011-2021
#
# Source code isn't available.
input showOnlyToday = No;
input timeFrame = {default "DAY", "WEEK", "MONTH"};
plot R3 = Double.NaN;
plot R2 = Double.NaN;
plot R1 = Double.NaN;
plot PP = Double.NaN;
plot S1 = Double.NaN;
plot S2 = Double.NaN;
plot S3 = Double.NaN;
This puts bubbles with pivot names and price levels for each pivot point.
Code:# Traditional Pivot Points # Assembled by BenTen at UseThinkScript.com # Based on the formula from https://www.tradingview.com/support/solutions/43000521824-pivot-points-standard/ # Sleepyz - Modifications to show bubbles with label and/or price level input showonlyLastPeriod = yes; input show_bubble = yes; input show_price = yes; input aggregationPeriod = AggregationPeriod.DAY; 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 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); 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); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R3 != R3[1], R3, "R3: "+if !show_price then "" else AsText(Round(R3 / TickSize(), 0) * TickSize()), Color.green); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R2 != R2[1], R2, "R2: "+if !show_price then "" else AsText(Round(R2 / TickSize(), 0) * TickSize()), Color.yellow); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R1 != R1[1], R1, "R1: "+if !show_price then "" else AsText(Round(R1 / TickSize(), 0) * TickSize()), Color.red); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else PP != PP[1], PP, "PP: "+if !show_price then "" else AsText(Round(PP / TickSize(), 0) * TickSize()), Color.CYAN); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 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 then thisDay[1] == 1 and thisDay == 0 else S2 != S2[1], S2, "S2: "+if !show_price then "" else AsText(Round(S2 / TickSize(), 0) * TickSize()), Color.dark_orange, no); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else S1 != S1[1], S1, "S1: "+if !show_price then "" else AsText(Round(S1 / TickSize(), 0) * TickSize()), Color.white, NO);
# Traditional Pivot Points
# Assembled by BenTen at UseThinkScript.com
# Based on the formula from https://www.tradingview.com/support/solutions/43000521824-pivot-points-standard/
# Sleepyz - Modifications to show bubbles with label and/or price level
# Updated: Osama Mansour
# Trading View Formula Update
input showonlyLastPeriod = yes;
input show_bubble = yes;
input show_price = 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 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
then thisDay[1] == 1 and thisDay == 0
else R5 != R5[1],
R5,
"R5: " + if !show_price then ""
else AsText(Round(R5 / TickSize(), 0) * TickSize()), Color.GREEN);
AddChartBubble( show_bubble and
if showonlyLastPeriod
then thisDay[1] == 1 and thisDay == 0
else R4 != R4[1],
R4,
"R4: " + if !show_price then ""
else AsText(Round(R4 / TickSize(), 0) * TickSize()), Color.GREEN);
AddChartBubble( show_bubble and
if showonlyLastPeriod
then thisDay[1] == 1 and thisDay == 0
else R3 != R3[1],
R3,
"R3: " + if !show_price then ""
else AsText(Round(R3 / TickSize(), 0) * TickSize()), Color.GREEN);
AddChartBubble( show_bubble and
if showonlyLastPeriod
then thisDay[1] == 1 and thisDay == 0
else R2 != R2[1],
R2,
"R2: " + if !show_price then ""
else AsText(Round(R2 / TickSize(), 0) * TickSize()), Color.YELLOW);
AddChartBubble( show_bubble and
if showonlyLastPeriod
then thisDay[1] == 1 and thisDay == 0
else R1 != R1[1],
R1,
"R1: " + if !show_price then ""
else AsText(Round(R1 / TickSize(), 0) * TickSize()), Color.RED);
AddChartBubble( show_bubble and
if showonlyLastPeriod
then thisDay[1] == 1 and thisDay == 0
else PP != PP[1],
PP,
"PP: " + if !show_price then ""
else AsText(Round(PP / TickSize(), 0) * TickSize()), Color.CYAN);
AddChartBubble( show_bubble and
if showonlyLastPeriod
then thisDay[1] == 1 and thisDay == 0
else S5 != S5[1],
S5,
"S4: " + if !show_price then ""
else AsText(Round(S5 / TickSize(), 0) * TickSize()), Color.GRAY, no);
AddChartBubble( show_bubble and
if showonlyLastPeriod
then thisDay[1] == 1 and thisDay == 0
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
then thisDay[1] == 1 and thisDay == 0
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
then thisDay[1] == 1 and thisDay == 0
else S2 != S2[1],
S2,
"S2: " + if !show_price then ""
else AsText(Round(S2 / TickSize(), 0) * TickSize()), Color.DARK_ORANGE, no);
AddChartBubble( show_bubble and
if showonlyLastPeriod
then thisDay[1] == 1 and thisDay == 0
else S1 != S1[1],
S1,
"S1: " + if !show_price then ""
else AsText(Round(S1 / TickSize(), 0) * TickSize()), Color.WHITE, no);
Nice one!I've made changes to the to match how it works in trading view. For standard pivot points. I should automatically adjust as well now
https://www.tradingview.com/support/solutions/43000521824-pivot-points-standard/
Code:# Traditional Pivot Points # Assembled by BenTen at UseThinkScript.com # Based on the formula from https://www.tradingview.com/support/solutions/43000521824-pivot-points-standard/ # Sleepyz - Modifications to show bubbles with label and/or price level # Updated: Osama Mansour # Trading View Formula Update input showonlyLastPeriod = yes; input show_bubble = yes; input show_price = 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 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 then thisDay[1] == 1 and thisDay == 0 else R5 != R5[1], R5, "R5: " + if !show_price then "" else AsText(Round(R5 / TickSize(), 0) * TickSize()), Color.GREEN); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R4 != R4[1], R4, "R4: " + if !show_price then "" else AsText(Round(R4 / TickSize(), 0) * TickSize()), Color.GREEN); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R3 != R3[1], R3, "R3: " + if !show_price then "" else AsText(Round(R3 / TickSize(), 0) * TickSize()), Color.GREEN); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R2 != R2[1], R2, "R2: " + if !show_price then "" else AsText(Round(R2 / TickSize(), 0) * TickSize()), Color.YELLOW); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R1 != R1[1], R1, "R1: " + if !show_price then "" else AsText(Round(R1 / TickSize(), 0) * TickSize()), Color.RED); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else PP != PP[1], PP, "PP: " + if !show_price then "" else AsText(Round(PP / TickSize(), 0) * TickSize()), Color.CYAN); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else S5 != S5[1], S5, "S4: " + if !show_price then "" else AsText(Round(S5 / TickSize(), 0) * TickSize()), Color.GRAY, no); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 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 then thisDay[1] == 1 and thisDay == 0 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 then thisDay[1] == 1 and thisDay == 0 else S2 != S2[1], S2, "S2: " + if !show_price then "" else AsText(Round(S2 / TickSize(), 0) * TickSize()), Color.DARK_ORANGE, no); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else S1 != S1[1], S1, "S1: " + if !show_price then "" else AsText(Round(S1 / TickSize(), 0) * TickSize()), Color.WHITE, no);
Hello, Thanks for putting together this code. when s3 and r3 is set to no, r3/s3 price bubble continued to show.This puts bubbles with pivot names and price levels for each pivot point.
Code:# Traditional Pivot Points # Assembled by BenTen at UseThinkScript.com # Based on the formula from https://www.tradingview.com/support/solutions/43000521824-pivot-points-standard/ # Sleepyz - Modifications to show bubbles with label and/or price level input showonlyLastPeriod = yes; input show_bubble = yes; input show_price = yes; input aggregationPeriod = AggregationPeriod.DAY; 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 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); 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); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R3 != R3[1], R3, "R3: "+if !show_price then "" else AsText(Round(R3 / TickSize(), 0) * TickSize()), Color.green); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R2 != R2[1], R2, "R2: "+if !show_price then "" else AsText(Round(R2 / TickSize(), 0) * TickSize()), Color.yellow); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R1 != R1[1], R1, "R1: "+if !show_price then "" else AsText(Round(R1 / TickSize(), 0) * TickSize()), Color.red); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else PP != PP[1], PP, "PP: "+if !show_price then "" else AsText(Round(PP / TickSize(), 0) * TickSize()), Color.CYAN); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 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 then thisDay[1] == 1 and thisDay == 0 else S2 != S2[1], S2, "S2: "+if !show_price then "" else AsText(Round(S2 / TickSize(), 0) * TickSize()), Color.dark_orange, no); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else S1 != S1[1], S1, "S1: "+if !show_price then "" else AsText(Round(S1 / TickSize(), 0) * TickSize()), Color.white, NO);
Hello, Thanks for putting together this code. when s3 and r3 is set to no, r3/s3 price bubble continued to show.
Ruby:# Traditional Pivot Points # Assembled by BenTen at UseThinkScript.com # Based on the formula from https://www.tradingview.com/support/solutions/43000521824-pivot-points-standard/ # Sleepyz - Modifications to show bubbles with label and/or price level input showonlyLastPeriod = yes; input show_bubbles = yes;#Hint show_bubbles: turns all bubbles on or off input show_bubble_price = yes;#Hint show_bubble_price: displays price in bubble input show_level_R3_S3 = yes;#Hint show_level_R3_S3: controls display of level line and bubble input aggregationPeriod = AggregationPeriod.DAY; 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 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 = if !show_level_R3_S3 then double.nan else PP * 2 + (HIGHprev - 2 * LOWprev); plot S3 = if !show_level_R3_S3 then double.nan else PP * 2 - (2 * 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); AddChartBubble( show_bubbles and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R3 != R3[1], R3, "R3: " + if !show_bubble_price then "" else AsText(Round(R3 / TickSize(), 0) * TickSize()), Color.GREEN); AddChartBubble( show_bubbles and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R2 != R2[1], R2, "R2: " + if !show_bubble_price then "" else AsText(Round(R2 / TickSize(), 0) * TickSize()), Color.YELLOW); AddChartBubble( show_bubbles and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R1 != R1[1], R1, "R1: " + if !show_bubble_price then "" else AsText(Round(R1 / TickSize(), 0) * TickSize()), Color.RED); AddChartBubble( show_bubbles and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else PP != PP[1], PP, "PP: " + if !show_bubble_price then "" else AsText(Round(PP / TickSize(), 0) * TickSize()), Color.CYAN); AddChartBubble( show_bubbles and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else S3 != S3[1], S3, "S3: " + if !show_bubble_price then "" else AsText(Round(S3 / TickSize(), 0) * TickSize()), Color.GRAY, no); AddChartBubble( show_bubbles and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else S2 != S2[1], S2, "S2: " + if !show_bubble_price then "" else AsText(Round(S2 / TickSize(), 0) * TickSize()), Color.DARK_ORANGE, no); AddChartBubble( show_bubbles and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else S1 != S1[1], S1, "S1: " + if !show_bubble_price then "" else AsText(Round(S1 / TickSize(), 0) * TickSize()), Color.WHITE, no);
https://usethinkscript.com/threads/...icator-for-thinkorswim.4860/page-2#post-75939Hello, what would be the difference between the traditional pivots from TV, AND the Persons pivots????
I did not have a yes/no input to show the R3/S3 levels in the original code. Unchecking the plot in the input of those levels did not affect the display of the bubbles for these.
Included in the code below is now an input to display (yes/no) those levels and bubbles. Selecting 'no' will hide the display of those level's lines and bubbles. Similar modifications can be made for other levels.
Also, for clarity, the inputs for show_bubble and show_price were renamed and modified in the code below to clarify that these apply to all bubbles.
In the image, the input is set to 'no' for displaying the R3_S3 levels.
plot PP = if showonlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-2])
then Double.NaN
How about Mid points? I've played with the code but I am a novice so no luck so far...This puts bubbles with pivot names and price levels for each pivot point.
Code:# Traditional Pivot Points # Assembled by BenTen at UseThinkScript.com # Based on the formula from https://www.tradingview.com/support/solutions/43000521824-pivot-points-standard/ # Sleepyz - Modifications to show bubbles with label and/or price level input showonlyLastPeriod = yes; input show_bubble = yes; input show_price = yes; input aggregationPeriod = AggregationPeriod.DAY; 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 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); 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); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R3 != R3[1], R3, "R3: "+if !show_price then "" else AsText(Round(R3 / TickSize(), 0) * TickSize()), Color.green); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R2 != R2[1], R2, "R2: "+if !show_price then "" else AsText(Round(R2 / TickSize(), 0) * TickSize()), Color.yellow); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R1 != R1[1], R1, "R1: "+if !show_price then "" else AsText(Round(R1 / TickSize(), 0) * TickSize()), Color.red); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else PP != PP[1], PP, "PP: "+if !show_price then "" else AsText(Round(PP / TickSize(), 0) * TickSize()), Color.CYAN); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 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 then thisDay[1] == 1 and thisDay == 0 else S2 != S2[1], S2, "S2: "+if !show_price then "" else AsText(Round(S2 / TickSize(), 0) * TickSize()), Color.dark_orange, no); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else S1 != S1[1], S1, "S1: "+if !show_price then "" else AsText(Round(S1 / TickSize(), 0) * TickSize()), Color.white, NO);
Hello SleepyZ,
Your indicator works very well, im very new to thinkscript.
I'm trying to change the code to show only 1 (*arg) historical pivot results (e.g. previous month and this month)? and remove the forecasted month, year
Code:plot PP = if showonlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-2]) then Double.NaN
and can the code be applied to camarilla pivot as well?
im previously using tradingview, and hope to set the indicators right on top.
Ruby:# Traditional Pivot Points # Assembled by BenTen at UseThinkScript.com # Based on the formula from https://www.tradingview.com/support/solutions/43000521824-pivot-points-standard/ # Sleepyz - Modifications to show bubbles with label and/or price level # Updated: Osama Mansour # Trading View Formula Update input periods_to_display = 2; input show_bubble = yes; input show_price = yes; input show_midpivots = no; def aggregationPeriod = if GetAggregationPeriod() < AggregationPeriod.DAY then AggregationPeriod.DAY else if GetAggregationPeriod() >= AggregationPeriod.DAY and GetAggregationPeriod() < AggregationPeriod.WEEK then AggregationPeriod.WEEK else if GetAggregationPeriod() == AggregationPeriod.WEEK then AggregationPeriod.MONTH else AggregationPeriod.YEAR; def basis = if GetAggregationPeriod() < AggregationPeriod.DAY then GetYYYYMMDD() else if GetAggregationPeriod() >= AggregationPeriod.DAY and GetAggregationPeriod() < AggregationPeriod.WEEK then GetWeek() else if GetAggregationPeriod() == AggregationPeriod.WEEK then GetMonth() else GetYear(); def dayCount = CompoundValue(1, if !IsNaN(close(period = aggregationPeriod)) and basis != basis[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 thisDay < periods_to_display and !IsNaN(close(period = aggregationPeriod)) then (HIGHprev + LOWprev + CLOSEprev) / 3 else Double.NaN; def pp1 = (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); #Mid Pivots plot mr1 = if !show_midpivots then double.nan else (PP + R1) / 2; plot mr2 = if !show_midpivots then double.nan else (R1 + R2) / 2; plot mr3 = if !show_midpivots then double.nan else (R2 + R3) / 2; plot mr4 = if !show_midpivots then double.nan else (R3 + R4) / 2; plot mr5 = if !show_midpivots then double.nan else (R4 + R5) / 2; plot ms1 = if !show_midpivots then double.nan else (PP + S1 ) / 2; plot ms2 = if !show_midpivots then double.nan else (S1 + S2 ) / 2; plot ms3 = if !show_midpivots then double.nan else (S2 + S3 ) / 2; plot ms4 = if !show_midpivots then double.nan else (S3 + S4 ) / 2; plot ms5 = if !show_midpivots then double.nan else (S4 + S5 ) / 2; 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); mr1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); ms1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); mr2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); ms2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); mr3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); ms3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); mr4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); ms4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); mr5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); ms5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); DefineGlobalColor("R", Color.RED); DefineGlobalColor("S", Color.GREEN); DefineGlobalColor("Mid", Color.YELLOW); PP.SetDefaultColor(Color.CYAN); R1.SetDefaultColor(GlobalColor("R")); R2.SetDefaultColor(GlobalColor("R")); R3.SetDefaultColor(GlobalColor("R")); R4.SetDefaultColor(GlobalColor("R")); R5.SetDefaultColor(GlobalColor("R")); S1.SetDefaultColor(GlobalColor("S")); S2.SetDefaultColor(GlobalColor("S")); S3.SetDefaultColor(GlobalColor("S")); S4.SetDefaultColor(GlobalColor("S")); S5.SetDefaultColor(GlobalColor("S")); mr1.SetDefaultColor(GlobalColor("mid")); mr2.SetDefaultColor(GlobalColor("mid")); mr3.SetDefaultColor(GlobalColor("mid")); mr4.SetDefaultColor(GlobalColor("mid")); mr5.SetDefaultColor(GlobalColor("mid")); ms1.SetDefaultColor(GlobalColor("mid")); ms2.SetDefaultColor(GlobalColor("mid")); ms3.SetDefaultColor(GlobalColor("mid")); ms4.SetDefaultColor(GlobalColor("mid")); ms5.SetDefaultColor(GlobalColor("mid")); AddChartBubble(show_bubble and pp1 != pp1[1], R5, "R5: " + if !show_price then "" else AsText(Round(R5 / TickSize(), 0) * TickSize()), Color.GREEN); AddChartBubble(show_bubble and pp1 != pp1[1], R4, "R4: " + if !show_price then "" else AsText(Round(R4 / TickSize(), 0) * TickSize()), Color.GREEN); AddChartBubble( show_bubble and pp1 != pp1[1], R3, "R3: " + if !show_price then "" else AsText(Round(R3 / TickSize(), 0) * TickSize()), Color.GREEN); AddChartBubble( show_bubble and pp1 != pp1[1], R2, "R2: " + if !show_price then "" else AsText(Round(R2 / TickSize(), 0) * TickSize()), Color.YELLOW); AddChartBubble( show_bubble and pp1 != pp1[1], R1, "R1: " + if !show_price then "" else AsText(Round(R1 / TickSize(), 0) * TickSize()), Color.RED); AddChartBubble( show_bubble and pp1 != pp1[1] , PP, "PP: " + if !show_price then "" else AsText(Round(PP / TickSize(), 0) * TickSize()), Color.CYAN); AddChartBubble( show_bubble and pp1 != pp1[1], S5, "S5: " + if !show_price then "" else AsText(Round(S5 / TickSize(), 0) * TickSize()), Color.GRAY, no); AddChartBubble( show_bubble and pp1 != pp1[1], S4, "S4: " + if !show_price then "" else AsText(Round(S4 / TickSize(), 0) * TickSize()), Color.GRAY, no); AddChartBubble( show_bubble and pp1 != pp1[1], S3, "S3: " + if !show_price then "" else AsText(Round(S3 / TickSize(), 0) * TickSize()), Color.GRAY, no); AddChartBubble( show_bubble and pp1 != pp1[1], S2, "S2: " + if !show_price then "" else AsText(Round(S2 / TickSize(), 0) * TickSize()), Color.DARK_ORANGE, no); AddChartBubble( show_bubble and pp1 != pp1[1], S1, "S1: " + if !show_price then "" else AsText(Round(S1 / TickSize(), 0) * TickSize()), Color.WHITE, no);
The above post has your request for mid pivots included. I did not addbubbles at this time for the mid pivots.How about Mid points? I've played with the code but I am a novice so no luck so far...
small request, remove price from bubble since price plots on the right AXIS, only show letters,,, if possible to move bubbles using 'shiftbubble' or movebubble,,,,The following mod to the pivot script will allow you to choose how many periods you want to display. It also includes midpivots requested in the next post.
small request, remove price from bubble since price plots on the right AXIS, only show letters,,, if possible to move bubbles using 'shiftbubble' or movebubble,,,,
Ruby:# Traditional Pivot Points # Assembled by BenTen at UseThinkScript.com # Based on the formula from https://www.tradingview.com/support/solutions/43000521824-pivot-points-standard/ # Sleepyz - Modifications to show bubbles with label and/or price level # Updated: Osama Mansour # Trading View Formula Update input periods_to_display = 2; input show_bubble = yes; input show_price = yes; input show_midpivots = no; def aggregationPeriod = if GetAggregationPeriod() < AggregationPeriod.DAY then AggregationPeriod.DAY else if GetAggregationPeriod() >= AggregationPeriod.DAY and GetAggregationPeriod() < AggregationPeriod.WEEK then AggregationPeriod.WEEK else if GetAggregationPeriod() == AggregationPeriod.WEEK then AggregationPeriod.MONTH else AggregationPeriod.YEAR; def basis = if GetAggregationPeriod() < AggregationPeriod.DAY then GetYYYYMMDD() else if GetAggregationPeriod() >= AggregationPeriod.DAY and GetAggregationPeriod() < AggregationPeriod.WEEK then GetWeek() else if GetAggregationPeriod() == AggregationPeriod.WEEK then GetMonth() else GetYear(); def dayCount = CompoundValue(1, if !IsNaN(close(period = aggregationPeriod)) and basis != basis[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 thisDay < periods_to_display and !IsNaN(close(period = aggregationPeriod)) then (HIGHprev + LOWprev + CLOSEprev) / 3 else Double.NaN; def pp1 = (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); #Mid Pivots plot mr1 = if !show_midpivots then double.nan else (PP + R1) / 2; plot mr2 = if !show_midpivots then double.nan else (R1 + R2) / 2; plot mr3 = if !show_midpivots then double.nan else (R2 + R3) / 2; plot mr4 = if !show_midpivots then double.nan else (R3 + R4) / 2; plot mr5 = if !show_midpivots then double.nan else (R4 + R5) / 2; plot ms1 = if !show_midpivots then double.nan else (PP + S1 ) / 2; plot ms2 = if !show_midpivots then double.nan else (S1 + S2 ) / 2; plot ms3 = if !show_midpivots then double.nan else (S2 + S3 ) / 2; plot ms4 = if !show_midpivots then double.nan else (S3 + S4 ) / 2; plot ms5 = if !show_midpivots then double.nan else (S4 + S5 ) / 2; 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); mr1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); ms1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); mr2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); ms2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); mr3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); ms3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); mr4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); ms4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); mr5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); ms5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); DefineGlobalColor("R", Color.RED); DefineGlobalColor("S", Color.GREEN); DefineGlobalColor("Mid", Color.YELLOW); PP.SetDefaultColor(Color.CYAN); R1.SetDefaultColor(GlobalColor("R")); R2.SetDefaultColor(GlobalColor("R")); R3.SetDefaultColor(GlobalColor("R")); R4.SetDefaultColor(GlobalColor("R")); R5.SetDefaultColor(GlobalColor("R")); S1.SetDefaultColor(GlobalColor("S")); S2.SetDefaultColor(GlobalColor("S")); S3.SetDefaultColor(GlobalColor("S")); S4.SetDefaultColor(GlobalColor("S")); S5.SetDefaultColor(GlobalColor("S")); mr1.SetDefaultColor(GlobalColor("mid")); mr2.SetDefaultColor(GlobalColor("mid")); mr3.SetDefaultColor(GlobalColor("mid")); mr4.SetDefaultColor(GlobalColor("mid")); mr5.SetDefaultColor(GlobalColor("mid")); ms1.SetDefaultColor(GlobalColor("mid")); ms2.SetDefaultColor(GlobalColor("mid")); ms3.SetDefaultColor(GlobalColor("mid")); ms4.SetDefaultColor(GlobalColor("mid")); ms5.SetDefaultColor(GlobalColor("mid")); input bubblemover = 1; def b=bubblemover; def b1=b+1; AddChartBubble(show_bubble and pp1[b] != pp1[b1], R5, "R5: " + if !show_price then "" else AsText(Round(R5 / TickSize(), 0) * TickSize()), Color.GREEN); AddChartBubble(show_bubble and pp1[b] != pp1[b1], R4, "R4: " + if !show_price then "" else AsText(Round(R4 / TickSize(), 0) * TickSize()), Color.GREEN); AddChartBubble( show_bubble and pp1[b] != pp1[b1], R3, "R3: " + if !show_price then "" else AsText(Round(R3 / TickSize(), 0) * TickSize()), Color.GREEN); AddChartBubble( show_bubble and pp1[b] != pp1[b1], R2, "R2: " + if !show_price then "" else AsText(Round(R2 / TickSize(), 0) * TickSize()), Color.green); AddChartBubble( show_bubble and pp1[b] != pp1[b1], R1, "R1: " + if !show_price then "" else AsText(Round(R1 / TickSize(), 0) * TickSize()), Color.green); AddChartBubble( show_bubble and pp1[b] != pp1[b1], PP, "PP: " + if !show_price then "" else AsText(Round(PP / TickSize(), 0) * TickSize()), Color.CYAN); AddChartBubble( show_bubble and pp1[b] != pp1[b1], S5, "S5: " + if !show_price then "" else AsText(Round(S5 / TickSize(), 0) * TickSize()), Color.red, no); AddChartBubble( show_bubble and pp1[b] != pp1[b1], S4, "S4: " + if !show_price then "" else AsText(Round(S4 / TickSize(), 0) * TickSize()), Color.red, no); AddChartBubble( show_bubble and pp1[b] != pp1[b1], S3, "S3: " + if !show_price then "" else AsText(Round(S3 / TickSize(), 0) * TickSize()), Color.red, no); AddChartBubble( show_bubble and pp1[b] != pp1[b1], S2, "S2: " + if !show_price then "" else AsText(Round(S2 / TickSize(), 0) * TickSize()), Color.red, no); AddChartBubble( show_bubble and pp1[b] != pp1[b1], S1, "S1: " + if !show_price then "" else AsText(Round(S1 / TickSize(), 0) * TickSize()), Color.red, no);
#By ezeguada. Code cracked from TOS script Pivot Points.
def max = high(period = aggregationperiod.DAY)[1];
def min = low(period = aggregationperiod.DAY)[1];
def spot = close(period = aggregationperiod.DAY)[1];
def poc = (max + min + spot) / 3;
def sup1 = poc - (max - poc);
def sup2 = poc - (max - min);
def res1 = poc + (poc - min);
def res2 = poc + (max - min);
plot l1 = poc;
l1.SetDefaultColor(Color.MAGENTA);
l1.setPaintingStrategy(paintingStrategy.HORIZONTAL);
plot l2 = sup1;
l2.SetDefaultColor(Color.GREEN);
l2.setPaintingStrategy(paintingStrategy.HORIZONTAL);
plot l3 = sup2;
l3.SetDefaultColor(Color.GREEN);
l3.setPaintingStrategy(paintingStrategy.HORIZONTAL);
plot l4 = res1;
l4.SetDefaultColor(Color.RED);
l4.setPaintingStrategy(paintingStrategy.HORIZONTAL);
plot l5 = res2;
l5.SetDefaultColor(Color.RED);
l5.setPaintingStrategy(paintingStrategy.HORIZONTAL);
My bubble is on the right blocking the most recent candles when I choose the Monthly period. Is there a way to have it shown on the left like yours?This puts bubbles with pivot names and price levels for each pivot point.
Code:# Traditional Pivot Points # Assembled by BenTen at UseThinkScript.com # Based on the formula from https://www.tradingview.com/support/solutions/43000521824-pivot-points-standard/ # Sleepyz - Modifications to show bubbles with label and/or price level input showonlyLastPeriod = yes; input show_bubble = yes; input show_price = yes; input aggregationPeriod = AggregationPeriod.DAY; 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 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); 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); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R3 != R3[1], R3, "R3: "+if !show_price then "" else AsText(Round(R3 / TickSize(), 0) * TickSize()), Color.green); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R2 != R2[1], R2, "R2: "+if !show_price then "" else AsText(Round(R2 / TickSize(), 0) * TickSize()), Color.yellow); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else R1 != R1[1], R1, "R1: "+if !show_price then "" else AsText(Round(R1 / TickSize(), 0) * TickSize()), Color.red); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else PP != PP[1], PP, "PP: "+if !show_price then "" else AsText(Round(PP / TickSize(), 0) * TickSize()), Color.CYAN); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 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 then thisDay[1] == 1 and thisDay == 0 else S2 != S2[1], S2, "S2: "+if !show_price then "" else AsText(Round(S2 / TickSize(), 0) * TickSize()), Color.dark_orange, no); AddChartBubble( show_bubble and if showonlyLastPeriod then thisDay[1] == 1 and thisDay == 0 else S1 != S1[1], S1, "S1: "+if !show_price then "" else AsText(Round(S1 / TickSize(), 0) * TickSize()), Color.white, NO);
My bubble is on the right blocking the most recent candles when I choose the Monthly period. Is there a way to have it shown on the left like yours?
Sorry, I'm not good with TOS scripts so where do I find the bubblemover?First, try using the input bubblemover in the above code by entering plus/minus numbers to position the bubbles where you would like them. Otherwise, provide the code you are using and a chart image showing the problem you are experiencing.
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
A | ToS Pivot Points Indicator for ThinkorSwim | Questions | 10 | |
S | Data Scraping on TOS | Questions | 3 | |
G | Using upper chart from TOS script | Questions | 0 | |
E | TradingView chart transfer to TOS | Questions | 1 | |
T | Is it possible to insert Price-lvls from excel to ToS | Questions | 8 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.