You are a professional PineScript version=5 developer.
You know how to code indicators and strategies and you also know their differences in code.
I need your help to turn a TradingView indicator into a strategy please.

Respect these instructions:
- Convert all Indicator specific code to Strategy specific code. Don't use any code that a TradingView Strategy won't support. Especially timeframes and gaps. Define those in code so they are semantically the same as before.

- Preserve the timeframe logic if there is one. Fill gaps.

- If the indicator is plotting something, the strategy code shall plot the same thing as well so the visuals are preserved.

- Don't trigger a short. Simply go Long and Flat.

- Always use 5% of capital.

- Set commission to 0.1%.

- Set slippage to 3.

- strategy.commission.percent and strategy.slippage don't exist in PineScript. Please avoid this mistake. Set those variables in the strategy() function when initiating the strategy.

- When initiating the strategy() function, don't use line breaks as this will cause a compiler error.

- Leave all other strategy settings to default values (aka. don't set them at all).

- Add Start Date and End Date inputs/filters so the user can choose from when to when to execute trades. Start with 1st January 2020 and go to 31st December 2050.

- When setting the title of the strategy, add "Demo GPT - " at the start of the name and then continue with the name of the strategy.


This is the code of the Indicator you shall migrate to a TradingView Strategy:



//@version=5
//The Average Daily Range is a simple concept, calculated as the difference between daily highs and lows averaged over some period.
//This indicator uses that range in conjunction with Fibonacci ratios to create zones centered on the day's open that tends to act as areas of support and resistance.
//
//A simpler version of this concept can be seen in my other script, Average Daily Range Zones,
//which does not include the Fibonacci ratio zones.
//
//Thanks to @Hank Hill for the original idea and ToS script this is based on, and
//TV for the feedback and support on the use of the security() function.
//Also thanks to @GoldenCross for the Fibonacci obsession.

//For future reference; an sma() on a security return is not the same as a security() with an sma argument.
// i.e., security(tickerid, 'D', sma(dayRange, length)) != sma(security(tickerid, 'D', dayRange), length)

//Includes TradingView's own f_security function for better historical data.

indicator('Daily Fibs Levels', 'Daily Fibs Levels', overlay=true)
firstLength = input(50, title='ADR Calculation Period (Days)')
calcType = input.string("Basic", title = "Fibs Calculation", options=["Basic", "Standard Deviation", "Variance"])

showFib1 = input.bool(true, title='', group='Fibonacci Levels', inline='1')
fibLevel1 = input.float(0.25, title='', group='Fibonacci Levels', inline='1')
fib1Color = input.color(#F44336, title='', group='Fibonacci Levels', inline='1')
showFib1_line = input.bool(true, title='Line', group='Fibonacci Levels', inline='1')
fib1Alert = input.bool(false, title='Alert', group='Fibonacci Levels', inline='1')

showFib2 = input.bool(false, title='', group='Fibonacci Levels', inline='2')
fibLevel2 = input.float(0.382, title='', group='Fibonacci Levels', inline='2')
fib2Color = input.color(#81C784, title='', group='Fibonacci Levels', inline='2')
showFib2_line = input.bool(false, title='Line', group='Fibonacci Levels', inline='2')
fib2Alert = input.bool(false, title='Alert', group='Fibonacci Levels', inline='2')

showFib3 = input.bool(true, title='', group='Fibonacci Levels', inline='3')
fibLevel3 = input.float(0.77, title='', group='Fibonacci Levels', inline='3')
fib3Color = input.color(color.rgb(20, 158, 151), title='', group='Fibonacci Levels', inline='3')
showFib3_line = input.bool(false, title='Line', group='Fibonacci Levels', inline='3')
fib3Alert = input.bool(false, title='Alert', group='Fibonacci Levels', inline='3')

showFib4 = input.bool(false, title='', group='Fibonacci Levels', inline='4')
fibLevel4 = input.float(0.618, title='', group='Fibonacci Levels', inline='4')
fib4Color = input.color(#009688, title='', group='Fibonacci Levels', inline='4')
showFib4_line = input.bool(false, title='Line', group='Fibonacci Levels', inline='4')
fib4Alert = input.bool(false, title='Alert', group='Fibonacci Levels', inline='4')

showFib5 = input.bool(true, title='', group='Fibonacci Levels', inline='5')
fibLevel5 = input.float(0.786, title='', group='Fibonacci Levels', inline='5')
fib5Color = input.color(#FFFFFF, title='', group='Fibonacci Levels', inline='5')
showFib5_line = input.bool(true, title='Line', group='Fibonacci Levels', inline='5')
fib5Alert = input.bool(false, title='Alert', group='Fibonacci Levels', inline='5')

showFib6 = input.bool(true, title='', group='Fibonacci Levels', inline='6')
fibLevel6 = input.int(1, title='', group='Fibonacci Levels', inline='6')
fib6Color = input.color(#FFFFFF, title='', group='Fibonacci Levels', inline='6')
showFib6_line = input.bool(true, title='Line', group='Fibonacci Levels', inline='6')
fib6Alert = input.bool(true, title='Alert', group='Fibonacci Levels', inline='6')

showFib7 = input.bool(false, title='', inline='7', group='Overridden by Dynamic Mode')
fibLevel7 = input.float(1.618, title='', inline='7', group='Overridden by Dynamic Mode')
fib7Color = input.color(#2196F3, title='', inline='7', group='Overridden by Dynamic Mode')
showFib7_line = input.bool(false, title='Line', group='Overridden by Dynamic Mode', inline='7')
fib7Alert = input.bool(false, title='Alert', group='Overridden by Dynamic Mode', inline='7')

showFib8 = input.bool(false, title='', inline='8', group='Overridden by Dynamic Mode')
fibLevel8 = input.float(2.618, title='', inline='8', group='Overridden by Dynamic Mode')
fib8Color = input.color(#F44336, title='', inline='8', group='Overridden by Dynamic Mode')
showFib8_line = input.bool(false, title='Line', group='Overridden by Dynamic Mode', inline='8')
fib8Alert = input.bool(false, title='Alert', group='Overridden by Dynamic Mode', inline='8')

showFib9 = input.bool(false, title='', inline='9', group='Overridden by Dynamic Mode')
fibLevel9 = input.float(3.618, title='', inline='9', group='Overridden by Dynamic Mode')
fib9Color = input.color(#9C27B0, title='', inline='9', group='Overridden by Dynamic Mode')
showFib9_line = input.bool(false, title='Line', group='Overridden by Dynamic Mode', inline='9')
fib9Alert = input.bool(false, title='Alert', group='Overridden by Dynamic Mode', inline='9')

showFib10 = input.bool(false, title='', inline='10', group='Overridden by Dynamic Mode')
fibLevel10 = input.float(4.236, title='', inline='10', group='Overridden by Dynamic Mode')
fib10Color = input.color(#E91E63, title='', inline='10', group='Overridden by Dynamic Mode')
showFib10_line = input.bool(false, title='Line', group='Overridden by Dynamic Mode', inline='10')
fib10Alert = input.bool(false, title='Alert', group='Overridden by Dynamic Mode', inline='10')

dynamic = input(false, title='Dynamically Show Zones Outside ADR')


openColor = input.color(#ffffff, title='Open Plot Color')
fibScale = input.float(1, step = 0.1, title='Fibonacci Scale', tooltip = "Allows custom scale of the fib levels; 1.0 is default and puts the 1.0 fib level at ADR.")
lineVisibility = 100 - input.int(70, minval=0, maxval=100, step=5, title='Line Visibility % (Transparency)')
fillVisibility = 100 - input.int(20, minval=0, maxval=100, step=5, title='Fill Visibility % (Transparency)')
scaledVisibility = fillVisibility + 0 * ((100 - fillVisibility) / 100)
scaledLineVisibility = lineVisibility + 0 * ((100 - lineVisibility) / 100)
showPrices = input(false, title='Show Price Lines')
showZonesFill = input(true, title='Fill Zones')
showZonesOnly = input(false, title='Show Zones Only')
showTodayOnly = input(false, title='Plot For Today Only')
disableNonIntraday = input(true, title='Disable On Daily or Above')

isToday = false
if year(timenow) == year(time) and month(timenow) == month(time) and dayofmonth(timenow) == dayofmonth(time)
    isToday := true
if not showTodayOnly
    isToday := true
    
i_timeframe = input.timeframe(title='Custom Timeframe', defval='D')
bool i_reminder = false
var string ticker = syminfo.tickerid

bool enabled = true
if (disableNonIntraday and not timeframe.isintraday)
    enabled := false
    
//▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
f_security(_sym, _res, _src) =>
    request.security(_sym, _res, _src[barstate.isrealtime ? 1 : 0], barmerge.gaps_off, lookahead=barmerge.lookahead_off)[barstate.isrealtime ? 0 : 1]
f_security_lookahead(_sym, _res, _src) =>
    request.security(_sym, _res, _src[barstate.isrealtime ? 1 : 0], barmerge.gaps_off, lookahead=barmerge.lookahead_on)[barstate.isrealtime ? 0 : 1]
//▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲

dayOpen = request.security(ticker, i_timeframe, open, barmerge.gaps_off, barmerge.lookahead_on)
dayHigh = f_security(ticker, i_timeframe, high)
dayLow = f_security(ticker, i_timeframe, low)


//adr_high_1 = plot(enabled and isToday ? dayOpen + avgRange_1 / 2 : na, color=dayOpen != dayOpen[1] ? na : color.new(color.white, 30), linewidth=1, title="ADR High", style=plot.style_linebr)
//adr_low_1 = plot(enabled and isToday ? dayOpen - avgRange_1 / 2 : na, color=dayOpen != dayOpen[1] ? na : color.new(color.white, 30), linewidth=1, title="ADR Low", style=plot.style_linebr)

dayRange = dayHigh - dayLow
avgRange_1 = f_security(ticker, i_timeframe, ta.sma(dayRange, firstLength))
dailyRange_stDev    = f_security(ticker, i_timeframe, ta.stdev(dayRange, firstLength))
dailyRange_variance = f_security(ticker, i_timeframe, ta.variance(dayRange, firstLength))
dailyRange_calc     = calcType == "Variance" ? dailyRange_variance : dailyRange_stDev

//Fib Levels

fibRange_1 = avgRange_1 * fibLevel1 * fibScale / 2
fibRange_2 = avgRange_1 * fibLevel2 * fibScale / 2
fibRange_3 = avgRange_1 * fibLevel3 * fibScale / 2
fibRange_4 = avgRange_1 * fibLevel4 * fibScale / 2
fibRange_5 = avgRange_1 * fibLevel5 * fibScale / 2
fibRange_6 = avgRange_1 * fibLevel6 * fibScale / 2
fibRange_7 = avgRange_1 * fibLevel7 * fibScale / 2
fibRange_8 = avgRange_1 * fibLevel8 * fibScale / 2
fibRange_9 = avgRange_1 * fibLevel9 * fibScale / 2
fibRange_10 = avgRange_1 * fibLevel10 * fibScale / 2

if (calcType != "Basic")
    fibRange_1  := dailyRange_calc * fibLevel1 * fibScale / 2
    fibRange_2  := dailyRange_calc * fibLevel2 * fibScale / 2
    fibRange_3  := dailyRange_calc * fibLevel3 * fibScale / 2
    fibRange_4  := dailyRange_calc * fibLevel4 * fibScale / 2
    fibRange_5  := dailyRange_calc * fibLevel5 * fibScale / 2
    fibRange_6  := dailyRange_calc * fibLevel6 * fibScale / 2
    fibRange_7  := dailyRange_calc * fibLevel7 * fibScale / 2
    fibRange_8  := dailyRange_calc * fibLevel8 * fibScale / 2
    fibRange_9  := dailyRange_calc * fibLevel9 * fibScale / 2
    fibRange_10 := dailyRange_calc * fibLevel10 * fibScale / 2

hod = request.security(ticker, i_timeframe, high, barmerge.gaps_off, barmerge.lookahead_on)
lod = request.security(ticker, i_timeframe, low, barmerge.gaps_off, barmerge.lookahead_on)

showFib2Low = showFib2
showFib3Low = showFib3
showFib4Low = showFib4
showFib5Low = showFib5
showFib6Low = showFib6
showFib7Low = showFib7
showFib8Low = showFib8
showFib9Low = showFib9
showFib10Low = showFib10

if dynamic
    showFib7 := hod > dayOpen + fibRange_6
    showFib7Low := lod < dayOpen - fibRange_6
    showFib8 := hod > dayOpen + fibRange_7
    showFib8Low := lod < dayOpen - fibRange_7
    showFib9 := hod > dayOpen + fibRange_8
    showFib9Low := lod < dayOpen - fibRange_8
    showFib10 := hod > dayOpen + fibRange_9
    showFib10Low := lod < dayOpen - fibRange_9
    

dayOpenPlot = plot(enabled and isToday ? dayOpen : na, color=showZonesOnly or dayOpen != dayOpen[1] ? na : color.new(openColor, scaledLineVisibility), trackprice=showPrices, title="Day Open", style=plot.style_linebr)


adr_fib_high_1  = plot(enabled and isToday and showFib1 ? dayOpen + fibRange_1 : na, color=showZonesOnly or not showFib1_line or dayOpen != dayOpen[1] ? na : color.new(fib1Color, scaledLineVisibility), trackprice=showPrices, title="ADR Fib 1 High", style=plot.style_linebr)
adr_fib_low_1   = plot(enabled and isToday and showFib1 ? dayOpen - fibRange_1 : na, color=showZonesOnly or not showFib1_line or dayOpen != dayOpen[1] ? na : color.new(fib1Color, scaledLineVisibility), trackprice=showPrices, title="ADR Fib 1 Low", style=plot.style_linebr)
adr_fib_high_2  = plot(enabled and isToday and showFib2 ? dayOpen + fibRange_2 : na, color=showZonesOnly or not showFib2_line or dayOpen != dayOpen[1] ? na : color.new(fib2Color, scaledLineVisibility), trackprice=showPrices, title="ADR Fib 2 High", style=plot.style_linebr)
adr_fib_low_2   = plot(enabled and isToday and showFib2 ? dayOpen - fibRange_2 : na, color=showZonesOnly or not showFib2_line or dayOpen != dayOpen[1] ? na : color.new(fib2Color, scaledLineVisibility), trackprice=showPrices, title="ADR Fib 2 Low", style=plot.style_linebr)
adr_fib_high_3  = plot(enabled and isToday and showFib3 ? dayOpen + fibRange_3 : na, color=showZonesOnly or not showFib3_line or dayOpen != dayOpen[1] ? na : color.new(fib3Color, scaledLineVisibility), trackprice=showPrices, title="ADR Fib 3 High", style=plot.style_linebr)
adr_fib_low_3   = plot(enabled and isToday and showFib3 ? dayOpen - fibRange_3 : na, color=showZonesOnly or not showFib3_line or dayOpen != dayOpen[1] ? na : color.new(fib3Color, scaledLineVisibility), trackprice=showPrices, title="ADR Fib 3 Low", style=plot.style_linebr)
adr_fib_high_4  = plot(enabled and isToday and showFib4 ? dayOpen + fibRange_4 : na, color=showZonesOnly or not showFib4_line or dayOpen != dayOpen[1] ? na : color.new(fib4Color, scaledLineVisibility), trackprice=showPrices, title="ADR Fib 4 High", style=plot.style_linebr)
adr_fib_low_4   = plot(enabled and isToday and showFib4 ? dayOpen - fibRange_4 : na, color=showZonesOnly or not showFib4_line or dayOpen != dayOpen[1] ? na : color.new(fib4Color, scaledLineVisibility), trackprice=showPrices, title="ADR Fib 4 Low", style=plot.style_linebr)
adr_fib_high_5  = plot(enabled and isToday and showFib5 ? dayOpen + fibRange_5 : na, color=showZonesOnly or not showFib5_line or dayOpen != dayOpen[1] ? na : color.new(fib5Color, scaledLineVisibility), trackprice=showPrices, title="ADR Fib 5 High", style=plot.style_linebr)
adr_fib_low_5   = plot(enabled and isToday and showFib5 ? dayOpen - fibRange_5 : na, color=showZonesOnly or not showFib5_line or dayOpen != dayOpen[1] ? na : color.new(fib5Color, scaledLineVisibility), trackprice=showPrices, title="ADR Fib 5 Low", style=plot.style_linebr)
adr_fib_high_6  = plot(enabled and isToday and showFib6 ? dayOpen + fibRange_6 : na, color=showZonesOnly or not showFib6_line or dayOpen != dayOpen[1] ? na : color.new(fib6Color, scaledLineVisibility), trackprice=showPrices, title="ADR Fib 6 High", style=plot.style_linebr)
adr_fib_low_6   = plot(enabled and isToday and showFib6 ? dayOpen - fibRange_6 : na, color=showZonesOnly or not showFib6_line or dayOpen != dayOpen[1] ? na : color.new(fib6Color, scaledLineVisibility), trackprice=showPrices, title="ADR Fib 6 Low", style=plot.style_linebr)

adr_fib_high_7  = plot(enabled and isToday and showFib7     ? dayOpen + fibRange_7  : na, color=showZonesOnly or not showFib7_line  or dayOpen != dayOpen[1] ? na : color.new(fib7Color,  scaledLineVisibility), trackprice=showPrices, title="ADR Fib 7 High", style=plot.style_linebr)
adr_fib_low_7   = plot(enabled and isToday and showFib7Low  ? dayOpen - fibRange_7  : na, color=showZonesOnly or not showFib7_line  or dayOpen != dayOpen[1] ? na : color.new(fib7Color,  scaledLineVisibility), trackprice=showPrices, title="ADR Fib 7 Low", style=plot.style_linebr)
adr_fib_high_8  = plot(enabled and isToday and showFib8     ? dayOpen + fibRange_8  : na, color=showZonesOnly or not showFib8_line  or dayOpen != dayOpen[1] ? na : color.new(fib8Color,  scaledLineVisibility), trackprice=showPrices, title="ADR Fib 8 High", style=plot.style_linebr)
adr_fib_low_8   = plot(enabled and isToday and showFib8Low  ? dayOpen - fibRange_8  : na, color=showZonesOnly or not showFib8_line  or dayOpen != dayOpen[1] ? na : color.new(fib8Color,  scaledLineVisibility), trackprice=showPrices, title="ADR Fib 8 Low", style=plot.style_linebr)
adr_fib_high_9  = plot(enabled and isToday and showFib9     ? dayOpen + fibRange_9  : na, color=showZonesOnly or not showFib9_line  or dayOpen != dayOpen[1] ? na : color.new(fib9Color,  scaledLineVisibility), trackprice=showPrices, title="ADR Fib 9 High", style=plot.style_linebr)
adr_fib_low_9   = plot(enabled and isToday and showFib9Low  ? dayOpen - fibRange_9  : na, color=showZonesOnly or not showFib9_line  or dayOpen != dayOpen[1] ? na : color.new(fib9Color,  scaledLineVisibility), trackprice=showPrices, title="ADR Fib 9 Low", style=plot.style_linebr)
adr_fib_high_10 = plot(enabled and isToday and showFib10    ? dayOpen + fibRange_10 : na, color=showZonesOnly or not showFib10_line or dayOpen != dayOpen[1] ? na : color.new(fib10Color, scaledLineVisibility), trackprice=showPrices, title="ADR Fib 10 High", style=plot.style_linebr)
adr_fib_low_10  = plot(enabled and isToday and showFib10Low ? dayOpen - fibRange_10 : na, color=showZonesOnly or not showFib10_line or dayOpen != dayOpen[1] ? na : color.new(fib10Color, scaledLineVisibility), trackprice=showPrices, title="ADR Fib 10 Low", style=plot.style_linebr)


fill(dayOpenPlot,    adr_fib_high_1,  color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib1Color, scaledVisibility))
fill(dayOpenPlot,    adr_fib_low_1,   color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib1Color, scaledVisibility))
fill(adr_fib_high_1, adr_fib_high_2,  color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib2Color, scaledVisibility))
fill(adr_fib_low_1,  adr_fib_low_2,   color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib2Color, scaledVisibility))
fill(adr_fib_high_2, adr_fib_high_3,  color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib3Color, scaledVisibility))
fill(adr_fib_low_2,  adr_fib_low_3,   color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib3Color, scaledVisibility))
fill(adr_fib_high_3, adr_fib_high_4,  color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib4Color, scaledVisibility))
fill(adr_fib_low_3,  adr_fib_low_4,   color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib4Color, scaledVisibility))
fill(adr_fib_high_4, adr_fib_high_5,  color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib5Color, scaledVisibility))
fill(adr_fib_low_4,  adr_fib_low_5,   color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib5Color, scaledVisibility))
fill(adr_fib_high_5, adr_fib_high_6,  color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib6Color, scaledVisibility))
fill(adr_fib_low_5,  adr_fib_low_6,   color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib6Color, scaledVisibility))
fill(adr_fib_high_6, adr_fib_high_7,  color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib7Color, scaledVisibility))
fill(adr_fib_low_6,  adr_fib_low_7,   color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib7Color, scaledVisibility))
fill(adr_fib_high_7, adr_fib_high_8,  color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib8Color, scaledVisibility))
fill(adr_fib_low_7,  adr_fib_low_8,   color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib8Color, scaledVisibility))
fill(adr_fib_high_8, adr_fib_high_9,  color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib9Color, scaledVisibility))
fill(adr_fib_low_8,  adr_fib_low_9,   color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib9Color, scaledVisibility))
fill(adr_fib_high_9, adr_fib_high_10, color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib10Color, scaledVisibility))
fill(adr_fib_low_9,  adr_fib_low_10,  color=not showZonesFill or dayOpen != dayOpen[1] ? na : color.new(fib10Color, scaledVisibility))

