Recession indicator US2/10 Y
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jacdelosreyes013

//@version=5
indicator("Recession indicator US2/10 Y")
US02Y = request.security("TVC:US02Y",timeframe.period,close)
US10Y = request.security("TVC:US10Y",timeframe.period,close)

recession = US02Y/US10Y

color c_rec = color.red
color c_nrec = color.yellow

color ind_color = recession > 1 ? c_rec : c_nrec


plot(recession, color=ind_color)