how to add two more currencies to this indicator?

Viewed 19
//@version=5
////////////////////////////////////////////////////////////
//  NISMO BINARY MONSTER GT
////////////////////////////////////////////////////////////
indicator(title='NISMO BINARY MONSTER GT', precision=2)
input_barwidth = input(4, title='Bar Width')
input_percentorprice = input(false, title='Price Change')
input_abs = input(false, title='Abs. Value')
input_barsback = input(1, title='Look Back')
hline(0, color=color.blue, linestyle=hline.style_solid)
xPrice = close
xPrice1 = 0.0
xPrice1 := input_percentorprice ? xPrice - xPrice[input_barsback] : (xPrice - xPrice[input_barsback]) * 100 / xPrice[input_barsback]
colorg = xPrice1 < 0 ? color.red : color.green
xPrice1 := input_abs ? math.abs(xPrice1) : xPrice1
plot(xPrice1, color=colorg, style=plot.style_histogram, linewidth=input_barwidth, title='Change')

I want to add two more currencies to this indicator in a different color for comparison, so that you can compare the bars. How can I do that? I am a newbie so please help.

1 Answers

You need to use the security function to get data from other tickers.

You can request the open, close, high, low, values (or any other variables) and plot them if that's what you are looking for.

Below code rqeuests the close price from NYSE:IBM ticker id.

//@version=4
study("Example security 1", overlay=true)
ibm_close = security("NYSE:IBM", timeframe.period, close)
plot(ibm_close)
Related