Repaints Multi-Timeframe HLOC plus Fibs For ThinkOrSwim

Repaints

FutureTony

Well-known member
VIP
Hello friends, I'm back with another study. This one automatically plots the Monthly/Weekly/Daily highs, lows, opens and closes. It also automatically plots monthly and weekly fib levels - midpoint, 0.618 from the top to bottom and 0.618 from the bottom to the top. The fib level can be changed via the options. There is so much packed into this one. Many of the levels here are ones that I've been manually marking on charts for some time. I took some inspiration from this study Welkin posted: Daily High/Low/Close and from SpacemanBTC that creates indicators for TradingView. Use it on timeframes less than 4 hrs or hide the daily levels if using on something larger.

8NVQSTO.png


This study has loads of options to show/hide different combinations of lines. By default, 'name' bubbles are turned off and appear at the left edge or the start of the timeframe (ie. Monthly bubble appears at the start of the month). You can change the bubbles to show at the right edge but this requires you have an 'Expansion Area' of 5 bars:

OlhfMjA.png


All of the other variables are mostly self-explanatory and turn off or on different levels. The only other odd one is the showVertical option that will plot a vertical line at the start of the Month and Week. There is a lot here and I've designed it to be an all-in-one indicator with very little changes required but I will also be working on a smaller version of this that will automatically plot for a single timeframe and could potentially be added to a chart several times. Because there can be so many lines, I've created a color scheme to try to make them subtle and not so aggressive. These can be changed in the global variable section.

I've designed this with the day trader in mind but believe the larger levels may work well for swing trading many different instruments. I will not be adding a scanner for this study and I do not require on. If someone wants one but cannot create one for themselves, I'm sure the amazing community here can help.

One last note. I have mentioned in other threads that thinkscript does not allow you to access the Settlement price via code. For this reason, the 'Close' value will always be slightly different as it is based on the last candle of the day and not the actual Settlement. This cannot be avoided and in general I do not show the 'Close' on my charts. Cheers!

Code:
# Created by @tony_futures
# Plot Monthly/Weekly/Daily levels along with associated fibs
#hint: This study plot HLOC levels for Monthly and Weekly timeframes
#hint ShowBubblesLeft: Will show the bubbles on the left - turn to no to show on the right

def NAN = Double.NaN;

input addPeriod1 = AggregationPeriod.DAY;
input addPeriod2 = AggregationPeriod.WEEK;
input addPeriod3 = AggregationPeriod.MONTH;
input showOpens = no;
input showCloses = no;
input showDayBubbles = yes;
input showWeeklyBubbles = yes;
input showMonthlyBubbles = yes;
input showDaily = yes;
input showBubblesLeft = yes;
input showValuesInBubbles = no;
input RoundLevel = 0;
input displaceBubbles = 3;

# setup Colors
DefineGlobalColor("lowColor", CreateColor(109, 59, 81));
DefineGlobalColor("highColor", CreateColor(59, 109, 88));
DefineGlobalColor("openColor", CreateColor(169, 169, 169));
DefineGlobalColor("midColor", CreateColor(94, 110, 59));
DefineGlobalColor("fibColor", CreateColor(28, 96, 109));

def Today = if GetLastDay() == GetDay() then 1 else 0;
def showBubbleNow = !IsNaN(close) and IsNaN(close[-1]);
# plot Daily Levels;
plot prevDayOpen = if showDaily and Today and showOpens then open("period"=addPeriod1)[1] else NAN;
plot prevDayLow = if showDaily and Today then low("period"=addPeriod1)[1] else NAN;
plot prevDayHigh = if showDaily and Today then high("period"=addPeriod1)[1] else NAN;
#currentOpen.SetDefaultColor(Color.WHITE);
prevDayLow.SetDefaultColor(GlobalColor("lowColor"));
prevDayLow.hideBubble();
prevDayHigh.SetDefaultColor(GlobalColor("highColor"));
prevDayHigh.hideBubble();
prevDayOpen.SetDefaultColor(GlobalColor("openColor"));
prevDayOpen.hideBubble();

AddChartBubble(showDayBubbles and showOpens and !showBubblesLeft and showBubbleNow[displaceBubbles], prevDayOpen[1] , if showValuesInBubbles then "YDay Open: " + prevDayOpen[1] else "YDay Open", GlobalColor("openColor"), yes);
AddChartBubble(showDayBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], prevDayLow[1], if showValuesInBubbles then "YDay Low: " + prevDayLow[1] else "YDay Low", GlobalColor("lowColor"), no);
AddChartBubble(showDayBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], prevDayHigh[1], if showValuesInBubbles then "YDay High: " + prevDayHigh[1] else "YDay High", GlobalColor("highColor"), yes);
AddChartBubble(showDayBubbles and showOpens and showBubblesLeft and Today and !Today[1], prevDayOpen[1] , if showValuesInBubbles then "YDay Open: " + prevDayOpen[1] else "YDay Open", GlobalColor("openColor"), yes);
AddChartBubble(showDayBubbles and !showBubblesLeft and Today and !Today[1], prevDayLow[1], if showValuesInBubbles then "YDay Low: " + prevDayLow[1] else "YDay Low", GlobalColor("lowColor"), no);
AddChartBubble(showDayBubbles and !showBubblesLeft and Today and !Today[1], prevDayHigh[1], if showValuesInBubbles then "YDay High: " + prevDayHigh[1] else "YDay High", GlobalColor("highColor"), yes);


# Weekly Levels
def ThisWeek = if GetLastWeek() == GetWeek() then yes else 0;
plot prevWeekOpen = if ThisWeek and showOpens then open("period"=addPeriod2)[1] else NAN;
plot prevWeekClose = if ThisWeek and showCloses then close("period"=addPeriod2)[1] else NAN;
plot prevWeekLow = if ThisWeek then low("period"=addPeriod2)[1] else NAN;
plot prevWeekHigh = if ThisWeek then high("period"=addPeriod2)[1] else NAN;
prevweekLow.SetDefaultColor(GlobalColor("lowColor"));
prevWeekLow.hideBubble();
prevWeekHigh.SetDefaultColor(GlobalColor("highColor"));
prevWeekHigh.hideBubble();
prevWeekOpen.SetDefaultColor(GlobalColor("openColor"));
prevWeekOpen.hideBubble();
prevWeekClose.SetDefaultColor(GlobalColor("openColor"));
prevWeekClose.hideBubble();

AddChartBubble(showOpens and showWeeklyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], prevWeekOpen, if showValuesInBubbles then "Prev Weekly Open: " + prevWeekOpen else "Prev Week Open", GlobalColor("openColor"), yes);
AddChartBubble(showWeeklyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles],PrevWeekLow, if showValuesInBubbles then "Weekly Low: " + PrevWeekLow else "Prev Weekly Low", GlobalColor("lowColor"), no);
AddChartBubble(showWeeklyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], PrevWeekHigh, if showValuesInBubbles then "Weekly High: " + PrevWeekHigh else "Prev Weekly High", GlobalColor("highColor"), yes);
AddChartBubble(showOpens and showWeeklyBubbles and showBubblesLeft and thisWeek and !thisWeek[1], prevWeekOpen, if showValuesInBubbles then "Prev Weekly Open: " + prevWeekOpen else "Prev Week Open", GlobalColor("openColor"), yes);
AddChartBubble(showWeeklyBubbles and showBubblesLeft and thisWeek and !thisWeek[1],PrevWeekLow, if showValuesInBubbles then "Weekly Low: " + PrevWeekLow else "Prev Weekly Low", GlobalColor("lowColor"), no);
AddChartBubble(showWeeklyBubbles and showBubblesLeft and thisWeek and !thisWeek[1], PrevWeekHigh, if showValuesInBubbles then "Weekly High: " + PrevWeekHigh else "Prev Weekly High", GlobalColor("highColor"), yes);

# Monthly Levels
input showMonthly = yes;
def ThisMonth = GetLastMonth() == GetMonth();
def prevMoOpen = open("period"=addPeriod3)[1];
plot prevMonthOpen = if showMonthly and showOpens and ThisMonth then prevMoOpen else NAN;
def prevMoClose = close("period"=addPeriod3)[1];
plot prevMonthClose = if showMonthly and showOpens and ThisMonth then prevMoClose else NAN;
plot prevMonthLow = if showMonthly and ThisMonth then low("period"=addPeriod3)[1] else NAN;
plot prevMonthHigh = if showMonthly and ThisMonth then high("period"=addPeriod3)[1] else NAN;
prevMonthLow.SetDefaultColor(GlobalColor("lowColor"));
prevMonthLow.hideBubble();
prevMonthHigh.SetDefaultColor(GlobalColor("highColor"));
prevMonthHigh.hideBubble();
prevMonthOpen.SetDefaultColor(GlobalColor("openColor"));
prevMonthOpen.hideBubble();
prevMonthClose.SetDefaultColor(GlobalColor("openColor"));
prevMonthClose.hideBubble();

AddChartBubble(showMonthlyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], prevMonthOpen, if showValuesInBubbles then "Prev Monthly Open: " + prevMonthOpen else "Prev Monthly Open", GlobalColor("openColor"), yes);
AddChartBubble(showMonthlyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles],PrevMonthLow, if showValuesInBubbles then "Prev Monthly Low: " + PrevMonthLow else "Prev Monthly Low", GlobalColor("lowColor"), no);
AddChartBubble(showMonthlyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], PrevMonthHigh, if showValuesInBubbles then "Prev Monthly High: " + PrevMonthHigh else "Prev Monthly High", GlobalColor("highColor"), yes);

AddChartBubble(showMonthlyBubbles and showBubblesLeft and thisMonth and !thisMonth[1], prevMonthOpen, if showValuesInBubbles then "Prev Monthly Open: " + prevMonthOpen else "Prev Monthly Open", GlobalColor("openColor"), yes);
AddChartBubble(showMonthlyBubbles and showBubblesLeft and thisMonth and !thisMonth[1],PrevMonthLow, if showValuesInBubbles then "Prev Monthly Low: " + PrevMonthLow else "Prev Monthly Low", GlobalColor("lowColor"), no);
AddChartBubble(showMonthlyBubbles and showBubblesLeft and thisMonth and !thisMonth[1], PrevMonthHigh, if showValuesInBubbles then "Prev Monthly High: " + PrevMonthHigh else "Prev Monthly High", GlobalColor("highColor"), yes);




input showVertical = yes;
AddVerticalLine(showVertical and thisMonth and !thisMonth[1], " Month Start", GlobalColor("openColor"));
AddVerticalLine(showVertical and thisWeek and !thisWeek[1], " Week Start", GlobalColor("openColor"));

# monthly fibs
input showMonthlyFibs = yes;
input monthlyFibAmt = 0.618;
def monthlyFib1 = Round(PrevMonthLow + ((PrevMonthHigh - PrevMonthLow) * monthlyFibAmt),RoundLevel);
plot monthlyFib1Line = if showMonthly and showMonthlyFibs and thisMonth then monthlyFib1 else NAN;
monthlyFib1Line.setDefaultColor(GlobalColor("fibColor"));
monthlyFib1Line.hideBubble();
def monthlyFib2 = Round(PrevMonthHigh - ((PrevMonthHigh - PrevMonthLow) * monthlyFibAmt),RoundLevel);
plot monthlyFib2Line = if showMonthly and showMonthlyFibs and thisMonth then monthlyFib2 else NAN;
monthlyFib2Line.setDefaultColor(GlobalColor("fibColor"));
monthlyFib2Line.hideBubble();
def monthlyMid = Round(PrevMonthHigh - ((PrevMonthHigh - PrevMonthLow) /2),RoundLevel);
plot monthlyMidLine = if showMonthly and showMonthlyFibs and thisMonth then monthlyMid else NAN;
monthlyMidLine.setDefaultColor(GlobalColor("midColor"));
monthlyMidLine.hideBubble();

AddChartBubble(showMonthlyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], monthlyFib1, if showValuesInBubbles then "Monthly Fib 1: " + monthlyFib1 else "Monthly Fib 1", GlobalColor("fibColor"), no);
AddChartBubble(showMonthlyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], monthlyFib2, if showValuesInBubbles then "Monthly Fib 2: " + monthlyFib2 else "Monthly Fib 2", GlobalColor("fibColor"), no);
AddChartBubble(showMonthlyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], monthlyMid, if showValuesInBubbles then "Monthly Mid: " + monthlyMid else "Monthly Mid", GlobalColor("midColor"), no);

AddChartBubble(showMonthlyBubbles and showBubblesLeft and thisMonth and !thisMonth[1], monthlyFib1, if showValuesInBubbles then "Monthly Fib 1: " + monthlyFib1 else "Monthly Fib 1", GlobalColor("fibColor"), no);
AddChartBubble(showMonthlyBubbles and showBubblesLeft and thisMonth and !thisMonth[1],monthlyFib2, if showValuesInBubbles then "Monthly Fib 2: " + monthlyFib2 else "Monthly Fib 2", GlobalColor("fibColor"), no);
AddChartBubble(showMonthlyBubbles and showBubblesLeft and thisMonth and !thisMonth[1], monthlyMid, if showValuesInBubbles then "Monthly Mid: " + monthlyMid else "Monthly Mid", GlobalColor("midColor"), no);

# weekly fibs
input showWeeklyFibs = yes;
input weeklyFibAmt = 0.618;
def weeklyFib1 = Round(PrevWeekLow + ((PrevWeekHigh - PrevWeekLow) * weeklyFibAmt),RoundLevel);
plot weeklyFib1Line = if showWeeklyFibs and thisWeek then weeklyFib1 else NAN;
weeklyFib1Line.setDefaultColor(GlobalColor("fibColor"));
weeklyFib1Line.hideBubble();
def weeklyFib2 = Round(PrevWeekHigh - ((PrevWeekHigh - PrevWeekLow) * weeklyFibAmt),RoundLevel);
plot weeklyFib2Line = if showWeeklyFibs and thisWeek then weeklyFib2 else NAN;
weeklyFib2Line.setDefaultColor(GlobalColor("fibColor"));
weeklyFib2Line.hideBubble();
def weeklyMid = Round(PrevWeekHigh - ((PrevWeekHigh - PrevWeekLow) /2),RoundLevel);
plot weeklyMidLine = if showWeeklyFibs and thisWeek then weeklyMid else NAN;
weeklyMidLine.setDefaultColor(GlobalColor("midColor"));
weeklyMidLine.hideBubble();

AddChartBubble(showweeklyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], weeklyFib1, if showValuesInBubbles then "weekly Fib 1: " + weeklyFib1 else "weekly Fib 1", GlobalColor("fibColor"), no);
AddChartBubble(showweeklyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], weeklyFib2, if showValuesInBubbles then "weekly Fib 2: " + weeklyFib2 else "weekly Fib 2", GlobalColor("fibColor"), no);
AddChartBubble(showweeklyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], weeklyMid, if showValuesInBubbles then "weekly Mid: " + weeklyMid else "weekly Mid", GlobalColor("midColor"), no);

AddChartBubble(showweeklyBubbles and showBubblesLeft and thisWeek and !thisWeek[1], weeklyFib1, if showValuesInBubbles then "weekly Fib 1: " + weeklyFib1 else "weekly Fib 1", GlobalColor("fibColor"), no);
AddChartBubble(showweeklyBubbles and showBubblesLeft and thisWeek and !thisWeek[1],weeklyFib2, if showValuesInBubbles then "weekly Fib 2: " + weeklyFib2 else "weekly Fib 2", GlobalColor("fibColor"), no);
AddChartBubble(showweeklyBubbles and showBubblesLeft and thisWeek and !thisWeek[1], weeklyMid, if showValuesInBubbles then "weekly Mid: " + weeklyFib1 else "weekly Mid", GlobalColor("midColor"), no);
 
Last edited:
Hello friends, I'm back with another study. This one automatically plots the Monthly/Weekly/Daily highs, lows, opens and closes. It also automatically plots monthly and weekly fib levels - midpoint, 0.618 from the top to bottom and 0.618 from the bottom to the top. The fib level can be changed via the options. There is so much packed into this one. Many of the levels here are ones that I've been manually marking on charts for some time. I took some inspiration from this study Welkin posted: Daily High/Low/Close and from SpacemanBTC that creates indicators for TradingView. Use it on timeframes less than 4 hrs or hide the daily levels if using on something larger.

8NVQSTO.png


This study has loads of options to show/hide different combinations of lines. By default, 'name' bubbles are turned off and appear at the left edge or the start of the timeframe (ie. Monthly bubble appears at the start of the month). You can change the bubbles to show at the right edge but this requires you have an 'Expansion Area' of 5 bars:

OlhfMjA.png


All of the other variables are mostly self-explanatory and turn off or on different levels. The only other odd one is the showVertical option that will plot a vertical line at the start of the Month and Week. There is a lot here and I've designed it to be an all-in-one indicator with very little changes required but I will also be working on a smaller version of this that will automatically plot for a single timeframe and could potentially be added to a chart several times. Because there can be so many lines, I've created a color scheme to try to make them subtle and not so aggressive. These can be changed in the global variable section.

I've designed this with the day trader in mind but believe the larger levels may work well for swing trading many different instruments. I will not be adding a scanner for this study and I do not require on. If someone wants one but cannot create one for themselves, I'm sure the amazing community here can help.

One last note. I have mentioned in other threads that thinkscript does not allow you to access the Settlement price via code. For this reason, the 'Close' value will always be slightly different as it is based on the last candle of the day and not the actual Settlement. This cannot be avoided and in general I do not show the 'Close' on my charts. Cheers!

Code:
# Created by @tony_futures
# Plot Monthly/Weekly/Daily levels along with associated fibs
#hint: This study plot HLOC levels for Monthly and Weekly timeframes
#hint ShowBubblesLeft: Will show the bubbles on the left - turn to no to show on the right

def NAN = Double.NaN;

input addPeriod1 = AggregationPeriod.DAY;
input addPeriod2 = AggregationPeriod.WEEK;
input addPeriod3 = AggregationPeriod.MONTH;
input showOpens = no;
input showCloses = no;
input showDayBubbles = yes;
input showWeeklyBubbles = yes;
input showMonthlyBubbles = yes;
input showDaily = yes;
input showBubblesLeft = yes;
input showValuesInBubbles = no;
input RoundLevel = 0;
input displaceBubbles = 3;

