@SleepyZ
Could the right edge be added to this script? I tried but its not displaying the bubbles.
#
https://usethinkscript.com/threads/...r-thinkorswim-with-fibonacci-levels.29/page-2
def na = Double.NaN;
#
# Define time that OR begins (in hhmm format,
# 0930 is the default):
#
input ORBegin = 0930;
#
# Define time that OR is finished (in hhmm format,
# 10:00 is the default):
#
input OREnd = 1030;
#
# Show Today only? (Default Yes)
#
input ShowTodayOnly = {"No", default "Yes"};
def s = ShowTodayOnly;
# Create logic for OR definition:
#
def ORActive = if SecondsTillTime(OREnd) > 0 and SecondsFromTime(ORBegin) >= 0 then 1 else 0;
#
# Create logic to paint only current day post-open:
#
def today = if s == 0 or GetDay() == GetLastDay() and SecondsFromTime(ORBegin) >= 0 then 1 else 0;
#
# Track OR High:
#
rec ORHigh = if ORHigh[1] == 0 or ORActive[1] == 0 and ORActive == 1 then high else if ORActive and high > ORHigh[1] then high else ORHigh[1];
#
# Track OR Low:
#
rec ORLow = if ORLow[1] == 0 or ORActive[1] == 0 and ORActive == 1 then low else if ORActive and low < ORLow[1] then low else ORLow[1];
#
# Calculate OR width:
#
def ORWidth = ORHigh - ORLow;
#
# Calculate fib levels:
#
def fib_mid = (ORHigh + ORLow) / 2;
# Define all the plots:
#
plot ORH = if ORActive or today < 1 then na else ORHigh;
plot ORL = if ORActive or today < 1 then na else ORLow;
plot OrbMid = if ORActive or today < 1 then na else fib_mid;
# Labels
input ShowLabel = YES;
input ShowLabelORH = YES;
input ShowLabelORL = YES;
input ShowLabelOR50 = YES;
#def lastBar = HighestAll(if !IsNaN(close) then BarNumber() else 0);
#def barNumber = BarNumber();
#def barCount = HighestAll(If(IsNaN(close), 0, barNumber));
#Bubble
input locate_bubbles_at_time = 0930;
input ShowBubbles = yes;
def timeopen = SecondsFromTime(locate_bubbles_at_time) == 0;
input bubble_placement = {default right_edge, timeopen};
def right_edge = barnumber() == highestall(barnumber() - 1);
#Bubble
input showbubble = yes;
input bubblemover = 3;
input showValuesInBubbles = yes;
def bm = bubblemover;
def bm1 = bm + 1;
DefineGlobalColor("IBH", CreateColor(255,204,153));
AddChartBubble(ShowBubbles and
if bubble_placement == bubble_placement.timeopen
then timeopen
else right_edge, ORH, "IBH: " + ORH, GlobalColor("IBH"));
DefineGlobalColor("IBM", CreateColor(255,204,153));
AddChartBubble(ShowBubbles and
if bubble_placement == bubble_placement.timeopen
then timeopen
else right_edge, ORBMid, "IBM: " + ORBMid, GlobalColor("IBM"));
DefineGlobalColor("IBL", CreateColor(255,204,153));
AddChartBubble(ShowBubbles and
if bubble_placement == bubble_placement.timeopen
then timeopen
else right_edge, ORL, "IBL: " + ORL, GlobalColor("IBL"));
ORH.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ORH.SetDefaultColor(Color.Yellow);
ORH.HideBubble();
ORH.HideTitle();
ORBMid.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ORBMid.SetDefaultColor(Color.Yellow);
ORBMid.HideBubble();
ORBMid.HideTitle();
ORL.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ORL.SetDefaultColor(Color.Yellow);
ORL.HideBubble();
ORL.HideTitle();