OPEN-SOURCE SCRIPT

Regression Candle Conversion Indicator

Hey everyone!

I got a pseudo-request a while ago for something like this, essentially the ability to track where another ticker would fall based on an alternative ticker.
I did create my ticker correlation reference indicator which directly looks at the correlation between 2 tickers. However, this is an indicator that operates on the same principle but is more pragmatic for trading.

What does it do?

Well, in keeping with the theme of what I call my indicators, this has a title that explains exactly what it does, "Regression Candle Conversion Indicator" or "RCCI" for short. It uses simple regression to convert one ticker to another. So while you are tracking one indicator, you can see where the expected value should fall on the other.

Applications?
The big application of this for me is being able to track where SPY/QQQ or IWM is falling during overnight trading sessions. Extended trading hours close at 8 pm NYSE time. After that, you have to guess where futures prices will put the ETF version of it. This indicator will allow you to track where, theoretically, the underlying ETF ticker will fall based on the current trading behaviour.

Some other applications are just the ability to track how similar or dissimilar one stock is to the other. For example, if we wanted to trade, say, Boeing using shares of DFEN or ITA (a defence specific ETF), here is what we get:

ảnh chụp nhanh
In the chart above we can see BA as the primary chart and ITA as the RCCI converted chart. We will see 2 major things that should cause us concern.

First, there is a really poor correlation between the two tickers. This indicates that ITA may not produce the best exposure if I am directly looking for Boeing exposure.
Second, there is a wide standard error. this means that the results that the RCCI is providing may be skewed up to +/- 2 points (as indicated by the standard error chart).

Let's take a look at BA and DFEN:

ảnh chụp nhanh

In the above, we can see that the correlation is not great, but the standard error is quite low.
This means that, while this may not be the best ticker for Boeing exposure, the RCCI is able to confidently calculate the ticker within +/- 0.50 cents based on BA's underlying data.
However, its important to note that it is not advisable to really rely on these results if the correlation is less than + 0.5 or greater than -0.5.

Let's take a look at a few more examples:

ảnh chụp nhanh
Above we have BA (NYSE) vs BA (NEO TSX CAD Hedged). We can see the strong relationship and high confidence calculations.

And some others:

SPX (primary) and ES1! (secondary):
ảnh chụp nhanh

RTY and IWM:
ảnh chụp nhanh

ES1! and SPY:
ảnh chụp nhanh

Customizations:

ảnh chụp nhanh

As you can see above, it is pretty straight forward. There are 3 options:

Lookback Length: Determines the length of assessment for correlation and the regression assessment.

Manual Ticker Input: The indicator will pull the data from your current chart and compare it against a manually selected indicator. You must tell the indicator which ticker you are comparing against.

Data Table: This will show you the data table which contains the standard error assessment and the correlation assessment. These are determined by your lookback length. The lookback length is defaulted to 500.


And that's the indicator! It's pretty straight forward. Hopefully you find it helpful, especially if you track futures during overnight sessions.

Leave your comments/questions and feedback below.

Thanks for checking it out!
regressionsstatistics

Mã nguồn mở

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

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


For real-time updates and premium indicators, consider joining my group at: patreon.com/steversteves
Ngoài ra, trên:

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