Hello folks, I'm new to trying any programming in Thinkscript. So I actually found this code here and modded it so that it would reflect the proper equation and I got it to show up as a number above the chart. Essentially the script takes the value of the USD and compares it to the 10year yield, then spits out a number based on a divider of 1.61 - So: (DXY) x (TNX)/1.61 = Result.
I've got it to display but was wondering if anyone could tell me how to add a few elements.
1. I'd like to add a label before the number - MMRI:
2. The box under the number presented is currently red. I'd like to have the box change color based on the numeric result of the calculation as follows:
50-100 = Green
101-200 = Yellow
201-300 = Orange
301+ = Red
Here is the code as I have it thus far:
declare lower;
input symbol1 = "$dxy";
input symbol2 = "TNX";
def price1 = close(Symbol1);
def price2 = close(Symbol2);
AddLabel(yes, AsText((Price1 * (Price2/10))/1.6, NumberFormat.TWO_DECIMAL_PLACES));