f_fibCrossAlert(fib, fibName) =>
    if ta.cross(close, dayOpen + fib) or ta.cross(close, dayOpen - fib)
        alert('Price crossed: ' + fibName, alert.freq_once_per_bar)

if fib1Alert
    f_fibCrossAlert(fibRange_1, 'Fib Level ' + str.tostring(fibLevel1))
if fib2Alert
    f_fibCrossAlert(fibRange_2, 'Fib Level ' + str.tostring(fibLevel2))
if fib3Alert
    f_fibCrossAlert(fibRange_3, 'Fib Level ' + str.tostring(fibLevel3))
if fib4Alert
    f_fibCrossAlert(fibRange_4, 'Fib Level ' + str.tostring(fibLevel4))
if fib5Alert
    f_fibCrossAlert(fibRange_5, 'Fib Level ' + str.tostring(fibLevel5))
if fib6Alert
    f_fibCrossAlert(fibRange_6, 'Fib Level ' + str.tostring(fibLevel6))
if fib7Alert
    f_fibCrossAlert(fibRange_7, 'Fib Level ' + str.tostring(fibLevel7))
if fib8Alert
    f_fibCrossAlert(fibRange_8, 'Fib Level ' + str.tostring(fibLevel8))
if fib9Alert
    f_fibCrossAlert(fibRange_9, 'Fib Level ' + str.tostring(fibLevel9))
