# symbolcombo_01
#addlabel(1," symbolcombo_01",color.yellow);
# $DXY * (TNX/10) / 1.61.
def na = double.nan;
# turn off mprimary candles
input turn_off_main_candles = yes;
HidePricePlot(turn_off_main_candles);
input show_combined_line = yes;
input show_combined_candles = yes;
# -------------------
input sym1 = "$DXY";
input sym1multi = 1.0;
addlabel((sym1 <> "--"), "symbol1 " + sym1, color.yellow);
input sym2 = "TNX";
input sym2multi = 0.1;
addlabel((sym2 <> "--"), "symbol2 " + sym2, color.yellow);
input sym3 = "--";
# 1 / 1.61 = 0.621118
input sym3multi = 0.621118;
addlabel( (sym3 <> "--"), "symbol3 " + sym3, color.yellow);
input sym4 = "--";
input sym4multi = 0;
addlabel((sym4 <> "--"), "symbol4 " + sym4, color.yellow);
input sym5 = "--";
input sym5multi = 0;
addlabel((sym5 <> "--"), "symbol5 " + sym5, color.yellow);
# -----------------------
def sym1o = if sym1 == "--" then 0 else open(sym1);
def sym1h = if sym1 == "--" then 0 else high(sym1);
def sym1l = if sym1 == "--" then 0 else low(sym1);
def sym1c = if sym1 == "--" then 0 else close(sym1);
def sym2o = if sym2 == "--" then 0 else open(sym2);
def sym2h = if sym2 == "--" then 0 else high(sym2);
def sym2l = if sym2 == "--" then 0 else low(sym2);
def sym2c = if sym2 == "--" then 0 else close(sym2);
def sym3o = if sym3 == "--" then 0 else open(sym3);
def sym3h = if sym3 == "--" then 0 else high(sym3);
def sym3l = if sym3 == "--" then 0 else low(sym3);
def sym3c = if sym3 == "--" then 0 else close(sym3);
# ------------------
# create a formula
# $DXY * (TNX/10) / 1.61.
def x1 = sym1c * (sym2c / 10 ) / 1.61;
plot line1 = if show_combined_line then x1 else na;
line1.setdefaultcolor(color.yellow);
# calc open,high,low,close for all
def xo = if !show_combined_candles then na else ( sym1o * (sym2o / 10 ) / 1.61);
def xh = sym1h * (sym2h / 10 ) / 1.61;
def xl = sym1l * (sym2l / 10 ) / 1.61;
def xc = sym1c * (sym2c / 10 ) / 1.61;
AddChart(high = xh, low = xl, open = xo, close = xc, type = ChartType.CANDLE, growcolor = color.cyan);
#