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.

- Starting Balance is $25,000
- 
- Always use 1.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
indicator("Magic MA with Open Range Breakout", overlay=true, max_bars_back=2000)

// Magic MA Variables and Functions
type3   = input.string(defval="HullMA", title="Slow MA Type: ", options=["SMA", "EMA", "WMA", "VWMA", "SMMA", "DEMA", "TEMA", "HullMA", "ZEMA", "TMA", "SSMA"])
len3    = input.int(defval=57, title="Slow Length", minval=1)
RSILen  = input.int(6, title='RSI Length')
SF      = input.int(3, title='RSI Smoothing Factor')
QQE     = input.float(2.618, title='Fast QQE Factor')
threshhold = input.int(10, title="RSI Threshhold")
filter  = input.bool(false, title="Use Moving Average Filter")
RSIsrc  = input.source(close, title="Source")
srcclose= RSIsrc

variant(type, src, len) =>
    var float v5 = na
    var float v9 = na
    simple_ma = ta.sma(src, len)
    exponential_ma = ta.ema(src, len)
    weighted_ma = ta.wma(src, len)
    volume_weighted_ma = ta.vwma(src, len)
    smoothed_ma = na(v5[1]) ? ta.sma(src, len) : (v5[1] * (len - 1) + src) / len
    double_exponential_ma = 2 * exponential_ma - ta.ema(exponential_ma, len)
    triple_exponential_ma = 3 * (exponential_ma - ta.ema(exponential_ma, len)) + ta.ema(ta.ema(exponential_ma, len), len)
    hull_ma = ta.wma(2 * ta.wma(src, len / 2) - ta.wma(src, len), int(math.sqrt(len)))
    triangular_ma = ta.sma(ta.sma(src, len), len)
    a1 = math.exp(-1.414 * math.pi / len)
    b1 = 2 * a1 * math.cos(1.414 * math.pi / len)
    c2 = b1
    c3 = (-a1) * a1
    c1 = 1 - c2 - c3
    super_smoother_ma = c1 * (src + nz(src[1])) / 2 + c2 * nz(v9[1]) + c3 * nz(v9[2])
    zero_lag_ma = simple_ma + (simple_ma - ta.ema(simple_ma, len))
    // Determine which MA to use based on input type
    ma = switch type
        "EMA" => exponential_ma
        "WMA" => weighted_ma
        "VWMA" => volume_weighted_ma
        "SMMA" => smoothed_ma
        "DEMA" => double_exponential_ma
        "TEMA" => triple_exponential_ma
        "HullMA" => hull_ma
        "SSMA" => super_smoother_ma
        "ZEMA" => zero_lag_ma
        "TMA" => triangular_ma
        => simple_ma

// Open Range Breakout Variables
mode = input.int(1, 'Mode (1:timeframe, 2:session):', minval=1, maxval=2)
tf   = input.timeframe('60', 'Timeframe for open range:')
tf2  = input.timeframe('D', 'Timeframe for range capture:')
sess = input.session('0400-1500', 'Session for mode 2:')
repaint = input.bool(true, 'Repaint?') ? barmerge.lookahead_on : barmerge.lookahead_off

bool is_new_day = switch mode
    1 => ta.change(time(tf2)) > 0 
    2 => ta.change(nz(time(tf2, sess), 0)) > 0
    => false
bool is_end_session = switch mode
    2 => na(time(tf2, sess))
    => false

var float ND_open = na
var float ND_high = na
var float ND_low  = na
var float ND_stretch  = 0
var float filter_high = na
var float filter_low  = na
var float filter_high_stretch = na
var float filter_low_stretch  = na
[tfo, tfh, tfl, tfr] = request.security(syminfo.tickerid, tf, [open, high, low, math.max(high-open, open-low)], lookahead=repaint)
if is_new_day
    ND_open := tfo
    ND_high := tfh
    ND_low  := tfl
    ND_stretch := na(ND_stretch[1]) ? 0.0 : (ND_stretch[1] * 9 + tfr) / 10
    filter_high := ND_high
    filter_low  := ND_low
    filter_high_stretch := ND_high + ND_stretch
    filter_low_stretch  := ND_low  - ND_stretch
if is_end_session
    filter_high := na
    filter_low  := na
    filter_high_stretch := na
    filter_low_stretch  := na

plvl(src) => src != src[1] ? na : src
st = plot.style_linebr
fh  = plot(title='TR', series=plvl(filter_high), style=st, color=color.black)
fl  = plot(title='BR', series=plvl(filter_low), style=st, color=color.black)
fhs = plot(title='TS', series=plvl(filter_high_stretch), style=st, color=color.green)
fls = plot(title='BS', series=plvl(filter_low_stretch), style=st, color=color.maroon)

fill(title='Positive Stretch', plot1=fh, plot2=fhs, color=color.rgb(76, 175, 79, 50))
fill(title='Negative Stretch', plot1=fl, plot2=fls, color=color.rgb(136, 14, 79, 50))

// Plot MA
ma_slow = variant(type3, srcclose, len3)
plot(ma_slow, title="MA Slow", color=color.blue, linewidth=2)