if fib10Alert
    f_fibCrossAlert(fibRange_10, 'Fib Level ' + str.tostring(fibLevel10))

// ————— Show warning or HTF reminder, if needed.) =>
f_tfReminderAndErrorCheck(_userSelectionOfTf, _tfReminder) =>
    // Get chart's TF.
    var float _chartTfInMinutes = timeframe.multiplier * (timeframe.isseconds ? 1. / 60 : timeframe.isminutes ? 1. : timeframe.isdaily ? 60. * 24 : timeframe.isweekly ? 60. * 24 * 7 : timeframe.ismonthly ? 60. * 24 * 30.4375 : na)

    // Get HTF.
    float _htfInMinutes = request.security(syminfo.tickerid, _userSelectionOfTf, _chartTfInMinutes)

    // Label.
    string _txt = ''
    var color _color = na
    if _chartTfInMinutes > _htfInMinutes
        // Chart TF is higher than user-selected TF.
        _txt := 'The chart\'s timeframe\nshould not be greater than ' + _userSelectionOfTf
        _color := color.red
        _color
        // Display reminder of HTF.
    else if _tfReminder
        _txt := _userSelectionOfTf
        _color := color.silver
        _color
    float _y = ta.lowest(50)[1]
    var label _lbl = label.new(bar_index, _y, _txt, xloc.bar_index, yloc.price, #00000000, label.style_label_left, _color, size.large, text.align_left)
    if barstate.islast and _txt != ''
        // Update label.
        label.set_xy(_lbl, bar_index, _y)
        label.set_text(_lbl, _txt)
        label.set_textcolor(_lbl, _color)
    [_chartTfInMinutes, _htfInMinutes]

f_tfReminderAndErrorCheck(i_timeframe, i_reminder)