InflationRate
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © easonoic

//@version=5
indicator("InflationRate", overlay=true)
TIPS10Y = input.symbol("DFII10", "Symbol")
US10Y = input.symbol("US10Y", "Symbol")

tips10y_s_o = request.security(TIPS10Y, 'D', open)
us10y_s_o = request.security(US10Y, 'D', open)
tips10y_s_c = request.security(TIPS10Y, 'D', close)
us10y_s_c = request.security(US10Y, 'D', close)
tips10y_s_high = request.security(TIPS10Y, 'D', high)
us10y_s_high = request.security(US10Y, 'D', high)
tips10y_s_low = request.security(TIPS10Y, 'D', low)
us10y_s_low = request.security(US10Y, 'D', low)

InflationRate_o = us10y_s_o - tips10y_s_o
InflationRate_c = us10y_s_c - tips10y_s_c
InflationRate_high = us10y_s_high - tips10y_s_high
InflationRate_low = us10y_s_low - tips10y_s_low

plotcandle(InflationRate_o, InflationRate_high, InflationRate_low, InflationRate_c, title='InflationRate', color = InflationRate_o < InflationRate_c ? color.green : color.red, wickcolor=color.black)
plot(0, linewidth=1)
plot(InflationRate_c, color=color.red, linewidth=2)