franzb0

Join data and union of 2 hystorical markets


How to create a union from two contiguous Tradingview tickers (series)

Francesco Marzolo March 18, 2021


Go to the older ticker of the two, for example CME: SP1! and open it on Tradingview.

On the graph thus created, add this script.

In the indicator settings select the same ticker as the chart in Symbol1

while in Symbol2 the ticker from which to retrieve the most recent data, for example: SPX500


The operation this script does is examine each bar of the two tickers, where there is a value for the second it holds this one, where it does not exist in second ticker it keeps the value of the first one. This new series is called Merge. So now in the chart there will be 4 series:

- that of the original chart without script
- the same series loaded via script (Symbol1)
- series 2 of "new" data (Symbol2)
- the Merge series that "prefers" the Symbol2 data if present, otherwise it shows Symbol1

So now you have to change the visibility of the 4 series to see the differences:

- turn off the visibility of the chart indicator
- turn off the Symbol1 series in the script properties (old data only)
- switch off the Symbol2 series as well (only new data)
- switch on the Merge series (new data if existing, old if not present in the new ticker)



Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?