US/CA Bond Yield Curve
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © EsIstTurnt

//@version=5
indicator("US/CA Bond Yield Curve")
overlay = true
tfInput = input.timeframe("D", "Timeframe")
yield1=input.symbol("US02MY", "Symbol 1")
yield2=input.symbol("CA02MY", "Symbol 2")
yield3=input.symbol("US02Y", "Symbol 3")
yield4=input.symbol("CA02Y", "Symbol 4")
yield5=input.symbol("US10Y", "Symbol 5")
yield6=input.symbol("CA10Y", "Symbol 6")
yield7=input.symbol("US30Y","Symbol 7")
yield8=input.symbol("CA30Y", "Symbol 8")
USlinewidth=input.int(defval=2,minval=0,maxval=4,title='US Line Width')
CAlinewidth=input.int(defval=1,minval=0,maxval=4,title='CA Line Width')
curve1 = request.security(yield1, 'D', close)
curve2 = request.security(yield2, 'D', close)
curve3 = request.security(yield3, 'D', close)
curve4 = request.security(yield4, 'D', close)
curve5 = request.security(yield5, 'D', close)
curve6 = request.security(yield6, 'D', close)
curve7 = request.security(yield7, 'D', close)
curve8 = request.security(yield8, 'D', close)


col1 = color.new(color.teal, 55)
col2 = color.new(color.lime, 55)
col3 = color.new(color.green, 55)
col4 = color.new(color.yellow, 55)
col5 = color.new(color.orange, 55)
col6 = color.new(color.red, 55)
col7 = color.new(color.maroon, 55)
col8 = color.new(color.purple, 55)
col9 = color.new(color.navy, 55)
col10 = color.new(color.blue, 55)
col11 = color.new(color.white, 55)

//,title='US Line Style'
plot(curve1, color=col1 , linewidth=USlinewidth,style=plot.style_linebr)
plot(curve2, color=col1 , linewidth=CAlinewidth,style=plot.style_linebr)
plot(curve3, color=col4 , linewidth=USlinewidth,style=plot.style_linebr)
plot(curve4, color=col4 , linewidth=CAlinewidth,style=plot.style_linebr)
plot(curve5, color=col6 , linewidth=USlinewidth,style=plot.style_linebr)
plot(curve6, color=col6 , linewidth=CAlinewidth,style=plot.style_linebr)
plot(curve7, color=col10, linewidth=USlinewidth,style=plot.style_linebr)
plot(curve8, color=col10, linewidth=CAlinewidth,style=plot.style_linebr)