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)



Skrypt open-source

Zgodnie z prawdziwym duchem TradingView, autor tego skryptu opublikował go jako open-source, aby traderzy mogli go zrozumieć i zweryfikować. Brawo dla autora! Możesz używać go za darmo, ale ponowne wykorzystanie tego kodu w publikacji jest regulowane przez Dobre Praktyki. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.

Chcesz użyć tego skryptu na wykresie?