REAL MARKET RATES
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © csmottola71

//@version=4
study("REAL MARKET RATES")
LC = input(title="Long Contracr", type=input.string,  defval="GEH2022")
SC = input(title="Short Contract", type=input.string,  defval="GEZ2021")
LongContract = security(LC, "D", close)
ShortContract = security(SC, "D", close)
Spread90 = LongContract-ShortContract
medVal=(LongContract+ShortContract)/2
rateBase=medVal+Spread90
rate=((100-rateBase)/medVal)*100
rateAnnual=rate*4
fedFunds=((security("FEDFUNDS", "D", close))/30)*360
realRate=rateAnnual+fedFunds
plot(realRate, color=color.yellow, title="RealRate")