PROTECTED SOURCE SCRIPT
Price Difference Between Two Correlated Symbols

//version=5
indicator("Price Difference Between Two Symbols", overlay=true)
// === User Inputs ===
symbol1 = input.symbol("Pepperstone:US500", "Symbol 1")
symbol2 = input.symbol("CME_MINI:ES1!", "Symbol 2")
tf = input.timeframe("", "Resolution (leave blank to use chart TF)")
// === Price Feeds ===
price1 = request.security(symbol1, tf == "" ? timeframe.period : tf, close)
price2 = request.security(symbol2, tf == "" ? timeframe.period : tf, close)
// === Difference Calculation ===
difference = price1 - price2
// === Plotting ===
plot(difference, title="Price Difference", color=color.new(color.teal, 0), linewidth=2)
hline(0, "Zero Line", color=color.gray, linestyle=hline.style_dotted)
// === Debug Info (Optional) ===
// label.new(bar_index, na, text="Price1: " + str.tostring(price1) + "\nPrice2: " + str.tostring(price2), style=label.style_label_left, yloc=yloc.abovebar)
indicator("Price Difference Between Two Symbols", overlay=true)
// === User Inputs ===
symbol1 = input.symbol("Pepperstone:US500", "Symbol 1")
symbol2 = input.symbol("CME_MINI:ES1!", "Symbol 2")
tf = input.timeframe("", "Resolution (leave blank to use chart TF)")
// === Price Feeds ===
price1 = request.security(symbol1, tf == "" ? timeframe.period : tf, close)
price2 = request.security(symbol2, tf == "" ? timeframe.period : tf, close)
// === Difference Calculation ===
difference = price1 - price2
// === Plotting ===
plot(difference, title="Price Difference", color=color.new(color.teal, 0), linewidth=2)
hline(0, "Zero Line", color=color.gray, linestyle=hline.style_dotted)
// === Debug Info (Optional) ===
// label.new(bar_index, na, text="Price1: " + str.tostring(price1) + "\nPrice2: " + str.tostring(price2), style=label.style_label_left, yloc=yloc.abovebar)
Script protegido
Esse script é publicada como código fechado. No entanto, você pode usar ele livremente e sem nenhuma limitação – saiba mais aqui.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.
Script protegido
Esse script é publicada como código fechado. No entanto, você pode usar ele livremente e sem nenhuma limitação – saiba mais aqui.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.