# setup Colors
DefineGlobalColor("lowColor", CreateColor(109, 59, 81));
DefineGlobalColor("highColor", CreateColor(59, 109, 88));
DefineGlobalColor("openColor", CreateColor(169, 169, 169));
DefineGlobalColor("midColor", CreateColor(94, 110, 59));
DefineGlobalColor("fibColor", CreateColor(28, 96, 109));

def Today = if GetLastDay() == GetDay() then 1 else 0;
def showBubbleNow = !IsNaN(close) and IsNaN(close[-1]);
# plot Daily Levels;
plot prevDayOpen = if showDaily and Today and showOpens then open("period"=addPeriod1)[1] else NAN;
plot prevDayLow = if showDaily and Today then low("period"=addPeriod1)[1] else NAN;
plot prevDayHigh = if showDaily and Today then high("period"=addPeriod1)[1] else NAN;
#currentOpen.SetDefaultColor(Color.WHITE);
prevDayLow.SetDefaultColor(GlobalColor("lowColor"));
prevDayLow.hideBubble();
prevDayHigh.SetDefaultColor(GlobalColor("highColor"));
prevDayHigh.hideBubble();
prevDayOpen.SetDefaultColor(GlobalColor("openColor"));
prevDayOpen.hideBubble();

AddChartBubble(showDayBubbles and showOpens and !showBubblesLeft and showBubbleNow[displaceBubbles], prevDayOpen[1] , if showValuesInBubbles then "YDay Open: " + prevDayOpen[1] else "YDay Open", GlobalColor("openColor"), yes);
AddChartBubble(showDayBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], prevDayLow[1], if showValuesInBubbles then "YDay Low: " + prevDayLow[1] else "YDay Low", GlobalColor("lowColor"), no);
AddChartBubble(showDayBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], prevDayHigh[1], if showValuesInBubbles then "YDay High: " + prevDayHigh[1] else "YDay High", GlobalColor("highColor"), yes);
AddChartBubble(showDayBubbles and showOpens and showBubblesLeft and Today and !Today[1], prevDayOpen[1] , if showValuesInBubbles then "YDay Open: " + prevDayOpen[1] else "YDay Open", GlobalColor("openColor"), yes);
AddChartBubble(showDayBubbles and !showBubblesLeft and Today and !Today[1], prevDayLow[1], if showValuesInBubbles then "YDay Low: " + prevDayLow[1] else "YDay Low", GlobalColor("lowColor"), no);
AddChartBubble(showDayBubbles and !showBubblesLeft and Today and !Today[1], prevDayHigh[1], if showValuesInBubbles then "YDay High: " + prevDayHigh[1] else "YDay High", GlobalColor("highColor"), yes);


# Weekly Levels
def ThisWeek = if GetLastWeek() == GetWeek() then yes else 0;
plot prevWeekOpen = if ThisWeek and showOpens then open("period"=addPeriod2)[1] else NAN;
plot prevWeekClose = if ThisWeek and showCloses then close("period"=addPeriod2)[1] else NAN;
plot prevWeekLow = if ThisWeek then low("period"=addPeriod2)[1] else NAN;
plot prevWeekHigh = if ThisWeek then high("period"=addPeriod2)[1] else NAN;
prevweekLow.SetDefaultColor(GlobalColor("lowColor"));
prevWeekLow.hideBubble();
prevWeekHigh.SetDefaultColor(GlobalColor("highColor"));
prevWeekHigh.hideBubble();
prevWeekOpen.SetDefaultColor(GlobalColor("openColor"));
prevWeekOpen.hideBubble();
prevWeekClose.SetDefaultColor(GlobalColor("openColor"));
prevWeekClose.hideBubble();

AddChartBubble(showOpens and showWeeklyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], prevWeekOpen, if showValuesInBubbles then "Prev Weekly Open: " + prevWeekOpen else "Prev Week Open", GlobalColor("openColor"), yes);
AddChartBubble(showWeeklyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles],PrevWeekLow, if showValuesInBubbles then "Weekly Low: " + PrevWeekLow else "Prev Weekly Low", GlobalColor("lowColor"), no);
AddChartBubble(showWeeklyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], PrevWeekHigh, if showValuesInBubbles then "Weekly High: " + PrevWeekHigh else "Prev Weekly High", GlobalColor("highColor"), yes);
AddChartBubble(showOpens and showWeeklyBubbles and showBubblesLeft and thisWeek and !thisWeek[1], prevWeekOpen, if showValuesInBubbles then "Prev Weekly Open: " + prevWeekOpen else "Prev Week Open", GlobalColor("openColor"), yes);
AddChartBubble(showWeeklyBubbles and showBubblesLeft and thisWeek and !thisWeek[1],PrevWeekLow, if showValuesInBubbles then "Weekly Low: " + PrevWeekLow else "Prev Weekly Low", GlobalColor("lowColor"), no);
AddChartBubble(showWeeklyBubbles and showBubblesLeft and thisWeek and !thisWeek[1], PrevWeekHigh, if showValuesInBubbles then "Weekly High: " + PrevWeekHigh else "Prev Weekly High", GlobalColor("highColor"), yes);

# Monthly Levels
input showMonthly = yes;
def ThisMonth = GetLastMonth() == GetMonth();
def prevMoOpen = open("period"=addPeriod3)[1];
plot prevMonthOpen = if showMonthly and showOpens and ThisMonth then prevMoOpen else NAN;
def prevMoClose = close("period"=addPeriod3)[1];
plot prevMonthClose = if showMonthly and showOpens and ThisMonth then prevMoClose else NAN;
plot prevMonthLow = if showMonthly and ThisMonth then low("period"=addPeriod3)[1] else NAN;
plot prevMonthHigh = if showMonthly and ThisMonth then high("period"=addPeriod3)[1] else NAN;
prevMonthLow.SetDefaultColor(GlobalColor("lowColor"));
prevMonthLow.hideBubble();
prevMonthHigh.SetDefaultColor(GlobalColor("highColor"));
prevMonthHigh.hideBubble();
prevMonthOpen.SetDefaultColor(GlobalColor("openColor"));
prevMonthOpen.hideBubble();
prevMonthClose.SetDefaultColor(GlobalColor("openColor"));
prevMonthClose.hideBubble();

AddChartBubble(showMonthlyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], prevMonthOpen, if showValuesInBubbles then "Prev Monthly Open: " + prevMonthOpen else "Prev Monthly Open", GlobalColor("openColor"), yes);
AddChartBubble(showMonthlyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles],PrevMonthLow, if showValuesInBubbles then "Prev Monthly Low: " + PrevMonthLow else "Prev Monthly Low", GlobalColor("lowColor"), no);
AddChartBubble(showMonthlyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], PrevMonthHigh, if showValuesInBubbles then "Prev Monthly High: " + PrevMonthHigh else "Prev Monthly High", GlobalColor("highColor"), yes);

AddChartBubble(showMonthlyBubbles and showBubblesLeft and thisMonth and !thisMonth[1], prevMonthOpen, if showValuesInBubbles then "Prev Monthly Open: " + prevMonthOpen else "Prev Monthly Open", GlobalColor("openColor"), yes);
AddChartBubble(showMonthlyBubbles and showBubblesLeft and thisMonth and !thisMonth[1],PrevMonthLow, if showValuesInBubbles then "Prev Monthly Low: " + PrevMonthLow else "Prev Monthly Low", GlobalColor("lowColor"), no);
AddChartBubble(showMonthlyBubbles and showBubblesLeft and thisMonth and !thisMonth[1], PrevMonthHigh, if showValuesInBubbles then "Prev Monthly High: " + PrevMonthHigh else "Prev Monthly High", GlobalColor("highColor"), yes);




input showVertical = yes;
AddVerticalLine(showVertical and thisMonth and !thisMonth[1], " Month Start", GlobalColor("openColor"));
AddVerticalLine(showVertical and thisWeek and !thisWeek[1], " Week Start", GlobalColor("openColor"));

# monthly fibs
input showMonthlyFibs = yes;
input monthlyFibAmt = 0.618;
def monthlyFib1 = Round(PrevMonthLow + ((PrevMonthHigh - PrevMonthLow) * monthlyFibAmt),RoundLevel);
plot monthlyFib1Line = if showMonthly and showMonthlyFibs and thisMonth then monthlyFib1 else NAN;
monthlyFib1Line.setDefaultColor(GlobalColor("fibColor"));
monthlyFib1Line.hideBubble();
def monthlyFib2 = Round(PrevMonthHigh - ((PrevMonthHigh - PrevMonthLow) * monthlyFibAmt),RoundLevel);
plot monthlyFib2Line = if showMonthly and showMonthlyFibs and thisMonth then monthlyFib2 else NAN;
monthlyFib2Line.setDefaultColor(GlobalColor("fibColor"));
monthlyFib2Line.hideBubble();
def monthlyMid = Round(PrevMonthHigh - ((PrevMonthHigh - PrevMonthLow) /2),RoundLevel);
plot monthlyMidLine = if showMonthly and showMonthlyFibs and thisMonth then monthlyMid else NAN;
monthlyMidLine.setDefaultColor(GlobalColor("midColor"));
monthlyMidLine.hideBubble();

AddChartBubble(showMonthlyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], monthlyFib1, if showValuesInBubbles then "Monthly Fib 1: " + monthlyFib1 else "Monthly Fib 1", GlobalColor("fibColor"), no);
AddChartBubble(showMonthlyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], monthlyFib2, if showValuesInBubbles then "Monthly Fib 2: " + monthlyFib2 else "Monthly Fib 2", GlobalColor("fibColor"), no);
AddChartBubble(showMonthlyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], monthlyMid, if showValuesInBubbles then "Monthly Mid: " + monthlyMid else "Monthly Mid", GlobalColor("midColor"), no);

AddChartBubble(showMonthlyBubbles and showBubblesLeft and thisMonth and !thisMonth[1], monthlyFib1, if showValuesInBubbles then "Monthly Fib 1: " + monthlyFib1 else "Monthly Fib 1", GlobalColor("fibColor"), no);
AddChartBubble(showMonthlyBubbles and showBubblesLeft and thisMonth and !thisMonth[1],monthlyFib2, if showValuesInBubbles then "Monthly Fib 2: " + monthlyFib2 else "Monthly Fib 2", GlobalColor("fibColor"), no);
AddChartBubble(showMonthlyBubbles and showBubblesLeft and thisMonth and !thisMonth[1], monthlyMid, if showValuesInBubbles then "Monthly Mid: " + monthlyMid else "Monthly Mid", GlobalColor("midColor"), no);

# weekly fibs
input showWeeklyFibs = yes;
input weeklyFibAmt = 0.618;
def weeklyFib1 = Round(PrevWeekLow + ((PrevWeekHigh - PrevWeekLow) * weeklyFibAmt),RoundLevel);
plot weeklyFib1Line = if showWeeklyFibs and thisWeek then weeklyFib1 else NAN;
weeklyFib1Line.setDefaultColor(GlobalColor("fibColor"));
weeklyFib1Line.hideBubble();
def weeklyFib2 = Round(PrevWeekHigh - ((PrevWeekHigh - PrevWeekLow) * weeklyFibAmt),RoundLevel);
plot weeklyFib2Line = if showWeeklyFibs and thisWeek then weeklyFib2 else NAN;
weeklyFib2Line.setDefaultColor(GlobalColor("fibColor"));
weeklyFib2Line.hideBubble();
def weeklyMid = Round(PrevWeekHigh - ((PrevWeekHigh - PrevWeekLow) /2),RoundLevel);
plot weeklyMidLine = if showWeeklyFibs and thisWeek then weeklyMid else NAN;
weeklyMidLine.setDefaultColor(GlobalColor("midColor"));
weeklyMidLine.hideBubble();

AddChartBubble(showweeklyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], weeklyFib1, if showValuesInBubbles then "weekly Fib 1: " + weeklyFib1 else "weekly Fib 1", GlobalColor("fibColor"), no);
AddChartBubble(showweeklyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], weeklyFib2, if showValuesInBubbles then "weekly Fib 2: " + weeklyFib2 else "weekly Fib 2", GlobalColor("fibColor"), no);
AddChartBubble(showweeklyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], weeklyMid, if showValuesInBubbles then "weekly Mid: " + weeklyMid else "weekly Mid", GlobalColor("midColor"), no);

AddChartBubble(showweeklyBubbles and showBubblesLeft and thisWeek and !thisWeek[1], weeklyFib1, if showValuesInBubbles then "weekly Fib 1: " + weeklyFib1 else "weekly Fib 1", GlobalColor("fibColor"), no);
AddChartBubble(showweeklyBubbles and showBubblesLeft and thisWeek and !thisWeek[1],weeklyFib2, if showValuesInBubbles then "weekly Fib 2: " + weeklyFib2 else "weekly Fib 2", GlobalColor("fibColor"), no);
AddChartBubble(showweeklyBubbles and showBubblesLeft and thisWeek and !thisWeek[1], weeklyMid, if showValuesInBubbles then "weekly Mid: " + weeklyFib1 else "weekly Mid", GlobalColor("midColor"), no);
@FutureTony : Can you share some ideas on how to trade using this Fib confluences?
 
@FutureTony : Can you share some ideas on how to trade using this Fib confluences?
How to scalp using Fibonacci is beyond the scope of this particular thread.

A quick synopsis:
The most popular Fibonacci Retracements are 61.8% and 38.2%. Note that 38.2% is often rounded to 38% and 61.8 is rounded to 62%. After an advance, chartists apply Fibonacci ratios to define retracement levels and forecast the extent of a correction or pullback.
Google search:
https://www.google.com/search?q=sca...7j0i22i30.16962j0j15&sourceid=chrome&ie=UTF-8
 
Hi @FutureTony ,
I have been trying to get this to work, but I can't get the Weekly or Monthly Fib labels to turn off. Also, the previous Monthly High/Low is showing as the current monthly High/Low. Could you or someone fix? I have tried the other versions out there, but they don't don't do what I want either, yours comes closest. If helpful, all I am looking for is the Previous Weekly High/Low, and Previous Monthly High/Low. I have the daily's covered with other scripts (current day and previous day). Note, that I am trading ES futures, and so they have to "see" after regular trading hours too. Below is the Indicator I use in TradingView written by goofoffgoose:

Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at [URL]https://mozilla.org/MPL/2.0/[/URL]
// © goofoffgoose
//@version=5

//This is a requested spin-off version of my previous HLOC for the Daily/Weekly/Monthly that allows users to choose 3 different
// timeframe units (Mins, Hours, Days, ect..) from the dropdown menu and then select the lookback periord in which to draw the HLOC.
//
// This indicator draws a line on the TF 1, TF 2, and TF 3 bar at the High, Low, Open and Close of user input Timeframe unit and selected lookback period.
// The lookback period will go back the number of candles entered. So for example if you choose a 5 Min chart with a lookback of 3, the lines will be drawn on
// the HLOC 3 closed 5 min candles back. Selecting 0 will show data on the current Real-Time candle.

// Each set of lines has an optional identifying label with its own color set that can be shown with or without
//      price value, and has drop down menues for size and style of each set of labels. The TF unit value is displayed on the label, but not the lookback.
// So if you are using the hourly on all 3 TF's with different lookback periods, they will all say "60" on the label.
// I recommend using the line and label options to distinguish between the different lookback values.

// Each set of lines has inputs for line/text color, line width and style and each line arguement can be selected independently.

// I recommend going into Chart Settings/Status Line and turning off indicator arguments OR moving the script to the top
//      of the indicator list to avoid obstructed chart view with this indicators arguments. When script allows, I will update it to hide them.


indicator("Multi TF High/Low/Open/Close Line", shorttitle= "Muti TF HLOC", overlay=true)

t = ticker.new(syminfo.prefix, syminfo.ticker)
///////// Label input options and colors //////////

////// TF 1 line and label options ////

