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

//@version=4
study("MMRI", overlay=false)

mmri = security("TVC:DXY*TVC:US10Y/1.61", timeframe.period, close)

mmri_risk_level = mmri < 100 ? "Low Risk" : mmri < 200 ? "Mild Risk" : "High Risk" 
mmri_risk_color =  mmri < 100 ? color.green : mmri < 200 ? color.orange : color.red
riskon_state = mmri < 100 ? "Risk ON" : "Risk OFF"
riskon_color = mmri < 100 ? color.green : color.red

var table info = table.new(position=position.top_right, columns=2, rows=1, border_width=3)
table.cell(info, 0, 0, mmri_risk_level, bgcolor=mmri_risk_color)
table.cell(info, 1, 0, riskon_state, bgcolor=riskon_color)

plot(mmri)