Developing CPR & Camarilla L3
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
//@version=5

indicator("Developing CPR & Camarilla L3", shorttitle="DCPRC3", overlay=true)

computeDevCM3(isNewPeriod) =>
    var float h = na
    var float l = na
    c = close

    h := isNewPeriod or high > h ? high : h[1]
    l := isNewPeriod or low < l ? low : l[1]

    pr = h-l
    h3 = c + pr*0.2750
    l3 = c - pr*0.2750
    pivot = (h + l + c) / 3.0
    bc = (h + l) / 2.0
    tc = pivot - bc + pivot

    [h3, l3, pivot, bc, tc]

timeChange(timeframe) =>
    ta.change(time(timeframe))

anchor = input.timeframe(defval="D", title="Time Frame")

TimeFrame = anchor

isNewPeriod = timeChange(TimeFrame)

[h3,l3, pivot, bc, tc] = computeDevCM3(isNewPeriod)

plot(h3, title="Developing CMH3", style=plot.style_line, color=color.new(#525eff, 0), linewidth=1)
plot(l3, title="Developing CML3", style=plot.style_line, color=color.new(#525eff, 0), linewidth=1)
plot(pivot, title="Developing Pivot", style=plot.style_line, color=color.new(#15b100, 0), linewidth=1)
plot(tc, title="Developing CPRH", style=plot.style_line, color=color.new(#15b100, 0), linewidth=1)
plot(bc, title="Developing CPRL", style=plot.style_line, color=color.new(#15b100, 0), linewidth=1)