// Show Lines and TF
show_dhloc = input.bool(defval=true, title=" Show Timeframe 1 Lines?", group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Line")
tf_1 = input.timeframe('60', title="Timeframe 1 - ", group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1")
tf_1_m = input.int(1, title="  TF Lookback - ", tooltip="Input the number of TF units selected in the drop-down menu you want to lookback. 0 is current candle where 1 and higher will lookback. Example: You select 1 hour in the drop-down menu with a lookback number of 2, lines will be drawn on hourly data from 2 candles back",
 group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1")

// Line style and size
dLineWidth = input.int(1, title="Line Width -  ", minval=1, group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Line Style")

dLineStyleOption = input.string(defval="solid (─)",title="  Line Style -  ",
     options=["solid (─)", "dotted (┈)", "dashed (╌)",
     "arrow left (←)", "arrow right (→)", "arrows both (↔)"],
     group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Line Style")

dLineStyle = (dLineStyleOption == "dotted (┈)") ? line.style_dotted :
     (dLineStyleOption == "dashed (╌)") ? line.style_dashed :
     (dLineStyleOption == "arrow left (←)") ? line.style_arrow_left :
     (dLineStyleOption == "arrow right (→)") ? line.style_arrow_right :
     (dLineStyleOption == "arrows both (↔)") ? line.style_arrow_both :
         line.style_solid

// Show Lines and colors
show_dh = input.bool(defval=true, title="-", group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")
dhcolor = input(color.rgb(133, 245, 86, 30), title="High ", group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")

show_dl = input.bool(defval=true, title="-",  group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")
dlcolor = input(color.rgb(246, 135, 135, 30), title="Low ",  group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")

show_do = input.bool(defval=true, title="-",  group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")
docolor = input(color.rgb(120, 167, 241, 30), title="Open ",  group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")

show_dc = input.bool(defval=true, title="-",  group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")
dccolor = input(color.rgb(246, 221, 96, 30), title="Close ", group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")




// TF 1 label options

// Show labels and colors
show_dhlocLabel = input(defval=true, title="Show Timeframe 1 Labels?   ", group="Timeframe 1 Label Options", inline="TF 1")
show_dVal = input.bool(defval=true, title="Show Timeframe 1 Line Value?   ", group="Timeframe 1 Label Options", inline="TF 1")

dLblHOffset = input.int(0, title="Horizontal Offset - ", group="Timeframe 1 Label Options", inline="TF 1 offsets")
dLblVOffset = input(.05, title=" Vertical Offset - ", group="Timeframe 1 Label Options", inline="TF 1 offsets")

//  Size and style drop down
dSizeOption = input.string(defval="Normal", title="Label Size -    ", options = ["Auto","Huge","Large","Normal","Small","Tiny"], group="Timeframe 1 Label Options", inline="TF 1 options")
dStyleOption = input.string(title="  Label Style - ", options=["Triangle up (▲)", "Triangle down (▼)",
         "Label up (⬆)", "Label down (⬇)", "Plus (+)", "Text Outline", "None"], defval="Text Outline", group="Timeframe 1 Label Options", inline="TF 1 options")
  

dLabelStyle = (dStyleOption == "Triangle up (▲)") ? label.style_triangleup :
     (dStyleOption == "Triangle down (▼)") ? label.style_triangledown :
     (dStyleOption == "Label up (⬆)") ? label.style_label_up :
     (dStyleOption == "Label down (⬇)") ? label.style_label_down :
     (dStyleOption == "Plus (+)") ? label.style_cross:
     (dStyleOption == "Text Outline") ? label.style_text_outline:
     (dStyleOption == "None") ? label.style_none :
         label.style_label_down
      
dLabelSize = (dSizeOption == "Huge") ? size.huge :
     (dSizeOption == "Large") ? size.large :
     (dSizeOption == "Small") ? size.small :
     (dSizeOption == "Tiny") ? size.tiny :
     (dSizeOption == "Auto") ? size.auto :
         size.normal

dHighLblClr = input(color.rgb(00,153,00,80), title= "High Color ", group="Timeframe 1 Label Options", inline="TF 1 label colors")
dLowLblClr = input(color.rgb(204,00,00,80), title= "Low Color ", group="Timeframe 1 Label Options", inline="TF 1 label colors")
dOpenLblClr = input(color.rgb(00,102,204,80), title= "Open Color ", group="Timeframe 1 Label Options", inline="TF 1 label colors")
dCloseLblClr = input(color.rgb(255,153,51,80), title= "Close Color ", group="Timeframe 1 Label Options", inline="TF 1 label colors")


      


////// TF 2 line and label options ////

// Show Lines and colors
show_whloc = input.bool(defval=true, title=" Show Timeframe 2 Line?", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Line")
tf_2 = input.timeframe('D', title="Timeframe 2 - ", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2")
tf_2_m = input.int(1, title="  TF Lookback - ", tooltip="Input the number of TF units selected in the drop-down menu you want to lookback. 0 is current candle where 1 and higher will lookback. Example: You select 1 hour in the drop-down menu with a lookback number of 2, lines will be drawn on hourly data from 2 candles back",
 group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2")

// Line style and size
wLineWidth = input.int(1, title="Line Width -  ", minval=1, group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Line Style")

wLineStyleOption = input.string(defval="solid (─)",title="  Line Style -  ",
     options=["solid (─)", "dotted (┈)", "dashed (╌)",
     "arrow left (←)", "arrow right (→)", "arrows both (↔)"],
     group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Line Style")

wLineStyle = (wLineStyleOption == "dotted (┈)") ? line.style_dotted :
     (wLineStyleOption == "dashed (╌)") ? line.style_dashed :
     (wLineStyleOption == "arrow left (←)") ? line.style_arrow_left :
     (wLineStyleOption == "arrow right (→)") ? line.style_arrow_right :
     (wLineStyleOption == "arrows both (↔)") ? line.style_arrow_both :
         line.style_solid




show_wh = input.bool(defval=true, title="-", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")
whcolor = input(color.rgb(133, 245, 86, 30), title="High ", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")

show_wl = input.bool(defval=true, title="-", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")
wlcolor = input(color.rgb(246, 135, 135, 30), title="Low ", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")

show_wo = input.bool(defval=true, title="-", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")
wocolor = input(color.rgb(120, 167, 241, 30), title="Open ", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")

show_wc = input.bool(defval=true, title="-", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")
wccolor = input(color.rgb(246, 221, 96, 30), title="Close ", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")


// TF 2 label options

// Show labels and colors
show_whlocLabel = input(defval=true, title="Show Timeframe 2 Labels?   ", group="Timeframe 2 Label Options", inline="TF 2")
show_wVal = input.bool(defval=true, title="Show Timeframe 2 Line Value?   ", group="Timeframe 2 Label Options", inline="TF 2")

wLblHOffset = input.int(0, title="Horizontal Offset - ", group="Timeframe 2 Label Options", inline="TF 2 offsets")
wLblVOffset = input(.05, title=" Vertical Offset - ",    group="Timeframe 2 Label Options", inline="TF 2 offsets")

//  Size and style drop down
wSizeOption = input.string(defval="Normal", title="Label Size -    ", options = ["Auto","Huge","Large","Normal","Small","Tiny"], group="Timeframe 2 Label Options", inline="TF 2 options")
wStyleOption = input.string(title="  Label Style - ", options=["Triangle up (▲)", "Triangle down (▼)",
         "Label up (⬆)", "Label down (⬇)", "Plus (+)", "Text Outline", "None"], defval="Text Outline", group="Timeframe 2 Label Options", inline= "TF 2 options")
  

wLabelStyle = (wStyleOption == "Triangle up (▲)") ? label.style_triangleup :
     (wStyleOption == "Triangle down (▼)") ? label.style_triangledown :
     (wStyleOption == "Label up (⬆)") ? label.style_label_up :
     (wStyleOption == "Label down (⬇)") ? label.style_label_down :
     (wStyleOption == "Plus (+)") ? label.style_cross:
     (wStyleOption == "Text Outline") ? label.style_text_outline:
     (wStyleOption == "None") ? label.style_none :
         label.style_label_down
      
wLabelSize = (wSizeOption == "Huge") ? size.huge :
     (wSizeOption == "Large") ? size.large :
     (wSizeOption == "Small") ? size.small :
     (wSizeOption == "Tiny") ? size.tiny :
     (wSizeOption == "Auto") ? size.auto :
         size.normal


wHighLblClr =  input(color.rgb(00,153,00,80),  title= "High Color ",  group="Timeframe 2 Label Options", inline="weekly label colors")
wLowLblClr =   input(color.rgb(204,00,00,80),  title= "Low Color ",   group="Timeframe 2 Label Options", inline="weekly label colors")
wOpenLblClr =  input(color.rgb(00,102,204,80), title= "Open Color ",  group="Timeframe 2 Label Options", inline="weekly label colors")
wCloseLblClr = input(color.rgb(255,153,51,80), title= "Close Color ", group="Timeframe 2 Label Options", inline="weekly label colors")



////// TF 3 line and label options ////

// Show Lines and colors
show_mhloc = input.bool(defval=true, title=" Show Timeframe 3 Line?", group="Timeframe 3 High, Low, Open and Close Lines", inline="TF 3 Line")

tf_3 = input.timeframe('W', title="Timeframe 3 - ", group="Timeframe 3 High, Low, Open and Close Lines", inline="TF 3")
tf_3_m = input.int(1, title="  TF Lookback - ", tooltip="Input the number of TF units selected in the drop-down menu you want to lookback. 0 is current candle where 1 and higher will lookback. Example: You select 1 hour in the drop-down menu with a lookback number of 2, lines will be drawn on hourly data from 2 candles back",
 group="Timeframe 3 High, Low, Open and Close Lines", inline="TF 3")


// Line style and size
mLineWidth = input.int(1, title="Line Width -  ", minval=1, group="Timeframe 3 High, Low, Open and Close Lines", inline="TF 3 Line Style")

mLineStyleOption = input.string(defval="solid (─)",title="  Line Style -  ",
     options=["solid (─)", "dotted (┈)", "dashed (╌)",
     "arrow left (←)", "arrow right (→)", "arrows both (↔)"],
      group="Timeframe 3 High, Low, Open and Close Lines", inline="TF 3 Line Style")

mLineStyle = (mLineStyleOption == "dotted (┈)") ? line.style_dotted :
     (mLineStyleOption == "dashed (╌)") ? line.style_dashed :
     (mLineStyleOption == "arrow left (←)") ? line.style_arrow_left :
     (mLineStyleOption == "arrow right (→)") ? line.style_arrow_right :
     (mLineStyleOption == "arrows both (↔)") ? line.style_arrow_both :
         line.style_solid


show_mh = input.bool(defval=true, title="-", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")
mhcolor = input(color.rgb(133, 245, 86, 30), title="High ", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")

show_ml = input.bool(defval=true, title="-", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")
mlcolor = input(color.rgb(246, 135, 135, 30), title="Low ", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")

show_mo = input.bool(defval=true, title="-", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")
mocolor = input(color.rgb(120, 167, 241, 30), title="Open ", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")

show_mc = input.bool(defval=true, title="-", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")
mccolor = input(color.rgb(246, 221, 96, 30), title="Close ", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")


// TF 3 label options

// Show labels and colors
show_mhlocLabel = input(defval=true, title="Show Timeframe 3 Labels?   ",    group="Timeframe 3 Label Options", inline="TF 3")
show_mVal = input.bool(defval=true, title="Show Timeframe 3 Line Value?   ", group="Timeframe 3 Label Options", inline="TF 3")

mLblHOffset = input.int(0, title="Horizontal Offset - ", group="Timeframe 3 Label Options", inline="TF 3 offsets")
mLblVOffset = input(.05, title="Vertical Offset - ", group="Timeframe 3 Label Options", inline="TF 3 offsets")

//  Size and style drop down
mSizeOption = input.string(defval="Normal", title="Label Size -    ", options = ["Auto","Huge","Large","Normal","Small","Tiny"], group="Timeframe 3 Label Options", inline="TF 3 Options")
mStyleOption = input.string(title="  Label Style - ", options=["Triangle up (▲)", "Triangle down (▼)",
         "Label up (⬆)", "Label down (⬇)", "Plus (+)", "Text Outline", "None"], defval="Text Outline",group="Timeframe 3 Label Options",  inline="TF 3 Options")
  

mLabelStyle = (mStyleOption == "Triangle up (▲)") ? label.style_triangleup :
     (mStyleOption == "Triangle down (▼)") ? label.style_triangledown :
     (mStyleOption == "Label up (⬆)") ? label.style_label_up :
     (mStyleOption == "Label down (⬇)") ? label.style_label_down :
     (mStyleOption == "Plus (+)") ? label.style_cross:
     (mStyleOption == "Text Outline") ? label.style_text_outline:
     (mStyleOption == "None") ? label.style_none :
         label.style_label_down
      
mLabelSize = (mSizeOption == "Huge") ? size.huge :
     (mSizeOption == "Large") ? size.large :
     (mSizeOption == "Small") ? size.small :
     (mSizeOption == "Tiny") ? size.tiny :
     (mSizeOption == "Auto") ? size.auto :
         size.normal
      
 

mHighLblClr =  input(color.rgb(00,153,00,80),  title= "High Color ",  group="Timeframe 3 Label Options", inline="TF 3 label colors")
mLowLblClr =   input(color.rgb(204,00,00,80),  title= "Low Color ",   group="Timeframe 3 Label Options", inline="TF 3 label colors")
mOpenLblClr =  input(color.rgb(00,102,204,80), title= "Open Color ",  group="Timeframe 3 Label Options", inline="TF 3 label colors")
mCloseLblClr = input(color.rgb(255,153,51,80), title= "Close Color ", group="Timeframe 3 Label Options", inline="TF 3 label colors")


 
////////HLOC Lines and Label Plots///////


// TF 1 HLOC
// Call TF 1 data

dhigh  = request.security(t, tf_1, high[tf_1_m])
dlow   = request.security(t, tf_1, low[tf_1_m])
dopen  = request.security(t, tf_1, open[tf_1_m])
dclose = request.security(t, tf_1, close[tf_1_m])



// Line Conditions

if (show_dhloc)
    if (show_dh)
        dh_line = line.new(x1=bar_index-1, y1=dhigh, color=dhcolor, x2=bar_index, y2=dhigh, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(dh_line[1])
    if (show_dl)
        dl_line = line.new(x1=bar_index-1, y1=dlow, color=dlcolor, x2=bar_index, y2=dlow, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(dl_line[1])
    if (show_do)
        do_line = line.new(x1=bar_index-1, y1=dopen, color=docolor, x2=bar_index, y2=dopen, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(do_line[1])
    if (show_dc)
        dc_line = line.new(x1=bar_index-1, y1=dclose, color=dccolor, x2=bar_index, y2=dclose, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(dc_line[1])


// TF 1 Labels //

// Label Value String

dHigh = str.tostring(dhigh, format.mintick)
dhValNa = " "
string dhVal =  if show_dVal
    dHigh
else
    dhValNa
 
dLow = str.tostring(dlow, format.mintick)
dlValNa = " "
string dlVal =  if show_dVal
    dLow
else
    dlValNa
 
dOpen = str.tostring(dopen, format.mintick)
doValNa = " "
string doVal =  if show_dVal
    dOpen
else
    doValNa
 
dClose = str.tostring(dclose, format.mintick)
dcValNa = " "
string dcVal =  if show_dVal
    dClose
else
    dcValNa


// Label Conditions

if (show_dhlocLabel) and (show_dhloc)
    if (show_dh)
        dHighLabel = label.new(x=bar_index-1, y=dhigh, xloc=xloc.bar_index[0],
          color=(dHighLblClr), textcolor=dhcolor,
          style=dLabelStyle)
        label.set_text(id=dHighLabel, text= str.tostring(tf_1) + " High " + str.tostring(dhVal))
        label.set_size(dHighLabel,dLabelSize)
        label.set_y(dHighLabel, dhigh + dLblVOffset)
        label.set_x(dHighLabel, label.get_x(dHighLabel) + dLblHOffset)
        label.delete(dHighLabel[1])
    if (show_dl)
        dlowLabel = label.new(x=bar_index-1, y=dlow, xloc=xloc.bar_index[0],
          color=(dLowLblClr), textcolor=dlcolor,
          style=dLabelStyle)
        label.set_text(id=dlowLabel, text=str.tostring(tf_1) + " Low " + str.tostring(dlVal))
        label.set_size(dlowLabel,dLabelSize)
        label.set_y(dlowLabel, dlow - dLblVOffset)
        label.set_x(dlowLabel, label.get_x(dlowLabel) + dLblHOffset)
        label.delete(dlowLabel[1])
    if (show_do)
        dopenLabel = label.new(x=bar_index-1, y=dopen, xloc=xloc.bar_index[0],
          color=(dOpenLblClr), textcolor=docolor,
          style=dLabelStyle)
        label.set_text(id=dopenLabel, text=str.tostring(tf_1) + " Open " + str.tostring(doVal))
        label.set_size(dopenLabel,dLabelSize)
        label.set_y(dopenLabel, dopen + dLblVOffset)
        label.set_x(dopenLabel, label.get_x(dopenLabel) + dLblHOffset)
        label.delete(dopenLabel[1])
    if (show_dc)
        dcloseLabel = label.new(x=bar_index-1, y=dclose, xloc=xloc.bar_index[0],
          color=(dCloseLblClr), textcolor=dccolor,
          style=dLabelStyle)
        label.set_text(id=dcloseLabel, text=str.tostring(tf_1) + " Close " + str.tostring(dcVal))
        label.set_size(dcloseLabel,dLabelSize)
        label.set_y(dcloseLabel, dclose - dLblVOffset)
        label.set_x(dcloseLabel, label.get_x(dcloseLabel) + dLblHOffset)
        label.delete(dcloseLabel[1])

 
 
// TF 2 HLOC

// Call weekly data
whigh  = request.security(t, tf_2,  high[tf_2_m])
wlow   = request.security(t, tf_2,   low[tf_2_m])
wopen  = request.security(t, tf_2,  open[tf_2_m])
wclose = request.security(t, tf_2, close[tf_2_m])



// Line Condition

if (show_whloc)
    if (show_wh)
        wh_line = line.new(x1=bar_index-1, y1=whigh, color=whcolor, x2=bar_index, y2=whigh, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth , extend=extend.both)
        line.delete(wh_line[1])
    if (show_wl)
        wl_line = line.new(x1=bar_index-1, y1=wlow, color=wlcolor, x2=bar_index, y2=wlow, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth  , extend=extend.both)
        line.delete(wl_line[1])
    if (show_wo)
        wo_line = line.new(x1=bar_index-1, y1=wopen, color=wocolor, x2=bar_index, y2=wopen, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth , extend=extend.both)
        line.delete(wo_line[1])
    if (show_wc)
        wc_line = line.new(x1=bar_index-1, y1=wclose, color=wccolor, x2=bar_index, y2=wclose, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth , extend=extend.both)
        line.delete(wc_line[1])
 
 
// TF 2 Labels//

// Label Value String

wHigh = str.tostring(whigh, format.mintick)
whValNa = " "
string whVal =  if show_wVal
    wHigh
else
    whValNa
 
wLow = str.tostring(wlow, format.mintick)
wlValNa = " "
string wlVal =  if show_wVal
    wLow
else
    wlValNa
 
wOpen = str.tostring(wopen, format.mintick)
woValNa = " "
string woVal =  if show_wVal
    wOpen
else
    woValNa
 
wClose = str.tostring(wclose, format.mintick)
wcValNa = " "
string wcVal =  if show_wVal
    wClose
else
    wcValNa
 

// Label Conditions
 
if (show_whlocLabel) and (show_whloc)

    if (show_wh)
        wHighLabel = label.new(x=bar_index-1, y=whigh, xloc=xloc.bar_index[0],
          color=(wHighLblClr), textcolor=whcolor,
          style=wLabelStyle)
        label.set_text(id=wHighLabel, text=str.tostring(tf_2) + " High " + str.tostring(whVal))
        label.set_size(wHighLabel,wLabelSize)
        label.set_y(wHighLabel, whigh + wLblVOffset)
        label.set_x(wHighLabel, label.get_x(wHighLabel) + wLblHOffset)
        label.delete(wHighLabel[1])
    if (show_wl)
        wlowLabel = label.new(x=bar_index-1, y=wlow, xloc=xloc.bar_index[0],
          color=(wLowLblClr), textcolor=wlcolor,
          style=wLabelStyle)
        label.set_text(id=wlowLabel, text=str.tostring(tf_2) + " Low " + str.tostring(wlVal))
        label.set_size(wlowLabel,wLabelSize)
        label.set_y(wlowLabel, wlow - wLblVOffset)
        label.set_x(wlowLabel, label.get_x(wlowLabel) + wLblHOffset)
        label.delete(wlowLabel[1])
    if (show_wo)
        wopenLabel = label.new(x=bar_index-1, y=wopen, xloc=xloc.bar_index[0],
          color=(wOpenLblClr), textcolor=wocolor,
          style=wLabelStyle)
        label.set_text(id=wopenLabel, text=str.tostring(tf_2) + " Open " + str.tostring(woVal))
        label.set_size(wopenLabel,wLabelSize)
        label.set_y(wopenLabel, wopen + wLblVOffset)
        label.set_x(wopenLabel, label.get_x(wopenLabel) + wLblHOffset)
        label.delete(wopenLabel[1])
    if (show_wc)
        wcloseLabel = label.new(x=bar_index-1, y=wclose, xloc=xloc.bar_index[0],
          color=(wCloseLblClr), textcolor=wccolor,
          style=wLabelStyle)
        label.set_text(id=wcloseLabel, text=str.tostring(tf_2) + " Close " + str.tostring(wcVal))
        label.set_size(wcloseLabel,wLabelSize)
        label.set_y(wcloseLabel, wclose - wLblVOffset)
        label.set_x(wcloseLabel, label.get_x(wcloseLabel) + wLblHOffset)
        label.delete(wcloseLabel[1])
 

// TF 3 HLOC  //

// Call TF 3 data
mhigh  = request.security(t, tf_3,  high[tf_3_m])
mlow   = request.security(t, tf_3,   low[tf_3_m])
mopen  = request.security(t, tf_3,  open[tf_3_m])
mclose = request.security(t, tf_3, close[tf_3_m])





// Line Condition
if (show_mhloc)
    if (show_mh)
        mh_line = line.new(x1=bar_index-1, y1=mhigh, color=mhcolor, x2=bar_index, y2=mhigh, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(mh_line[1])
    if (show_ml)
        ml_line = line.new(x1=bar_index-1, y1=mlow, color=mlcolor, x2=bar_index, y2=mlow, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(ml_line[1])
    if (show_mo)
        mo_line = line.new(x1=bar_index-1, y1=mopen, color=mocolor, x2=bar_index, y2=mopen, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(mo_line[1])
    if (show_mc)
        mc_line = line.new(x1=bar_index-1, y1=mclose, color=mccolor, x2=bar_index, y2=mclose, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(mc_line[1])


// TF 3 Labels //

// Label Value String

mHigh = str.tostring(mhigh, format.mintick)
mhValNa = " "
string mhVal =  if show_mVal
    mHigh
else
    mhValNa
 
mLow = str.tostring(mlow, format.mintick)
mlValNa = " "
string mlVal =  if show_mVal
    mLow
else
    mlValNa
 
mOpen = str.tostring(mopen, format.mintick)
moValNa = " "
string moVal =  if show_mVal
    mOpen
else
    moValNa
 
mClose = str.tostring(mclose, format.mintick)
mcValNa = " "
string mcVal =  if show_mVal
    mClose
else
    mcValNa



// Label Condition
 
if (show_mhlocLabel) and (show_mhloc)
    if (show_mh)
        mHighLabel = label.new(x=bar_index-1, y=mhigh, xloc=xloc.bar_index[0],
          color=(mHighLblClr), textcolor=mhcolor,
          style=mLabelStyle)
        label.set_text(id=mHighLabel, text=str.tostring(tf_3) +" High " + str.tostring(mhVal))
        label.set_size(mHighLabel,mLabelSize)
        label.set_y(mHighLabel, mhigh + mLblVOffset)
        label.set_x(mHighLabel, label.get_x(mHighLabel) + mLblHOffset)
        label.delete(mHighLabel[1])
    if (show_ml)
        mlowLabel = label.new(x=bar_index-1, y=mlow, xloc=xloc.bar_index[0],
          color=(mLowLblClr), textcolor=mlcolor,
          style=mLabelStyle)
        label.set_text(id=mlowLabel, text=str.tostring(tf_3) + " Low " + str.tostring(mlVal))
        label.set_size(mlowLabel,mLabelSize)
        label.set_y(mlowLabel, mlow - mLblVOffset)
        label.set_x(mlowLabel, label.get_x(mlowLabel) + mLblHOffset)
        label.delete(mlowLabel[1])
    if (show_mo)
        mopenLabel = label.new(x=bar_index-1, y=mopen, xloc=xloc.bar_index[0],
          color=(mOpenLblClr), textcolor=mocolor,
          style=mLabelStyle)
        label.set_text(id=mopenLabel, text=str.tostring(tf_3) + " Open " + str.tostring(moVal))
        label.set_size(mopenLabel,mLabelSize)
        label.set_y(mopenLabel, mopen + mLblVOffset)
        label.set_x(mopenLabel, label.get_x(mopenLabel) + mLblHOffset)
        label.delete(mopenLabel[1])
    if (show_mc)
        mcloseLabel = label.new(x=bar_index-1, y=mclose, xloc=xloc.bar_index[0],
          color=(mCloseLblClr), textcolor=mccolor,
          style=mLabelStyle)
        label.set_text(id=mcloseLabel, text=str.tostring(tf_3) + " Close " + str.tostring(mcVal))
        label.set_size(mcloseLabel,mLabelSize)
        label.set_y(mcloseLabel, mclose - mLblVOffset)
        label.set_x(mcloseLabel, label.get_x(mcloseLabel)  + mLblHOffset)
        label.delete(mcloseLabel[1])


For completeness, I am including an earlier version of goofoffgoose's code as well:

Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at [URL]https://mozilla.org/MPL/2.0/[/URL]
// © goofoffgoose
//@version=5

// For My pal Jittery
//
// This indicator draws a line on the Daily, Weekly, and Monthly bar at the High, Low, Open and Close of each bar as price
//      tends to react when revisiting these areas.
// Each set of bars has an optional identifying label with its own color set that can be shown with or without the lines
//      price value, and has drop down menues for size and style of each set of labels.
// Each set of lines has inputs for line/text color, line width and style.
// I recommend going into Chart Settings/Status Line and turning off indicator arguments OR moving the script to the top
//      of the indicator list to avoid obstructed chart view with this indicators arguments. When script allows, I will update it to hide them.
//New and Improved menu with vertical and horizontal offsets

indicator("High/Low/Open/Close Daily, Weekly, Monthly Line", shorttitle= "D/W/M HLOC", overlay=true)

t = ticker.new(syminfo.prefix, syminfo.ticker)
///////// Label input options and colors //////////

////// Daily line and label options ////

// Show Lines and colors
show_dhloc = input.bool(defval=true, title="Show Daily Lines?", group="Daily High, Low, Open and Close Lines", inline="Daily Line")

show_dh = input.bool(defval=true, title="-", group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")
dhcolor = input(color.rgb(133, 245, 86, 30), title="High", group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")

show_dl = input.bool(defval=true, title="-",  group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")
dlcolor = input(color.rgb(246, 135, 135, 30), title="Low",  group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")

show_do = input.bool(defval=true, title="-",  group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")
docolor = input(color.rgb(120, 167, 241, 30), title="Open",  group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")

show_dc = input.bool(defval=true, title="-",  group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")
dccolor = input(color.rgb(246, 221, 96, 30), title="Close", group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")

// Line style and size
dLineWidth = input.int(1, title="Line Width -  ", minval=1, group="Daily High, Low, Open and Close Lines", inline="Daily Line Style")

dLineStyleOption = input.string(defval="solid (─)",title="  Line Style - ",
     options=["solid (─)", "dotted (┈)", "dashed (╌)",
     "arrow left (←)", "arrow right (→)", "arrows both (↔)"],
     group="Daily High, Low, Open and Close Lines", inline="Daily Line Style")

dLineStyle = (dLineStyleOption == "dotted (┈)") ? line.style_dotted :
     (dLineStyleOption == "dashed (╌)") ? line.style_dashed :
     (dLineStyleOption == "arrow left (←)") ? line.style_arrow_left :
     (dLineStyleOption == "arrow right (→)") ? line.style_arrow_right :
     (dLineStyleOption == "arrows both (↔)") ? line.style_arrow_both :
         line.style_solid


// Daily label options

// Show labels and colors
show_dhlocLabel = input(defval=true, title="Show Daily Labels?", group="Daily Label Options", inline="Daily")
show_dVal = input.bool(defval=true, title="Show Daily Line Value?", group="Daily Label Options", inline="Daily")


dHighLblClr = input(color.rgb(00,153,00,80), title= "High Color", inline="daily label colors")
dLowLblClr = input(color.rgb(204,00,00,80), title= "Low Color", inline="daily label colors")
dOpenLblClr = input(color.rgb(00,102,204,80), title= "Open Color", inline="daily label colors")
dCloseLblClr = input(color.rgb(255,153,51,80), title= "Close Color", inline="daily label colors")

//  Size and style drop down
dSizeOption = input.string(defval="Normal", title="Label Size -  ", options = ["Auto","Huge","Large","Normal","Small","Tiny"], inline="Daily options")
dStyleOption = input.string(title="   Label Style -", options=["Triangle up (▲)", "Triangle down (▼)",
         "Label up (⬆)", "Label down (⬇)", "Plus (+)", "Text Outline", "None"], defval="Text Outline", inline="Daily options")
   

dLabelStyle = (dStyleOption == "Triangle up (▲)") ? label.style_triangleup :
     (dStyleOption == "Triangle down (▼)") ? label.style_triangledown :
     (dStyleOption == "Label up (⬆)") ? label.style_label_up :
     (dStyleOption == "Label down (⬇)") ? label.style_label_down :
     (dStyleOption == "Plus (+)") ? label.style_cross:
     (dStyleOption == "Text Outline") ? label.style_text_outline:
     (dStyleOption == "None") ? label.style_none :
         label.style_label_down
       
dLabelSize = (dSizeOption == "Huge") ? size.huge :
     (dSizeOption == "Large") ? size.large :
     (dSizeOption == "Small") ? size.small :
     (dSizeOption == "Tiny") ? size.tiny :
     (dSizeOption == "Auto") ? size.auto :
         size.normal
       
dLblHOffset = input.int(20, title="Horizontal Offset  ",    inline="Daily offsets")
dLblVOffset = input(3.05,   title=  " Vertical Offset ",    inline="Daily offsets")


////// Weekly line and label options ////

// Show Lines and colors
show_whloc = input.bool(defval=true, title="Show Weekly Lines?", group="Weekly High, Low, Open and Close Lines", inline="Weekly Line")

show_wh = input.bool(defval=true, title="-", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")
whcolor = input(color.rgb(133, 245, 86, 30), title="High", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")

show_wl = input.bool(defval=true, title="-", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")
wlcolor = input(color.rgb(246, 135, 135, 30), title="Low", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")

show_wo = input.bool(defval=true, title="-", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")
wocolor = input(color.rgb(120, 167, 241, 30), title="Open", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")

show_wc = input.bool(defval=true, title="-", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")
wccolor = input(color.rgb(246, 221, 96, 30), title="Close", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")

// Line style and size
wLineWidth = input.int(1, title="Line Width -  ", minval=1, group="Weekly High, Low, Open and Close Lines", inline="Weekly Line Style")

wLineStyleOption = input.string(defval="solid (─)",title="  Line Style - ",
     options=["solid (─)", "dotted (┈)", "dashed (╌)",
     "arrow left (←)", "arrow right (→)", "arrows both (↔)"],
     group="Weekly High, Low, Open and Close Lines", inline="Weekly Line Style")

wLineStyle = (wLineStyleOption == "dotted (┈)") ? line.style_dotted :
     (wLineStyleOption == "dashed (╌)") ? line.style_dashed :
     (wLineStyleOption == "arrow left (←)") ? line.style_arrow_left :
     (wLineStyleOption == "arrow right (→)") ? line.style_arrow_right :
     (wLineStyleOption == "arrows both (↔)") ? line.style_arrow_both :
         line.style_solid


// Weekly label options

// Show labels and colors
show_whlocLabel = input(defval=true, title="Show Weekly Labels?", group="Weekly Label Options", inline="Weekly")
show_wVal = input.bool(defval=true, title="Show Weekly Line Value?", group="Weekly Label Options", inline="Weekly")


wHighLblClr = input(color.rgb(00,153,00,80), title= "High Color", inline="weekly label colors")
wLowLblClr = input(color.rgb(204,00,00,80), title= "Low Color",  inline="weekly label colors")
wOpenLblClr = input(color.rgb(00,102,204,80), title= "Open Color", inline="weekly label colors")
wCloseLblClr = input(color.rgb(255,153,51,80), title= "Close Color", inline="weekly label colors")

//  Size and style drop down
wSizeOption = input.string(defval="Normal", title="Label Size -  ", options = ["Auto","Huge","Large","Normal","Small","Tiny"], inline="Weekly options")
wStyleOption = input.string(title="   Label Style -", options=["Triangle up (▲)", "Triangle down (▼)",
         "Label up (⬆)", "Label down (⬇)", "Plus (+)", "Text Outline", "None"], defval="Text Outline", inline= "Weekly options")
   

wLabelStyle = (wStyleOption == "Triangle up (▲)") ? label.style_triangleup :
     (wStyleOption == "Triangle down (▼)") ? label.style_triangledown :
     (wStyleOption == "Label up (⬆)") ? label.style_label_up :
     (wStyleOption == "Label down (⬇)") ? label.style_label_down :
     (wStyleOption == "Plus (+)") ? label.style_cross:
     (wStyleOption == "Text Outline") ? label.style_text_outline:
     (wStyleOption == "None") ? label.style_none :
         label.style_label_down
       
wLabelSize = (wSizeOption == "Huge") ? size.huge :
     (wSizeOption == "Large") ? size.large :
     (wSizeOption == "Small") ? size.small :
     (wSizeOption == "Tiny") ? size.tiny :
     (wSizeOption == "Auto") ? size.auto :
         size.normal

wLblHOffset = input.int(40, title="Horizontal Offset  ",    inline="Weekly offsets")
wLblVOffset = input(3.05,   title=  " Vertical Offset ",    inline="Weekly offsets")

////// Monthly line and label options ////

// Show Lines and colors
show_mhloc = input.bool(defval=true, title="Show Monthly Lines?", group="Monthly High, Low, Open and Close Lines", inline="Monthly Line")

show_mh = input.bool(defval=true, title="-", group="Monthly High, Low, Open and Close Lines", inline="Select Line")
mhcolor = input(color.rgb(133, 245, 86, 30), title="High", group="Monthly High, Low, Open and Close Lines", inline="Select Line")

show_ml = input.bool(defval=true, title="-",group="Monthly High, Low, Open and Close Lines", inline="Select Line")
mlcolor = input(color.rgb(246, 135, 135, 30), title="Low", group="Monthly High, Low, Open and Close Lines", inline="Select Line")

show_mo = input.bool(defval=true, title="-", group="Monthly High, Low, Open and Close Lines", inline="Select Line")
mocolor = input(color.rgb(120, 167, 241, 30), title="Open", group="Monthly High, Low, Open and Close Lines", inline="Select Line")

show_mc = input.bool(defval=true, title="-", group="Monthly High, Low, Open and Close Lines", inline="Select Line")
mccolor = input(color.rgb(246, 221, 96, 30), title="Close", group="Monthly High, Low, Open and Close Lines", inline="Select Line")

// Line style and size
mLineWidth = input.int(1, title="Line Width -  ", minval=1, group="Monthly High, Low, Open and Close Lines", inline="Monthly Line Style")

mLineStyleOption = input.string(defval="solid (─)",title="  Line Style - ",
     options=["solid (─)", "dotted (┈)", "dashed (╌)",
     "arrow left (←)", "arrow right (→)", "arrows both (↔)"],
      group="Monthly High, Low, Open and Close Lines", inline="Monthly Line Style")

mLineStyle = (mLineStyleOption == "dotted (┈)") ? line.style_dotted :
     (mLineStyleOption == "dashed (╌)") ? line.style_dashed :
     (mLineStyleOption == "arrow left (←)") ? line.style_arrow_left :
     (mLineStyleOption == "arrow right (→)") ? line.style_arrow_right :
     (mLineStyleOption == "arrows both (↔)") ? line.style_arrow_both :
         line.style_solid

// Monthly label options

// Show labels and colors
show_mhlocLabel = input(defval=true, title="Show Monthly Labels?",    group="Monthly Label Options", inline="Monthly")
show_mVal = input.bool(defval=true, title="Show Monthly Line Value?", group="Monthly Label Options", inline="Monthly")


mHighLblClr = input(color.rgb(00,153,00,80), title= "High Color", inline="monthly label colors")
mLowLblClr = input(color.rgb(204,00,00,80), title= "Low Color",  inline="monthly label colors")
mOpenLblClr = input(color.rgb(00,102,204,80), title= "Open Color", inline="monthly label colors")
mCloseLblClr = input(color.rgb(255,153,51,80), title= "Close Color", inline="monthly label colors")

//  Size and style drop down
mSizeOption = input.string(defval="Normal", title="Label Size -  ", options = ["Auto","Huge","Large","Normal","Small","Tiny"], inline="Monthly Options")
mStyleOption = input.string(title="   Label Style -", options=["Triangle up (▲)", "Triangle down (▼)",
         "Label up (⬆)", "Label down (⬇)", "Plus (+)", "Text Outline", "None"], defval="Text Outline", inline="Monthly Options")
   

mLabelStyle = (mStyleOption == "Triangle up (▲)") ? label.style_triangleup :
     (mStyleOption == "Triangle down (▼)") ? label.style_triangledown :
     (mStyleOption == "Label up (⬆)") ? label.style_label_up :
     (mStyleOption == "Label down (⬇)") ? label.style_label_down :
     (mStyleOption == "Plus (+)") ? label.style_cross:
     (mStyleOption == "Text Outline") ? label.style_text_outline:
     (mStyleOption == "None") ? label.style_none :
         label.style_label_down
       
mLabelSize = (mSizeOption == "Huge") ? size.huge :
     (mSizeOption == "Large") ? size.large :
     (mSizeOption == "Small") ? size.small :
     (mSizeOption == "Tiny") ? size.tiny :
     (mSizeOption == "Auto") ? size.auto :
         size.normal
       
mLblHOffset = input.int(50, title="Horizontal Offset  ",     inline="Monthly offsets")
mLblVOffset = input(3.05,   title=  " Vertical Offset ",    inline="Monthly offsets")

 
////////HLOC Lines and Label Plots///////


// Daily HLOC
// Call daily data

dhigh  = request.security(t, 'D', high[1])
dlow   = request.security(t, 'D', low[1])
dopen  = request.security(t, 'D', open[1])
dclose = request.security(t, 'D', close[1])



// Line Conditions

if (show_dhloc)
    if (show_dh)
        dh_line = line.new(x1=bar_index-1, y1=dhigh, color=dhcolor, x2=bar_index, y2=dhigh, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(dh_line[1])
    if (show_dl) 
        dl_line = line.new(x1=bar_index-1, y1=dlow, color=dlcolor, x2=bar_index, y2=dlow, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(dl_line[1])
    if (show_do)
        do_line = line.new(x1=bar_index-1, y1=dopen, color=docolor, x2=bar_index, y2=dopen, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(do_line[1])
    if (show_dc)
        dc_line = line.new(x1=bar_index-1, y1=dclose, color=dccolor, x2=bar_index, y2=dclose, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(dc_line[1])


// Daily Labels //

// Label Value String

dHigh = str.tostring(dhigh, format.mintick)
dhValNa = " "
string dhVal =  if show_dVal
    dHigh
else
    dhValNa
  
dLow = str.tostring(dlow, format.mintick)
dlValNa = " "
string dlVal =  if show_dVal
    dLow
else
    dlValNa
  
dOpen = str.tostring(dopen, format.mintick)
doValNa = " "
string doVal =  if show_dVal
    dOpen
else
    doValNa
  
dClose = str.tostring(dclose, format.mintick)
dcValNa = " "
string dcVal =  if show_dVal
    dClose
else
    dcValNa


// Label Conditions

if (show_dhlocLabel) and (show_dhloc)
    if (show_dh)
        dHighLabel = label.new(x=bar_index-1, y=dhigh, xloc=xloc.bar_index[0],
          color=(dHighLblClr), textcolor=dhcolor,
          style=dLabelStyle)
        label.set_text(id=dHighLabel, text=" Daily High "+ str.tostring(dhVal))
        label.set_size(dHighLabel,dLabelSize)
        label.set_y(dHighLabel, dhigh + dLblVOffset)
        label.set_x(dHighLabel, label.get_x(dHighLabel) + dLblHOffset)
        label.delete(dHighLabel[1])
    if (show_dl)
        dlowLabel = label.new(x=bar_index-1, y=dlow, xloc=xloc.bar_index[0],
          color=(dLowLblClr), textcolor=dlcolor,
          style=dLabelStyle)
        label.set_text(id=dlowLabel, text=" Daily Low "+ str.tostring(dlVal))
        label.set_size(dlowLabel,dLabelSize)
        label.set_y(dlowLabel, dlow - dLblVOffset)
        label.set_x(dlowLabel, label.get_x(dlowLabel) + dLblHOffset)
        label.delete(dlowLabel[1])
    if (show_do)
        dopenLabel = label.new(x=bar_index-1, y=dopen, xloc=xloc.bar_index[0],
          color=(dOpenLblClr), textcolor=docolor,
          style=dLabelStyle)
        label.set_text(id=dopenLabel, text=" Daily Open "+ str.tostring(doVal))
        label.set_size(dopenLabel,dLabelSize)
        label.set_y(dopenLabel, dopen + dLblVOffset)
        label.set_x(dopenLabel, label.get_x(dopenLabel) + dLblHOffset)
        label.delete(dopenLabel[1])
    if (show_dc)
        dcloseLabel = label.new(x=bar_index-1, y=dclose, xloc=xloc.bar_index[0],
          color=(dCloseLblClr), textcolor=dccolor,
          style=dLabelStyle)
        label.set_text(id=dcloseLabel, text=" Daily Close "+ str.tostring(dcVal))
        label.set_size(dcloseLabel,dLabelSize)
        label.set_y(dcloseLabel, dclose - dLblVOffset)
        label.set_x(dcloseLabel, label.get_x(dcloseLabel) + dLblHOffset)
        label.delete(dcloseLabel[1])

 
 
// Weekly HLOC

// Call weekly data
whigh  = request.security(t, 'W', high[1])
wlow   = request.security(t, 'W', low[1])
wopen  = request.security(t, 'W', open[1])
wclose = request.security(t, 'W', close[1])



// Line Condition

if (show_whloc)
    if (show_wh)
        wh_line = line.new(x1=bar_index-1, y1=whigh, color=whcolor, x2=bar_index, y2=whigh, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth , extend=extend.both)
        line.delete(wh_line[1])
    if (show_wl)
        wl_line = line.new(x1=bar_index-1, y1=wlow, color=wlcolor, x2=bar_index, y2=wlow, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth  , extend=extend.both)
        line.delete(wl_line[1])
    if (show_wo)
        wo_line = line.new(x1=bar_index-1, y1=wopen, color=wocolor, x2=bar_index, y2=wopen, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth , extend=extend.both)
        line.delete(wo_line[1])
    if (show_wc)
        wc_line = line.new(x1=bar_index-1, y1=wclose, color=wccolor, x2=bar_index, y2=wclose, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth , extend=extend.both)
        line.delete(wc_line[1])
  
  
// Weekly Labels//

// Label Value String

wHigh = str.tostring(whigh, format.mintick)
whValNa = " "
string whVal =  if show_wVal
    wHigh
else
    whValNa
  
wLow = str.tostring(wlow, format.mintick)
wlValNa = " "
string wlVal =  if show_wVal
    wLow
else
    wlValNa
  
wOpen = str.tostring(wopen, format.mintick)
woValNa = " "
string woVal =  if show_wVal
    wOpen
else
    woValNa
  
wClose = str.tostring(wclose, format.mintick)
wcValNa = " "
string wcVal =  if show_wVal
    wClose
else
    wcValNa
 

// Label Conditions
  
if (show_whlocLabel) and (show_whloc)

    if (show_wh)
        wHighLabel = label.new(x=bar_index-1, y=whigh, xloc=xloc.bar_index[0],
          color=(wHighLblClr), textcolor=whcolor,
          style=wLabelStyle)
        label.set_text(id=wHighLabel, text=" Weekly High "+ str.tostring(whVal))
        label.set_size(wHighLabel,wLabelSize)
        label.set_y(wHighLabel, whigh + wLblVOffset)
        label.set_x(wHighLabel, label.get_x(wHighLabel) + wLblHOffset)
        label.delete(wHighLabel[1])
    if (show_wl)
        wlowLabel = label.new(x=bar_index-1, y=wlow, xloc=xloc.bar_index[0],
          color=(wLowLblClr), textcolor=wlcolor,
          style=wLabelStyle)
        label.set_text(id=wlowLabel, text=" Weekly Low "+ str.tostring(wlVal))
        label.set_size(wlowLabel,wLabelSize)
        label.set_y(wlowLabel, wlow - wLblVOffset)
        label.set_x(wlowLabel, label.get_x(wlowLabel) + wLblHOffset)
        label.delete(wlowLabel[1])
    if (show_wo)
        wopenLabel = label.new(x=bar_index-1, y=wopen, xloc=xloc.bar_index[0],
          color=(wOpenLblClr), textcolor=wocolor,
          style=wLabelStyle)
        label.set_text(id=wopenLabel, text=" Weekly Open "+ str.tostring(woVal))
        label.set_size(wopenLabel,wLabelSize)
        label.set_y(wopenLabel, wopen + wLblVOffset)
        label.set_x(wopenLabel, label.get_x(wopenLabel) + wLblHOffset)
        label.delete(wopenLabel[1])
    if (show_wc)
        wcloseLabel = label.new(x=bar_index-1, y=wclose, xloc=xloc.bar_index[0],
          color=(wCloseLblClr), textcolor=wccolor,
          style=wLabelStyle)
        label.set_text(id=wcloseLabel, text=" Weekly Close "+ str.tostring(wcVal))
        label.set_size(wcloseLabel,wLabelSize)
        label.set_y(wcloseLabel, wclose - wLblVOffset)
        label.set_x(wcloseLabel, label.get_x(wcloseLabel) + wLblHOffset)
        label.delete(wcloseLabel[1])
  

// Monthly HLOC  //

// Call monthly data
mhigh  = request.security(t, 'M', high[1])
mlow   = request.security(t, 'M', low[1])
mopen  = request.security(t, 'M', open[1])
mclose = request.security(t, 'M', close[1])





// Line Condition
if (show_mhloc)
    if (show_mh)
        mh_line = line.new(x1=bar_index-1, y1=mhigh, color=mhcolor, x2=bar_index, y2=mhigh, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(mh_line[1])
    if (show_ml)
        ml_line = line.new(x1=bar_index-1, y1=mlow, color=mlcolor, x2=bar_index, y2=mlow, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(ml_line[1])
    if (show_mo)
        mo_line = line.new(x1=bar_index-1, y1=mopen, color=mocolor, x2=bar_index, y2=mopen, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(mo_line[1])
    if (show_mc)
        mc_line = line.new(x1=bar_index-1, y1=mclose, color=mccolor, x2=bar_index, y2=mclose, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(mc_line[1])


// Monthly Labels //

// Label Value String

mHigh = str.tostring(mhigh, format.mintick)
mhValNa = " "
string mhVal =  if show_mVal
    mHigh
else
    mhValNa
  
mLow = str.tostring(mlow, format.mintick)
mlValNa = " "
string mlVal =  if show_mVal
    mLow
else
    mlValNa
  
mOpen = str.tostring(mopen, format.mintick)
moValNa = " "
string moVal =  if show_mVal
    mOpen
else
    moValNa
  
mClose = str.tostring(mclose, format.mintick)
mcValNa = " "
string mcVal =  if show_mVal
    mClose
else
    mcValNa



// Label Condition
 
if (show_mhlocLabel) and (show_mhloc)
    if (show_mh)
        mHighLabel = label.new(x=bar_index-1, y=mhigh, xloc=xloc.bar_index[0],
          color=(mHighLblClr), textcolor=mhcolor,
          style=mLabelStyle)
        label.set_text(id=mHighLabel, text=" Monthly High "+ str.tostring(mhVal))
        label.set_size(mHighLabel,mLabelSize)
        label.set_y(mHighLabel, mhigh + mLblVOffset)
        label.set_x(mHighLabel, label.get_x(mHighLabel) + mLblHOffset)
        label.delete(mHighLabel[1])
    if (show_ml)
        mlowLabel = label.new(x=bar_index-1, y=mlow, xloc=xloc.bar_index[0],
          color=(mLowLblClr), textcolor=mlcolor,
          style=mLabelStyle)
        label.set_text(id=mlowLabel, text=" Monthly Low "+ str.tostring(mlVal))
        label.set_size(mlowLabel,mLabelSize)
        label.set_y(mlowLabel, mlow - mLblVOffset)
        label.set_x(mlowLabel, label.get_x(mlowLabel) + mLblHOffset)
        label.delete(mlowLabel[1])
    if (show_mo)
        mopenLabel = label.new(x=bar_index-1, y=mopen, xloc=xloc.bar_index[0],
          color=(mOpenLblClr), textcolor=mocolor,
          style=mLabelStyle)
        label.set_text(id=mopenLabel, text=" Monthly Open "+ str.tostring(moVal))
        label.set_size(mopenLabel,mLabelSize)
        label.set_y(mopenLabel, mopen + mLblVOffset)
        label.set_x(mopenLabel, label.get_x(mopenLabel) + mLblHOffset)
        label.delete(mopenLabel[1])
    if (show_mc)
        mcloseLabel = label.new(x=bar_index-1, y=mclose, xloc=xloc.bar_index[0],
          color=(mCloseLblClr), textcolor=mccolor,
          style=mLabelStyle)
        label.set_text(id=mcloseLabel, text=" Monthly Close "+ str.tostring(mcVal))
        label.set_size(mcloseLabel,mLabelSize)
        label.set_y(mcloseLabel, mclose - mLblVOffset)
        label.set_x(mcloseLabel, label.get_x(mcloseLabel) + mLblHOffset)
        label.delete(mcloseLabel[1])
 
Last edited by a moderator:
I
Hi @FutureTony ,
I have been trying to get this to work, but I can't get the Weekly or Monthly Fib labels to turn off. Also, the previous Monthly High/Low is showing as the current monthly High/Low. Could you or someone fix? I have tried the other versions out there, but they don't don't do what I want either, yours comes closest. If helpful, all I am looking for is the Previous Weekly High/Low, and Previous Monthly High/Low. I have the daily's covered with other scripts (current day and previous day). Note, that I am trading ES futures, and so they have to "see" after regular trading hours too. Below is the Indicator I use in TradingView written by goofoffgoose:

Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at [URL]https://mozilla.org/MPL/2.0/[/URL]
// © goofoffgoose
//@version=5

//This is a requested spin-off version of my previous HLOC for the Daily/Weekly/Monthly that allows users to choose 3 different
// timeframe units (Mins, Hours, Days, ect..) from the dropdown menu and then select the lookback periord in which to draw the HLOC.
//
// This indicator draws a line on the TF 1, TF 2, and TF 3 bar at the High, Low, Open and Close of user input Timeframe unit and selected lookback period.
// The lookback period will go back the number of candles entered. So for example if you choose a 5 Min chart with a lookback of 3, the lines will be drawn on
// the HLOC 3 closed 5 min candles back. Selecting 0 will show data on the current Real-Time candle.

// Each set of lines has an optional identifying label with its own color set that can be shown with or without
//      price value, and has drop down menues for size and style of each set of labels. The TF unit value is displayed on the label, but not the lookback.
// So if you are using the hourly on all 3 TF's with different lookback periods, they will all say "60" on the label.
// I recommend using the line and label options to distinguish between the different lookback values.

// Each set of lines has inputs for line/text color, line width and style and each line arguement can be selected independently.

// I recommend going into Chart Settings/Status Line and turning off indicator arguments OR moving the script to the top
//      of the indicator list to avoid obstructed chart view with this indicators arguments. When script allows, I will update it to hide them.


indicator("Multi TF High/Low/Open/Close Line", shorttitle= "Muti TF HLOC", overlay=true)

t = ticker.new(syminfo.prefix, syminfo.ticker)
///////// Label input options and colors //////////

////// TF 1 line and label options ////

// Show Lines and TF
show_dhloc = input.bool(defval=true, title=" Show Timeframe 1 Lines?", group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Line")
tf_1 = input.timeframe('60', title="Timeframe 1 - ", group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1")
tf_1_m = input.int(1, title="  TF Lookback - ", tooltip="Input the number of TF units selected in the drop-down menu you want to lookback. 0 is current candle where 1 and higher will lookback. Example: You select 1 hour in the drop-down menu with a lookback number of 2, lines will be drawn on hourly data from 2 candles back",
 group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1")

// Line style and size
dLineWidth = input.int(1, title="Line Width -  ", minval=1, group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Line Style")

dLineStyleOption = input.string(defval="solid (─)",title="  Line Style -  ",
     options=["solid (─)", "dotted (┈)", "dashed (╌)",
     "arrow left (←)", "arrow right (→)", "arrows both (↔)"],
     group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Line Style")

dLineStyle = (dLineStyleOption == "dotted (┈)") ? line.style_dotted :
     (dLineStyleOption == "dashed (╌)") ? line.style_dashed :
     (dLineStyleOption == "arrow left (←)") ? line.style_arrow_left :
     (dLineStyleOption == "arrow right (→)") ? line.style_arrow_right :
     (dLineStyleOption == "arrows both (↔)") ? line.style_arrow_both :
         line.style_solid

// Show Lines and colors
show_dh = input.bool(defval=true, title="-", group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")
dhcolor = input(color.rgb(133, 245, 86, 30), title="High ", group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")

show_dl = input.bool(defval=true, title="-",  group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")
dlcolor = input(color.rgb(246, 135, 135, 30), title="Low ",  group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")

show_do = input.bool(defval=true, title="-",  group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")
docolor = input(color.rgb(120, 167, 241, 30), title="Open ",  group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")

show_dc = input.bool(defval=true, title="-",  group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")
dccolor = input(color.rgb(246, 221, 96, 30), title="Close ", group="Timeframe 1 High, Low, Open and Close Lines", inline="TF 1 Select Line")




// TF 1 label options

// Show labels and colors
show_dhlocLabel = input(defval=true, title="Show Timeframe 1 Labels?   ", group="Timeframe 1 Label Options", inline="TF 1")
show_dVal = input.bool(defval=true, title="Show Timeframe 1 Line Value?   ", group="Timeframe 1 Label Options", inline="TF 1")

dLblHOffset = input.int(0, title="Horizontal Offset - ", group="Timeframe 1 Label Options", inline="TF 1 offsets")
dLblVOffset = input(.05, title=" Vertical Offset - ", group="Timeframe 1 Label Options", inline="TF 1 offsets")

//  Size and style drop down
dSizeOption = input.string(defval="Normal", title="Label Size -    ", options = ["Auto","Huge","Large","Normal","Small","Tiny"], group="Timeframe 1 Label Options", inline="TF 1 options")
dStyleOption = input.string(title="  Label Style - ", options=["Triangle up (▲)", "Triangle down (▼)",
         "Label up (⬆)", "Label down (⬇)", "Plus (+)", "Text Outline", "None"], defval="Text Outline", group="Timeframe 1 Label Options", inline="TF 1 options")
 

dLabelStyle = (dStyleOption == "Triangle up (▲)") ? label.style_triangleup :
     (dStyleOption == "Triangle down (▼)") ? label.style_triangledown :
     (dStyleOption == "Label up (⬆)") ? label.style_label_up :
     (dStyleOption == "Label down (⬇)") ? label.style_label_down :
     (dStyleOption == "Plus (+)") ? label.style_cross:
     (dStyleOption == "Text Outline") ? label.style_text_outline:
     (dStyleOption == "None") ? label.style_none :
         label.style_label_down
     
dLabelSize = (dSizeOption == "Huge") ? size.huge :
     (dSizeOption == "Large") ? size.large :
     (dSizeOption == "Small") ? size.small :
     (dSizeOption == "Tiny") ? size.tiny :
     (dSizeOption == "Auto") ? size.auto :
         size.normal

dHighLblClr = input(color.rgb(00,153,00,80), title= "High Color ", group="Timeframe 1 Label Options", inline="TF 1 label colors")
dLowLblClr = input(color.rgb(204,00,00,80), title= "Low Color ", group="Timeframe 1 Label Options", inline="TF 1 label colors")
dOpenLblClr = input(color.rgb(00,102,204,80), title= "Open Color ", group="Timeframe 1 Label Options", inline="TF 1 label colors")
dCloseLblClr = input(color.rgb(255,153,51,80), title= "Close Color ", group="Timeframe 1 Label Options", inline="TF 1 label colors")


     


////// TF 2 line and label options ////

// Show Lines and colors
show_whloc = input.bool(defval=true, title=" Show Timeframe 2 Line?", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Line")
tf_2 = input.timeframe('D', title="Timeframe 2 - ", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2")
tf_2_m = input.int(1, title="  TF Lookback - ", tooltip="Input the number of TF units selected in the drop-down menu you want to lookback. 0 is current candle where 1 and higher will lookback. Example: You select 1 hour in the drop-down menu with a lookback number of 2, lines will be drawn on hourly data from 2 candles back",
 group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2")

// Line style and size
wLineWidth = input.int(1, title="Line Width -  ", minval=1, group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Line Style")

wLineStyleOption = input.string(defval="solid (─)",title="  Line Style -  ",
     options=["solid (─)", "dotted (┈)", "dashed (╌)",
     "arrow left (←)", "arrow right (→)", "arrows both (↔)"],
     group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Line Style")

wLineStyle = (wLineStyleOption == "dotted (┈)") ? line.style_dotted :
     (wLineStyleOption == "dashed (╌)") ? line.style_dashed :
     (wLineStyleOption == "arrow left (←)") ? line.style_arrow_left :
     (wLineStyleOption == "arrow right (→)") ? line.style_arrow_right :
     (wLineStyleOption == "arrows both (↔)") ? line.style_arrow_both :
         line.style_solid




show_wh = input.bool(defval=true, title="-", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")
whcolor = input(color.rgb(133, 245, 86, 30), title="High ", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")

show_wl = input.bool(defval=true, title="-", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")
wlcolor = input(color.rgb(246, 135, 135, 30), title="Low ", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")

show_wo = input.bool(defval=true, title="-", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")
wocolor = input(color.rgb(120, 167, 241, 30), title="Open ", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")

show_wc = input.bool(defval=true, title="-", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")
wccolor = input(color.rgb(246, 221, 96, 30), title="Close ", group="Timeframe 2 High, Low, Open and Close Lines", inline="TF 2 Select Line")


// TF 2 label options

// Show labels and colors
show_whlocLabel = input(defval=true, title="Show Timeframe 2 Labels?   ", group="Timeframe 2 Label Options", inline="TF 2")
show_wVal = input.bool(defval=true, title="Show Timeframe 2 Line Value?   ", group="Timeframe 2 Label Options", inline="TF 2")

wLblHOffset = input.int(0, title="Horizontal Offset - ", group="Timeframe 2 Label Options", inline="TF 2 offsets")
wLblVOffset = input(.05, title=" Vertical Offset - ",    group="Timeframe 2 Label Options", inline="TF 2 offsets")

//  Size and style drop down
wSizeOption = input.string(defval="Normal", title="Label Size -    ", options = ["Auto","Huge","Large","Normal","Small","Tiny"], group="Timeframe 2 Label Options", inline="TF 2 options")
wStyleOption = input.string(title="  Label Style - ", options=["Triangle up (▲)", "Triangle down (▼)",
         "Label up (⬆)", "Label down (⬇)", "Plus (+)", "Text Outline", "None"], defval="Text Outline", group="Timeframe 2 Label Options", inline= "TF 2 options")
 

wLabelStyle = (wStyleOption == "Triangle up (▲)") ? label.style_triangleup :
     (wStyleOption == "Triangle down (▼)") ? label.style_triangledown :
     (wStyleOption == "Label up (⬆)") ? label.style_label_up :
     (wStyleOption == "Label down (⬇)") ? label.style_label_down :
     (wStyleOption == "Plus (+)") ? label.style_cross:
     (wStyleOption == "Text Outline") ? label.style_text_outline:
     (wStyleOption == "None") ? label.style_none :
         label.style_label_down
     
wLabelSize = (wSizeOption == "Huge") ? size.huge :
     (wSizeOption == "Large") ? size.large :
     (wSizeOption == "Small") ? size.small :
     (wSizeOption == "Tiny") ? size.tiny :
     (wSizeOption == "Auto") ? size.auto :
         size.normal


wHighLblClr =  input(color.rgb(00,153,00,80),  title= "High Color ",  group="Timeframe 2 Label Options", inline="weekly label colors")
wLowLblClr =   input(color.rgb(204,00,00,80),  title= "Low Color ",   group="Timeframe 2 Label Options", inline="weekly label colors")
wOpenLblClr =  input(color.rgb(00,102,204,80), title= "Open Color ",  group="Timeframe 2 Label Options", inline="weekly label colors")
wCloseLblClr = input(color.rgb(255,153,51,80), title= "Close Color ", group="Timeframe 2 Label Options", inline="weekly label colors")



////// TF 3 line and label options ////

// Show Lines and colors
show_mhloc = input.bool(defval=true, title=" Show Timeframe 3 Line?", group="Timeframe 3 High, Low, Open and Close Lines", inline="TF 3 Line")

tf_3 = input.timeframe('W', title="Timeframe 3 - ", group="Timeframe 3 High, Low, Open and Close Lines", inline="TF 3")
tf_3_m = input.int(1, title="  TF Lookback - ", tooltip="Input the number of TF units selected in the drop-down menu you want to lookback. 0 is current candle where 1 and higher will lookback. Example: You select 1 hour in the drop-down menu with a lookback number of 2, lines will be drawn on hourly data from 2 candles back",
 group="Timeframe 3 High, Low, Open and Close Lines", inline="TF 3")


// Line style and size
mLineWidth = input.int(1, title="Line Width -  ", minval=1, group="Timeframe 3 High, Low, Open and Close Lines", inline="TF 3 Line Style")

mLineStyleOption = input.string(defval="solid (─)",title="  Line Style -  ",
     options=["solid (─)", "dotted (┈)", "dashed (╌)",
     "arrow left (←)", "arrow right (→)", "arrows both (↔)"],
      group="Timeframe 3 High, Low, Open and Close Lines", inline="TF 3 Line Style")

mLineStyle = (mLineStyleOption == "dotted (┈)") ? line.style_dotted :
     (mLineStyleOption == "dashed (╌)") ? line.style_dashed :
     (mLineStyleOption == "arrow left (←)") ? line.style_arrow_left :
     (mLineStyleOption == "arrow right (→)") ? line.style_arrow_right :
     (mLineStyleOption == "arrows both (↔)") ? line.style_arrow_both :
         line.style_solid


show_mh = input.bool(defval=true, title="-", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")
mhcolor = input(color.rgb(133, 245, 86, 30), title="High ", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")

show_ml = input.bool(defval=true, title="-", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")
mlcolor = input(color.rgb(246, 135, 135, 30), title="Low ", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")

show_mo = input.bool(defval=true, title="-", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")
mocolor = input(color.rgb(120, 167, 241, 30), title="Open ", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")

show_mc = input.bool(defval=true, title="-", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")
mccolor = input(color.rgb(246, 221, 96, 30), title="Close ", group="Timeframe 3 High, Low, Open and Close Lines", inline="Select Line")


// TF 3 label options

// Show labels and colors
show_mhlocLabel = input(defval=true, title="Show Timeframe 3 Labels?   ",    group="Timeframe 3 Label Options", inline="TF 3")
show_mVal = input.bool(defval=true, title="Show Timeframe 3 Line Value?   ", group="Timeframe 3 Label Options", inline="TF 3")

mLblHOffset = input.int(0, title="Horizontal Offset - ", group="Timeframe 3 Label Options", inline="TF 3 offsets")
mLblVOffset = input(.05, title="Vertical Offset - ", group="Timeframe 3 Label Options", inline="TF 3 offsets")

//  Size and style drop down
mSizeOption = input.string(defval="Normal", title="Label Size -    ", options = ["Auto","Huge","Large","Normal","Small","Tiny"], group="Timeframe 3 Label Options", inline="TF 3 Options")
mStyleOption = input.string(title="  Label Style - ", options=["Triangle up (▲)", "Triangle down (▼)",
         "Label up (⬆)", "Label down (⬇)", "Plus (+)", "Text Outline", "None"], defval="Text Outline",group="Timeframe 3 Label Options",  inline="TF 3 Options")
 

mLabelStyle = (mStyleOption == "Triangle up (▲)") ? label.style_triangleup :
     (mStyleOption == "Triangle down (▼)") ? label.style_triangledown :
     (mStyleOption == "Label up (⬆)") ? label.style_label_up :
     (mStyleOption == "Label down (⬇)") ? label.style_label_down :
     (mStyleOption == "Plus (+)") ? label.style_cross:
     (mStyleOption == "Text Outline") ? label.style_text_outline:
     (mStyleOption == "None") ? label.style_none :
         label.style_label_down
     
mLabelSize = (mSizeOption == "Huge") ? size.huge :
     (mSizeOption == "Large") ? size.large :
     (mSizeOption == "Small") ? size.small :
     (mSizeOption == "Tiny") ? size.tiny :
     (mSizeOption == "Auto") ? size.auto :
         size.normal
     
 

mHighLblClr =  input(color.rgb(00,153,00,80),  title= "High Color ",  group="Timeframe 3 Label Options", inline="TF 3 label colors")
mLowLblClr =   input(color.rgb(204,00,00,80),  title= "Low Color ",   group="Timeframe 3 Label Options", inline="TF 3 label colors")
mOpenLblClr =  input(color.rgb(00,102,204,80), title= "Open Color ",  group="Timeframe 3 Label Options", inline="TF 3 label colors")
mCloseLblClr = input(color.rgb(255,153,51,80), title= "Close Color ", group="Timeframe 3 Label Options", inline="TF 3 label colors")


 
////////HLOC Lines and Label Plots///////


// TF 1 HLOC
// Call TF 1 data

dhigh  = request.security(t, tf_1, high[tf_1_m])
dlow   = request.security(t, tf_1, low[tf_1_m])
dopen  = request.security(t, tf_1, open[tf_1_m])
dclose = request.security(t, tf_1, close[tf_1_m])



// Line Conditions

if (show_dhloc)
    if (show_dh)
        dh_line = line.new(x1=bar_index-1, y1=dhigh, color=dhcolor, x2=bar_index, y2=dhigh, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(dh_line[1])
    if (show_dl)
        dl_line = line.new(x1=bar_index-1, y1=dlow, color=dlcolor, x2=bar_index, y2=dlow, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(dl_line[1])
    if (show_do)
        do_line = line.new(x1=bar_index-1, y1=dopen, color=docolor, x2=bar_index, y2=dopen, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(do_line[1])
    if (show_dc)
        dc_line = line.new(x1=bar_index-1, y1=dclose, color=dccolor, x2=bar_index, y2=dclose, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(dc_line[1])


// TF 1 Labels //

// Label Value String

dHigh = str.tostring(dhigh, format.mintick)
dhValNa = " "
string dhVal =  if show_dVal
    dHigh
else
    dhValNa
 
dLow = str.tostring(dlow, format.mintick)
dlValNa = " "
string dlVal =  if show_dVal
    dLow
else
    dlValNa
 
dOpen = str.tostring(dopen, format.mintick)
doValNa = " "
string doVal =  if show_dVal
    dOpen
else
    doValNa
 
dClose = str.tostring(dclose, format.mintick)
dcValNa = " "
string dcVal =  if show_dVal
    dClose
else
    dcValNa


// Label Conditions

if (show_dhlocLabel) and (show_dhloc)
    if (show_dh)
        dHighLabel = label.new(x=bar_index-1, y=dhigh, xloc=xloc.bar_index[0],
          color=(dHighLblClr), textcolor=dhcolor,
          style=dLabelStyle)
        label.set_text(id=dHighLabel, text= str.tostring(tf_1) + " High " + str.tostring(dhVal))
        label.set_size(dHighLabel,dLabelSize)
        label.set_y(dHighLabel, dhigh + dLblVOffset)
        label.set_x(dHighLabel, label.get_x(dHighLabel) + dLblHOffset)
        label.delete(dHighLabel[1])
    if (show_dl)
        dlowLabel = label.new(x=bar_index-1, y=dlow, xloc=xloc.bar_index[0],
          color=(dLowLblClr), textcolor=dlcolor,
          style=dLabelStyle)
        label.set_text(id=dlowLabel, text=str.tostring(tf_1) + " Low " + str.tostring(dlVal))
        label.set_size(dlowLabel,dLabelSize)
        label.set_y(dlowLabel, dlow - dLblVOffset)
        label.set_x(dlowLabel, label.get_x(dlowLabel) + dLblHOffset)
        label.delete(dlowLabel[1])
    if (show_do)
        dopenLabel = label.new(x=bar_index-1, y=dopen, xloc=xloc.bar_index[0],
          color=(dOpenLblClr), textcolor=docolor,
          style=dLabelStyle)
        label.set_text(id=dopenLabel, text=str.tostring(tf_1) + " Open " + str.tostring(doVal))
        label.set_size(dopenLabel,dLabelSize)
        label.set_y(dopenLabel, dopen + dLblVOffset)
        label.set_x(dopenLabel, label.get_x(dopenLabel) + dLblHOffset)
        label.delete(dopenLabel[1])
    if (show_dc)
        dcloseLabel = label.new(x=bar_index-1, y=dclose, xloc=xloc.bar_index[0],
          color=(dCloseLblClr), textcolor=dccolor,
          style=dLabelStyle)
        label.set_text(id=dcloseLabel, text=str.tostring(tf_1) + " Close " + str.tostring(dcVal))
        label.set_size(dcloseLabel,dLabelSize)
        label.set_y(dcloseLabel, dclose - dLblVOffset)
        label.set_x(dcloseLabel, label.get_x(dcloseLabel) + dLblHOffset)
        label.delete(dcloseLabel[1])

 
 
// TF 2 HLOC

// Call weekly data
whigh  = request.security(t, tf_2,  high[tf_2_m])
wlow   = request.security(t, tf_2,   low[tf_2_m])
wopen  = request.security(t, tf_2,  open[tf_2_m])
wclose = request.security(t, tf_2, close[tf_2_m])



// Line Condition

if (show_whloc)
    if (show_wh)
        wh_line = line.new(x1=bar_index-1, y1=whigh, color=whcolor, x2=bar_index, y2=whigh, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth , extend=extend.both)
        line.delete(wh_line[1])
    if (show_wl)
        wl_line = line.new(x1=bar_index-1, y1=wlow, color=wlcolor, x2=bar_index, y2=wlow, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth  , extend=extend.both)
        line.delete(wl_line[1])
    if (show_wo)
        wo_line = line.new(x1=bar_index-1, y1=wopen, color=wocolor, x2=bar_index, y2=wopen, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth , extend=extend.both)
        line.delete(wo_line[1])
    if (show_wc)
        wc_line = line.new(x1=bar_index-1, y1=wclose, color=wccolor, x2=bar_index, y2=wclose, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth , extend=extend.both)
        line.delete(wc_line[1])
 
 
// TF 2 Labels//

// Label Value String

wHigh = str.tostring(whigh, format.mintick)
whValNa = " "
string whVal =  if show_wVal
    wHigh
else
    whValNa
 
wLow = str.tostring(wlow, format.mintick)
wlValNa = " "
string wlVal =  if show_wVal
    wLow
else
    wlValNa
 
wOpen = str.tostring(wopen, format.mintick)
woValNa = " "
string woVal =  if show_wVal
    wOpen
else
    woValNa
 
wClose = str.tostring(wclose, format.mintick)
wcValNa = " "
string wcVal =  if show_wVal
    wClose
else
    wcValNa
 

// Label Conditions
 
if (show_whlocLabel) and (show_whloc)

    if (show_wh)
        wHighLabel = label.new(x=bar_index-1, y=whigh, xloc=xloc.bar_index[0],
          color=(wHighLblClr), textcolor=whcolor,
          style=wLabelStyle)
        label.set_text(id=wHighLabel, text=str.tostring(tf_2) + " High " + str.tostring(whVal))
        label.set_size(wHighLabel,wLabelSize)
        label.set_y(wHighLabel, whigh + wLblVOffset)
        label.set_x(wHighLabel, label.get_x(wHighLabel) + wLblHOffset)
        label.delete(wHighLabel[1])
    if (show_wl)
        wlowLabel = label.new(x=bar_index-1, y=wlow, xloc=xloc.bar_index[0],
          color=(wLowLblClr), textcolor=wlcolor,
          style=wLabelStyle)
        label.set_text(id=wlowLabel, text=str.tostring(tf_2) + " Low " + str.tostring(wlVal))
        label.set_size(wlowLabel,wLabelSize)
        label.set_y(wlowLabel, wlow - wLblVOffset)
        label.set_x(wlowLabel, label.get_x(wlowLabel) + wLblHOffset)
        label.delete(wlowLabel[1])
    if (show_wo)
        wopenLabel = label.new(x=bar_index-1, y=wopen, xloc=xloc.bar_index[0],
          color=(wOpenLblClr), textcolor=wocolor,
          style=wLabelStyle)
        label.set_text(id=wopenLabel, text=str.tostring(tf_2) + " Open " + str.tostring(woVal))
        label.set_size(wopenLabel,wLabelSize)
        label.set_y(wopenLabel, wopen + wLblVOffset)
        label.set_x(wopenLabel, label.get_x(wopenLabel) + wLblHOffset)
        label.delete(wopenLabel[1])
    if (show_wc)
        wcloseLabel = label.new(x=bar_index-1, y=wclose, xloc=xloc.bar_index[0],
          color=(wCloseLblClr), textcolor=wccolor,
          style=wLabelStyle)
        label.set_text(id=wcloseLabel, text=str.tostring(tf_2) + " Close " + str.tostring(wcVal))
        label.set_size(wcloseLabel,wLabelSize)
        label.set_y(wcloseLabel, wclose - wLblVOffset)
        label.set_x(wcloseLabel, label.get_x(wcloseLabel) + wLblHOffset)
        label.delete(wcloseLabel[1])
 

// TF 3 HLOC  //

// Call TF 3 data
mhigh  = request.security(t, tf_3,  high[tf_3_m])
mlow   = request.security(t, tf_3,   low[tf_3_m])
mopen  = request.security(t, tf_3,  open[tf_3_m])
mclose = request.security(t, tf_3, close[tf_3_m])





// Line Condition
if (show_mhloc)
    if (show_mh)
        mh_line = line.new(x1=bar_index-1, y1=mhigh, color=mhcolor, x2=bar_index, y2=mhigh, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(mh_line[1])
    if (show_ml)
        ml_line = line.new(x1=bar_index-1, y1=mlow, color=mlcolor, x2=bar_index, y2=mlow, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(ml_line[1])
    if (show_mo)
        mo_line = line.new(x1=bar_index-1, y1=mopen, color=mocolor, x2=bar_index, y2=mopen, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(mo_line[1])
    if (show_mc)
        mc_line = line.new(x1=bar_index-1, y1=mclose, color=mccolor, x2=bar_index, y2=mclose, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(mc_line[1])


// TF 3 Labels //

// Label Value String

mHigh = str.tostring(mhigh, format.mintick)
mhValNa = " "
string mhVal =  if show_mVal
    mHigh
else
    mhValNa
 
mLow = str.tostring(mlow, format.mintick)
mlValNa = " "
string mlVal =  if show_mVal
    mLow
else
    mlValNa
 
mOpen = str.tostring(mopen, format.mintick)
moValNa = " "
string moVal =  if show_mVal
    mOpen
else
    moValNa
 
mClose = str.tostring(mclose, format.mintick)
mcValNa = " "
string mcVal =  if show_mVal
    mClose
else
    mcValNa



// Label Condition
 
if (show_mhlocLabel) and (show_mhloc)
    if (show_mh)
        mHighLabel = label.new(x=bar_index-1, y=mhigh, xloc=xloc.bar_index[0],
          color=(mHighLblClr), textcolor=mhcolor,
          style=mLabelStyle)
        label.set_text(id=mHighLabel, text=str.tostring(tf_3) +" High " + str.tostring(mhVal))
        label.set_size(mHighLabel,mLabelSize)
        label.set_y(mHighLabel, mhigh + mLblVOffset)
        label.set_x(mHighLabel, label.get_x(mHighLabel) + mLblHOffset)
        label.delete(mHighLabel[1])
    if (show_ml)
        mlowLabel = label.new(x=bar_index-1, y=mlow, xloc=xloc.bar_index[0],
          color=(mLowLblClr), textcolor=mlcolor,
          style=mLabelStyle)
        label.set_text(id=mlowLabel, text=str.tostring(tf_3) + " Low " + str.tostring(mlVal))
        label.set_size(mlowLabel,mLabelSize)
        label.set_y(mlowLabel, mlow - mLblVOffset)
        label.set_x(mlowLabel, label.get_x(mlowLabel) + mLblHOffset)
        label.delete(mlowLabel[1])
    if (show_mo)
        mopenLabel = label.new(x=bar_index-1, y=mopen, xloc=xloc.bar_index[0],
          color=(mOpenLblClr), textcolor=mocolor,
          style=mLabelStyle)
        label.set_text(id=mopenLabel, text=str.tostring(tf_3) + " Open " + str.tostring(moVal))
        label.set_size(mopenLabel,mLabelSize)
        label.set_y(mopenLabel, mopen + mLblVOffset)
        label.set_x(mopenLabel, label.get_x(mopenLabel) + mLblHOffset)
        label.delete(mopenLabel[1])
    if (show_mc)
        mcloseLabel = label.new(x=bar_index-1, y=mclose, xloc=xloc.bar_index[0],
          color=(mCloseLblClr), textcolor=mccolor,
          style=mLabelStyle)
        label.set_text(id=mcloseLabel, text=str.tostring(tf_3) + " Close " + str.tostring(mcVal))
        label.set_size(mcloseLabel,mLabelSize)
        label.set_y(mcloseLabel, mclose - mLblVOffset)
        label.set_x(mcloseLabel, label.get_x(mcloseLabel)  + mLblHOffset)
        label.delete(mcloseLabel[1])


For completeness, I am including an earlier version of goofoffgoose's code as well:

Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at [URL]https://mozilla.org/MPL/2.0/[/URL]
// © goofoffgoose
//@version=5

// For My pal Jittery
//
// This indicator draws a line on the Daily, Weekly, and Monthly bar at the High, Low, Open and Close of each bar as price
//      tends to react when revisiting these areas.
// Each set of bars has an optional identifying label with its own color set that can be shown with or without the lines
//      price value, and has drop down menues for size and style of each set of labels.
// Each set of lines has inputs for line/text color, line width and style.
// I recommend going into Chart Settings/Status Line and turning off indicator arguments OR moving the script to the top
//      of the indicator list to avoid obstructed chart view with this indicators arguments. When script allows, I will update it to hide them.
//New and Improved menu with vertical and horizontal offsets

indicator("High/Low/Open/Close Daily, Weekly, Monthly Line", shorttitle= "D/W/M HLOC", overlay=true)

t = ticker.new(syminfo.prefix, syminfo.ticker)
///////// Label input options and colors //////////

////// Daily line and label options ////

// Show Lines and colors
show_dhloc = input.bool(defval=true, title="Show Daily Lines?", group="Daily High, Low, Open and Close Lines", inline="Daily Line")

show_dh = input.bool(defval=true, title="-", group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")
dhcolor = input(color.rgb(133, 245, 86, 30), title="High", group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")

show_dl = input.bool(defval=true, title="-",  group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")
dlcolor = input(color.rgb(246, 135, 135, 30), title="Low",  group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")

show_do = input.bool(defval=true, title="-",  group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")
docolor = input(color.rgb(120, 167, 241, 30), title="Open",  group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")

show_dc = input.bool(defval=true, title="-",  group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")
dccolor = input(color.rgb(246, 221, 96, 30), title="Close", group="Daily High, Low, Open and Close Lines", inline="Daily Select Line")

// Line style and size
dLineWidth = input.int(1, title="Line Width -  ", minval=1, group="Daily High, Low, Open and Close Lines", inline="Daily Line Style")

dLineStyleOption = input.string(defval="solid (─)",title="  Line Style - ",
     options=["solid (─)", "dotted (┈)", "dashed (╌)",
     "arrow left (←)", "arrow right (→)", "arrows both (↔)"],
     group="Daily High, Low, Open and Close Lines", inline="Daily Line Style")

dLineStyle = (dLineStyleOption == "dotted (┈)") ? line.style_dotted :
     (dLineStyleOption == "dashed (╌)") ? line.style_dashed :
     (dLineStyleOption == "arrow left (←)") ? line.style_arrow_left :
     (dLineStyleOption == "arrow right (→)") ? line.style_arrow_right :
     (dLineStyleOption == "arrows both (↔)") ? line.style_arrow_both :
         line.style_solid


// Daily label options

// Show labels and colors
show_dhlocLabel = input(defval=true, title="Show Daily Labels?", group="Daily Label Options", inline="Daily")
show_dVal = input.bool(defval=true, title="Show Daily Line Value?", group="Daily Label Options", inline="Daily")


dHighLblClr = input(color.rgb(00,153,00,80), title= "High Color", inline="daily label colors")
dLowLblClr = input(color.rgb(204,00,00,80), title= "Low Color", inline="daily label colors")
dOpenLblClr = input(color.rgb(00,102,204,80), title= "Open Color", inline="daily label colors")
dCloseLblClr = input(color.rgb(255,153,51,80), title= "Close Color", inline="daily label colors")

//  Size and style drop down
dSizeOption = input.string(defval="Normal", title="Label Size -  ", options = ["Auto","Huge","Large","Normal","Small","Tiny"], inline="Daily options")
dStyleOption = input.string(title="   Label Style -", options=["Triangle up (▲)", "Triangle down (▼)",
         "Label up (⬆)", "Label down (⬇)", "Plus (+)", "Text Outline", "None"], defval="Text Outline", inline="Daily options")
  

dLabelStyle = (dStyleOption == "Triangle up (▲)") ? label.style_triangleup :
     (dStyleOption == "Triangle down (▼)") ? label.style_triangledown :
     (dStyleOption == "Label up (⬆)") ? label.style_label_up :
     (dStyleOption == "Label down (⬇)") ? label.style_label_down :
     (dStyleOption == "Plus (+)") ? label.style_cross:
     (dStyleOption == "Text Outline") ? label.style_text_outline:
     (dStyleOption == "None") ? label.style_none :
         label.style_label_down
      
dLabelSize = (dSizeOption == "Huge") ? size.huge :
     (dSizeOption == "Large") ? size.large :
     (dSizeOption == "Small") ? size.small :
     (dSizeOption == "Tiny") ? size.tiny :
     (dSizeOption == "Auto") ? size.auto :
         size.normal
      
dLblHOffset = input.int(20, title="Horizontal Offset  ",    inline="Daily offsets")
dLblVOffset = input(3.05,   title=  " Vertical Offset ",    inline="Daily offsets")


////// Weekly line and label options ////

// Show Lines and colors
show_whloc = input.bool(defval=true, title="Show Weekly Lines?", group="Weekly High, Low, Open and Close Lines", inline="Weekly Line")

show_wh = input.bool(defval=true, title="-", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")
whcolor = input(color.rgb(133, 245, 86, 30), title="High", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")

show_wl = input.bool(defval=true, title="-", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")
wlcolor = input(color.rgb(246, 135, 135, 30), title="Low", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")

show_wo = input.bool(defval=true, title="-", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")
wocolor = input(color.rgb(120, 167, 241, 30), title="Open", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")

show_wc = input.bool(defval=true, title="-", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")
wccolor = input(color.rgb(246, 221, 96, 30), title="Close", group="Weekly High, Low, Open and Close Lines", inline="Weekly Select Line")

// Line style and size
wLineWidth = input.int(1, title="Line Width -  ", minval=1, group="Weekly High, Low, Open and Close Lines", inline="Weekly Line Style")

wLineStyleOption = input.string(defval="solid (─)",title="  Line Style - ",
     options=["solid (─)", "dotted (┈)", "dashed (╌)",
     "arrow left (←)", "arrow right (→)", "arrows both (↔)"],
     group="Weekly High, Low, Open and Close Lines", inline="Weekly Line Style")

wLineStyle = (wLineStyleOption == "dotted (┈)") ? line.style_dotted :
     (wLineStyleOption == "dashed (╌)") ? line.style_dashed :
     (wLineStyleOption == "arrow left (←)") ? line.style_arrow_left :
     (wLineStyleOption == "arrow right (→)") ? line.style_arrow_right :
     (wLineStyleOption == "arrows both (↔)") ? line.style_arrow_both :
         line.style_solid


// Weekly label options

// Show labels and colors
show_whlocLabel = input(defval=true, title="Show Weekly Labels?", group="Weekly Label Options", inline="Weekly")
show_wVal = input.bool(defval=true, title="Show Weekly Line Value?", group="Weekly Label Options", inline="Weekly")


wHighLblClr = input(color.rgb(00,153,00,80), title= "High Color", inline="weekly label colors")
wLowLblClr = input(color.rgb(204,00,00,80), title= "Low Color",  inline="weekly label colors")
wOpenLblClr = input(color.rgb(00,102,204,80), title= "Open Color", inline="weekly label colors")
wCloseLblClr = input(color.rgb(255,153,51,80), title= "Close Color", inline="weekly label colors")

//  Size and style drop down
wSizeOption = input.string(defval="Normal", title="Label Size -  ", options = ["Auto","Huge","Large","Normal","Small","Tiny"], inline="Weekly options")
wStyleOption = input.string(title="   Label Style -", options=["Triangle up (▲)", "Triangle down (▼)",
         "Label up (⬆)", "Label down (⬇)", "Plus (+)", "Text Outline", "None"], defval="Text Outline", inline= "Weekly options")
  

wLabelStyle = (wStyleOption == "Triangle up (▲)") ? label.style_triangleup :
     (wStyleOption == "Triangle down (▼)") ? label.style_triangledown :
     (wStyleOption == "Label up (⬆)") ? label.style_label_up :
     (wStyleOption == "Label down (⬇)") ? label.style_label_down :
     (wStyleOption == "Plus (+)") ? label.style_cross:
     (wStyleOption == "Text Outline") ? label.style_text_outline:
     (wStyleOption == "None") ? label.style_none :
         label.style_label_down
      
wLabelSize = (wSizeOption == "Huge") ? size.huge :
     (wSizeOption == "Large") ? size.large :
     (wSizeOption == "Small") ? size.small :
     (wSizeOption == "Tiny") ? size.tiny :
     (wSizeOption == "Auto") ? size.auto :
         size.normal

wLblHOffset = input.int(40, title="Horizontal Offset  ",    inline="Weekly offsets")
wLblVOffset = input(3.05,   title=  " Vertical Offset ",    inline="Weekly offsets")

////// Monthly line and label options ////

// Show Lines and colors
show_mhloc = input.bool(defval=true, title="Show Monthly Lines?", group="Monthly High, Low, Open and Close Lines", inline="Monthly Line")

show_mh = input.bool(defval=true, title="-", group="Monthly High, Low, Open and Close Lines", inline="Select Line")
mhcolor = input(color.rgb(133, 245, 86, 30), title="High", group="Monthly High, Low, Open and Close Lines", inline="Select Line")

show_ml = input.bool(defval=true, title="-",group="Monthly High, Low, Open and Close Lines", inline="Select Line")
mlcolor = input(color.rgb(246, 135, 135, 30), title="Low", group="Monthly High, Low, Open and Close Lines", inline="Select Line")

show_mo = input.bool(defval=true, title="-", group="Monthly High, Low, Open and Close Lines", inline="Select Line")
mocolor = input(color.rgb(120, 167, 241, 30), title="Open", group="Monthly High, Low, Open and Close Lines", inline="Select Line")

show_mc = input.bool(defval=true, title="-", group="Monthly High, Low, Open and Close Lines", inline="Select Line")
mccolor = input(color.rgb(246, 221, 96, 30), title="Close", group="Monthly High, Low, Open and Close Lines", inline="Select Line")

// Line style and size
mLineWidth = input.int(1, title="Line Width -  ", minval=1, group="Monthly High, Low, Open and Close Lines", inline="Monthly Line Style")

mLineStyleOption = input.string(defval="solid (─)",title="  Line Style - ",
     options=["solid (─)", "dotted (┈)", "dashed (╌)",
     "arrow left (←)", "arrow right (→)", "arrows both (↔)"],
      group="Monthly High, Low, Open and Close Lines", inline="Monthly Line Style")

mLineStyle = (mLineStyleOption == "dotted (┈)") ? line.style_dotted :
     (mLineStyleOption == "dashed (╌)") ? line.style_dashed :
     (mLineStyleOption == "arrow left (←)") ? line.style_arrow_left :
     (mLineStyleOption == "arrow right (→)") ? line.style_arrow_right :
     (mLineStyleOption == "arrows both (↔)") ? line.style_arrow_both :
         line.style_solid

// Monthly label options

// Show labels and colors
show_mhlocLabel = input(defval=true, title="Show Monthly Labels?",    group="Monthly Label Options", inline="Monthly")
show_mVal = input.bool(defval=true, title="Show Monthly Line Value?", group="Monthly Label Options", inline="Monthly")


mHighLblClr = input(color.rgb(00,153,00,80), title= "High Color", inline="monthly label colors")
mLowLblClr = input(color.rgb(204,00,00,80), title= "Low Color",  inline="monthly label colors")
mOpenLblClr = input(color.rgb(00,102,204,80), title= "Open Color", inline="monthly label colors")
mCloseLblClr = input(color.rgb(255,153,51,80), title= "Close Color", inline="monthly label colors")

//  Size and style drop down
mSizeOption = input.string(defval="Normal", title="Label Size -  ", options = ["Auto","Huge","Large","Normal","Small","Tiny"], inline="Monthly Options")
mStyleOption = input.string(title="   Label Style -", options=["Triangle up (▲)", "Triangle down (▼)",
         "Label up (⬆)", "Label down (⬇)", "Plus (+)", "Text Outline", "None"], defval="Text Outline", inline="Monthly Options")
  

mLabelStyle = (mStyleOption == "Triangle up (▲)") ? label.style_triangleup :
     (mStyleOption == "Triangle down (▼)") ? label.style_triangledown :
     (mStyleOption == "Label up (⬆)") ? label.style_label_up :
     (mStyleOption == "Label down (⬇)") ? label.style_label_down :
     (mStyleOption == "Plus (+)") ? label.style_cross:
     (mStyleOption == "Text Outline") ? label.style_text_outline:
     (mStyleOption == "None") ? label.style_none :
         label.style_label_down
      
mLabelSize = (mSizeOption == "Huge") ? size.huge :
     (mSizeOption == "Large") ? size.large :
     (mSizeOption == "Small") ? size.small :
     (mSizeOption == "Tiny") ? size.tiny :
     (mSizeOption == "Auto") ? size.auto :
         size.normal
      
mLblHOffset = input.int(50, title="Horizontal Offset  ",     inline="Monthly offsets")
mLblVOffset = input(3.05,   title=  " Vertical Offset ",    inline="Monthly offsets")

 
////////HLOC Lines and Label Plots///////


// Daily HLOC
// Call daily data

dhigh  = request.security(t, 'D', high[1])
dlow   = request.security(t, 'D', low[1])
dopen  = request.security(t, 'D', open[1])
dclose = request.security(t, 'D', close[1])



// Line Conditions

if (show_dhloc)
    if (show_dh)
        dh_line = line.new(x1=bar_index-1, y1=dhigh, color=dhcolor, x2=bar_index, y2=dhigh, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(dh_line[1])
    if (show_dl)
        dl_line = line.new(x1=bar_index-1, y1=dlow, color=dlcolor, x2=bar_index, y2=dlow, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(dl_line[1])
    if (show_do)
        do_line = line.new(x1=bar_index-1, y1=dopen, color=docolor, x2=bar_index, y2=dopen, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(do_line[1])
    if (show_dc)
        dc_line = line.new(x1=bar_index-1, y1=dclose, color=dccolor, x2=bar_index, y2=dclose, xloc=xloc.bar_index, style=dLineStyle, width=dLineWidth , extend=extend.both)
        line.delete(dc_line[1])


// Daily Labels //

// Label Value String

dHigh = str.tostring(dhigh, format.mintick)
dhValNa = " "
string dhVal =  if show_dVal
    dHigh
else
    dhValNa
 
dLow = str.tostring(dlow, format.mintick)
dlValNa = " "
string dlVal =  if show_dVal
    dLow
else
    dlValNa
 
dOpen = str.tostring(dopen, format.mintick)
doValNa = " "
string doVal =  if show_dVal
    dOpen
else
    doValNa
 
dClose = str.tostring(dclose, format.mintick)
dcValNa = " "
string dcVal =  if show_dVal
    dClose
else
    dcValNa


// Label Conditions

if (show_dhlocLabel) and (show_dhloc)
    if (show_dh)
        dHighLabel = label.new(x=bar_index-1, y=dhigh, xloc=xloc.bar_index[0],
          color=(dHighLblClr), textcolor=dhcolor,
          style=dLabelStyle)
        label.set_text(id=dHighLabel, text=" Daily High "+ str.tostring(dhVal))
        label.set_size(dHighLabel,dLabelSize)
        label.set_y(dHighLabel, dhigh + dLblVOffset)
        label.set_x(dHighLabel, label.get_x(dHighLabel) + dLblHOffset)
        label.delete(dHighLabel[1])
    if (show_dl)
        dlowLabel = label.new(x=bar_index-1, y=dlow, xloc=xloc.bar_index[0],
          color=(dLowLblClr), textcolor=dlcolor,
          style=dLabelStyle)
        label.set_text(id=dlowLabel, text=" Daily Low "+ str.tostring(dlVal))
        label.set_size(dlowLabel,dLabelSize)
        label.set_y(dlowLabel, dlow - dLblVOffset)
        label.set_x(dlowLabel, label.get_x(dlowLabel) + dLblHOffset)
        label.delete(dlowLabel[1])
    if (show_do)
        dopenLabel = label.new(x=bar_index-1, y=dopen, xloc=xloc.bar_index[0],
          color=(dOpenLblClr), textcolor=docolor,
          style=dLabelStyle)
        label.set_text(id=dopenLabel, text=" Daily Open "+ str.tostring(doVal))
        label.set_size(dopenLabel,dLabelSize)
        label.set_y(dopenLabel, dopen + dLblVOffset)
        label.set_x(dopenLabel, label.get_x(dopenLabel) + dLblHOffset)
        label.delete(dopenLabel[1])
    if (show_dc)
        dcloseLabel = label.new(x=bar_index-1, y=dclose, xloc=xloc.bar_index[0],
          color=(dCloseLblClr), textcolor=dccolor,
          style=dLabelStyle)
        label.set_text(id=dcloseLabel, text=" Daily Close "+ str.tostring(dcVal))
        label.set_size(dcloseLabel,dLabelSize)
        label.set_y(dcloseLabel, dclose - dLblVOffset)
        label.set_x(dcloseLabel, label.get_x(dcloseLabel) + dLblHOffset)
        label.delete(dcloseLabel[1])

 
 
// Weekly HLOC

// Call weekly data
whigh  = request.security(t, 'W', high[1])
wlow   = request.security(t, 'W', low[1])
wopen  = request.security(t, 'W', open[1])
wclose = request.security(t, 'W', close[1])



// Line Condition

if (show_whloc)
    if (show_wh)
        wh_line = line.new(x1=bar_index-1, y1=whigh, color=whcolor, x2=bar_index, y2=whigh, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth , extend=extend.both)
        line.delete(wh_line[1])
    if (show_wl)
        wl_line = line.new(x1=bar_index-1, y1=wlow, color=wlcolor, x2=bar_index, y2=wlow, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth  , extend=extend.both)
        line.delete(wl_line[1])
    if (show_wo)
        wo_line = line.new(x1=bar_index-1, y1=wopen, color=wocolor, x2=bar_index, y2=wopen, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth , extend=extend.both)
        line.delete(wo_line[1])
    if (show_wc)
        wc_line = line.new(x1=bar_index-1, y1=wclose, color=wccolor, x2=bar_index, y2=wclose, xloc=xloc.bar_index, style=wLineStyle, width=wLineWidth , extend=extend.both)
        line.delete(wc_line[1])
 
 
// Weekly Labels//

// Label Value String

wHigh = str.tostring(whigh, format.mintick)
whValNa = " "
string whVal =  if show_wVal
    wHigh
else
    whValNa
 
wLow = str.tostring(wlow, format.mintick)
wlValNa = " "
string wlVal =  if show_wVal
    wLow
else
    wlValNa
 
wOpen = str.tostring(wopen, format.mintick)
woValNa = " "
string woVal =  if show_wVal
    wOpen
else
    woValNa
 
wClose = str.tostring(wclose, format.mintick)
wcValNa = " "
string wcVal =  if show_wVal
    wClose
else
    wcValNa
 

// Label Conditions
 
if (show_whlocLabel) and (show_whloc)

    if (show_wh)
        wHighLabel = label.new(x=bar_index-1, y=whigh, xloc=xloc.bar_index[0],
          color=(wHighLblClr), textcolor=whcolor,
          style=wLabelStyle)
        label.set_text(id=wHighLabel, text=" Weekly High "+ str.tostring(whVal))
        label.set_size(wHighLabel,wLabelSize)
        label.set_y(wHighLabel, whigh + wLblVOffset)
        label.set_x(wHighLabel, label.get_x(wHighLabel) + wLblHOffset)
        label.delete(wHighLabel[1])
    if (show_wl)
        wlowLabel = label.new(x=bar_index-1, y=wlow, xloc=xloc.bar_index[0],
          color=(wLowLblClr), textcolor=wlcolor,
          style=wLabelStyle)
        label.set_text(id=wlowLabel, text=" Weekly Low "+ str.tostring(wlVal))
        label.set_size(wlowLabel,wLabelSize)
        label.set_y(wlowLabel, wlow - wLblVOffset)
        label.set_x(wlowLabel, label.get_x(wlowLabel) + wLblHOffset)
        label.delete(wlowLabel[1])
    if (show_wo)
        wopenLabel = label.new(x=bar_index-1, y=wopen, xloc=xloc.bar_index[0],
          color=(wOpenLblClr), textcolor=wocolor,
          style=wLabelStyle)
        label.set_text(id=wopenLabel, text=" Weekly Open "+ str.tostring(woVal))
        label.set_size(wopenLabel,wLabelSize)
        label.set_y(wopenLabel, wopen + wLblVOffset)
        label.set_x(wopenLabel, label.get_x(wopenLabel) + wLblHOffset)
        label.delete(wopenLabel[1])
    if (show_wc)
        wcloseLabel = label.new(x=bar_index-1, y=wclose, xloc=xloc.bar_index[0],
          color=(wCloseLblClr), textcolor=wccolor,
          style=wLabelStyle)
        label.set_text(id=wcloseLabel, text=" Weekly Close "+ str.tostring(wcVal))
        label.set_size(wcloseLabel,wLabelSize)
        label.set_y(wcloseLabel, wclose - wLblVOffset)
        label.set_x(wcloseLabel, label.get_x(wcloseLabel) + wLblHOffset)
        label.delete(wcloseLabel[1])
 

// Monthly HLOC  //

// Call monthly data
mhigh  = request.security(t, 'M', high[1])
mlow   = request.security(t, 'M', low[1])
mopen  = request.security(t, 'M', open[1])
mclose = request.security(t, 'M', close[1])





// Line Condition
if (show_mhloc)
    if (show_mh)
        mh_line = line.new(x1=bar_index-1, y1=mhigh, color=mhcolor, x2=bar_index, y2=mhigh, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(mh_line[1])
    if (show_ml)
        ml_line = line.new(x1=bar_index-1, y1=mlow, color=mlcolor, x2=bar_index, y2=mlow, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(ml_line[1])
    if (show_mo)
        mo_line = line.new(x1=bar_index-1, y1=mopen, color=mocolor, x2=bar_index, y2=mopen, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(mo_line[1])
    if (show_mc)
        mc_line = line.new(x1=bar_index-1, y1=mclose, color=mccolor, x2=bar_index, y2=mclose, xloc=xloc.bar_index, style=mLineStyle, width=mLineWidth , extend=extend.both)
        line.delete(mc_line[1])


// Monthly Labels //

// Label Value String

mHigh = str.tostring(mhigh, format.mintick)
mhValNa = " "
string mhVal =  if show_mVal
    mHigh
else
    mhValNa
 
mLow = str.tostring(mlow, format.mintick)
mlValNa = " "
string mlVal =  if show_mVal
    mLow
else
    mlValNa
 
mOpen = str.tostring(mopen, format.mintick)
moValNa = " "
string moVal =  if show_mVal
    mOpen
else
    moValNa
 
mClose = str.tostring(mclose, format.mintick)
mcValNa = " "
string mcVal =  if show_mVal
    mClose
else
    mcValNa



// Label Condition
 
if (show_mhlocLabel) and (show_mhloc)
    if (show_mh)
        mHighLabel = label.new(x=bar_index-1, y=mhigh, xloc=xloc.bar_index[0],
          color=(mHighLblClr), textcolor=mhcolor,
          style=mLabelStyle)
        label.set_text(id=mHighLabel, text=" Monthly High "+ str.tostring(mhVal))
        label.set_size(mHighLabel,mLabelSize)
        label.set_y(mHighLabel, mhigh + mLblVOffset)
        label.set_x(mHighLabel, label.get_x(mHighLabel) + mLblHOffset)
        label.delete(mHighLabel[1])
    if (show_ml)
        mlowLabel = label.new(x=bar_index-1, y=mlow, xloc=xloc.bar_index[0],
          color=(mLowLblClr), textcolor=mlcolor,
          style=mLabelStyle)
        label.set_text(id=mlowLabel, text=" Monthly Low "+ str.tostring(mlVal))
        label.set_size(mlowLabel,mLabelSize)
        label.set_y(mlowLabel, mlow - mLblVOffset)
        label.set_x(mlowLabel, label.get_x(mlowLabel) + mLblHOffset)
        label.delete(mlowLabel[1])
    if (show_mo)
        mopenLabel = label.new(x=bar_index-1, y=mopen, xloc=xloc.bar_index[0],
          color=(mOpenLblClr), textcolor=mocolor,
          style=mLabelStyle)
        label.set_text(id=mopenLabel, text=" Monthly Open "+ str.tostring(moVal))
        label.set_size(mopenLabel,mLabelSize)
        label.set_y(mopenLabel, mopen + mLblVOffset)
        label.set_x(mopenLabel, label.get_x(mopenLabel) + mLblHOffset)
        label.delete(mopenLabel[1])
    if (show_mc)
        mcloseLabel = label.new(x=bar_index-1, y=mclose, xloc=xloc.bar_index[0],
          color=(mCloseLblClr), textcolor=mccolor,
          style=mLabelStyle)
        label.set_text(id=mcloseLabel, text=" Monthly Close "+ str.tostring(mcVal))
        label.set_size(mcloseLabel,mLabelSize)
        label.set_y(mcloseLabel, mclose - mLblVOffset)
        label.set_x(mcloseLabel, label.get_x(mcloseLabel) + mLblHOffset)
        label.delete(mcloseLabel[1])
I removed some of the code for the things you weren't interested in and here am just showing HLOC for the previous Month and previous Week:

36l5qXx.png


Hope it helps. Good luck!

Ruby:
# Created by @tony_futures
# Plot Monthly/Weekly levels 
#hint: This study plot HLOC levels for Monthly and Weekly timeframes
#hint ShowBubblesLeft: Will show the bubbles on the left - turn to no to show on the right

def NAN = Double.NaN;

input addPeriod1 = AggregationPeriod.DAY;
input addPeriod2 = AggregationPeriod.WEEK;
input addPeriod3 = AggregationPeriod.MONTH;
input showOpens = no;
input showCloses = no;
input showDayBubbles = yes;
input showWeeklyBubbles = yes;
input showMonthlyBubbles = yes;
#input showDaily = yes;
input showBubblesLeft = yes;
input showValuesInBubbles = no;
#input RoundLevel = 0;
input displaceBubbles = 3;

# setup Colors
DefineGlobalColor("lowColor", CreateColor(109, 59, 81));
DefineGlobalColor("highColor", CreateColor(59, 109, 88));
DefineGlobalColor("openColor", CreateColor(169, 169, 169));
DefineGlobalColor("closeColor", Color.DARK_GRAY);

#def Today = if GetLastDay() == GetDay() then 1 else 0;
def showBubbleNow = !IsNaN(close) and IsNaN(close[-1]);
# plot Daily Levels;


# Weekly Levels
def ThisWeek = if GetLastWeek() == GetWeek() then yes else 0;
plot prevWeekOpen = if ThisWeek and showOpens then open("period"=addPeriod2)[1] else NAN;
plot prevWeekClose = if ThisWeek and showCloses then close("period"=addPeriod2)[1] else NAN;
plot prevWeekLow = if ThisWeek then low("period"=addPeriod2)[1] else NAN;
plot prevWeekHigh = if ThisWeek then high("period"=addPeriod2)[1] else NAN;
prevweekLow.SetDefaultColor(GlobalColor("lowColor"));
prevWeekLow.hideBubble();
prevWeekHigh.SetDefaultColor(GlobalColor("highColor"));
prevWeekHigh.hideBubble();
prevWeekOpen.SetDefaultColor(GlobalColor("openColor"));
prevWeekOpen.hideBubble();
prevWeekClose.SetDefaultColor(GlobalColor("closeColor"));
prevWeekClose.hideBubble();

AddChartBubble(showOpens and showWeeklyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], prevWeekOpen, if showValuesInBubbles then "Prev Weekly Open: " + prevWeekOpen else "Prev Week Open", GlobalColor("openColor"), yes);
AddChartBubble(showWeeklyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles],PrevWeekLow, if showValuesInBubbles then "Weekly Low: " + PrevWeekLow else "Prev Weekly Low", GlobalColor("lowColor"), no);
AddChartBubble(showWeeklyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], PrevWeekHigh, if showValuesInBubbles then "Weekly High: " + PrevWeekHigh else "Prev Weekly High", GlobalColor("highColor"), yes);
AddChartBubble(showOpens and showWeeklyBubbles and showBubblesLeft and thisWeek and !thisWeek[1], prevWeekOpen, if showValuesInBubbles then "Prev Weekly Open: " + prevWeekOpen else "Prev Week Open", GlobalColor("openColor"), yes);
AddChartBubble(showWeeklyBubbles and showBubblesLeft and thisWeek and !thisWeek[1],PrevWeekLow, if showValuesInBubbles then "Weekly Low: " + PrevWeekLow else "Prev Weekly Low", GlobalColor("lowColor"), no);
AddChartBubble(showWeeklyBubbles and showBubblesLeft and thisWeek and !thisWeek[1], PrevWeekHigh, if showValuesInBubbles then "Weekly High: " + PrevWeekHigh else "Prev Weekly High", GlobalColor("highColor"), yes);

# Monthly Levels
input showMonthly = yes;
def ThisMonth = GetLastMonth() == GetMonth();
def prevMoOpen = open("period"=addPeriod3)[1];
plot prevMonthOpen = if showMonthly and showOpens and ThisMonth then prevMoOpen else NAN;
def prevMoClose = close("period"=addPeriod3)[1];
plot prevMonthClose = if showMonthly and showOpens and ThisMonth then prevMoClose else NAN;
plot prevMonthLow = if showMonthly and ThisMonth then low("period"=addPeriod3)[1] else NAN;
plot prevMonthHigh = if showMonthly and ThisMonth then high("period"=addPeriod3)[1] else NAN;
prevMonthLow.SetDefaultColor(GlobalColor("lowColor"));
prevMonthLow.hideBubble();
prevMonthHigh.SetDefaultColor(GlobalColor("highColor"));
prevMonthHigh.hideBubble();
prevMonthOpen.SetDefaultColor(GlobalColor("openColor"));
prevMonthOpen.hideBubble();
prevMonthClose.SetDefaultColor(GlobalColor("closeColor"));
prevMonthClose.hideBubble();

AddChartBubble(showMonthlyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], prevMonthOpen, if showValuesInBubbles then "Prev Monthly Open: " + prevMonthOpen else "Prev Monthly Open", GlobalColor("openColor"), yes);
AddChartBubble(showMonthlyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles],PrevMonthLow, if showValuesInBubbles then "Prev Monthly Low: " + PrevMonthLow else "Prev Monthly Low", GlobalColor("lowColor"), no);
AddChartBubble(showMonthlyBubbles and !showBubblesLeft and showBubbleNow[displaceBubbles], PrevMonthHigh, if showValuesInBubbles then "Prev Monthly High: " + PrevMonthHigh else "Prev Monthly High", GlobalColor("highColor"), yes);

AddChartBubble(showMonthlyBubbles and showBubblesLeft and thisMonth and !thisMonth[1], prevMonthOpen, if showValuesInBubbles then "Prev Monthly Open: " + prevMonthOpen else "Prev Monthly Open", GlobalColor("openColor"), yes);
AddChartBubble(showMonthlyBubbles and showBubblesLeft and thisMonth and !thisMonth[1],PrevMonthLow, if showValuesInBubbles then "Prev Monthly Low: " + PrevMonthLow else "Prev Monthly Low", GlobalColor("lowColor"), no);
AddChartBubble(showMonthlyBubbles and showBubblesLeft and thisMonth and !thisMonth[1], PrevMonthHigh, if showValuesInBubbles then "Prev Monthly High: " + PrevMonthHigh else "Prev Monthly High", GlobalColor("highColor"), yes);

input showVertical = yes;
AddVerticalLine(showVertical and thisMonth and !thisMonth[1], " Month Start", GlobalColor("openColor"));
AddVerticalLine(showVertical and thisWeek and !thisWeek[1], " Week Start", GlobalColor("openColor"));
 
Wow - thank you Tony! I will check this out and get back to you. Hopefully, I can turn on and off the open and closes.
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
394 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top