OPEN-SOURCE SCRIPT

Put to Call Ratio Correlation

已更新
Hello!

Excited to share this with the community!
This is actually a very simple indicator but actually usurpingly helpful, especially for those who trade indices such as SPX, IWM, QQQ, etc.

Before I get into the indicator itself, let me explain to you its development.
I have been interested in the use of option data to detect sentiment and potential reversals in the market. However, I found option data on its own is full of noise. Its very difficult if not impossible for a trader to make their own subjective assessment about how option data is reflecting market sentiment.
Generally speaking, put to call ratios generally range between 0.8 to 1.1 on average. Unless there is a dramatic pump in calls or puts causing an aggressive spike up to over this range, or fall below this range, its really difficult to make the subjective assessment about what is happening.

So what I thought about trying to do was, instead of looking directly at put to call ratio, why not see what happens when you perform a correlation analysis of the PTC ratio to the underlying stock.

So I tried this in pinescript, pulling for Tradingview's ticker PCC (Total Equity Put to Call Ratio) and using the ta.correlation function against whichever ticker I was looking at.

I played around with this idea a bit, pulled the data into excel and from this I found something interesting. When there is a very significant negative or positive correlation between PTC ratio and price movement, we see a reversal impending. In fact, a significant negative or positive correlation (defined as a R value of 0.8 or higher or -0.8 or lower) corresponded to a stock reversal about 92% of the time when data was pulled on a 5 minute timeframe on SPY.

But wait, what is a correlation?
If you are not already familiar, a correlation is simply a statistical relationship. It is defined with a Pearson R correlation value which ranges from 0 (no correlation) to 1 (significant positive correlation) and 0 to -1 (significant negative correlation).

So what does positive vs negative mean?
A significant positive correlation means the correlation is moving the same as the underlying. In the case of this indicator, if there is a significant positive correlation could mean the stock price is climbing at the same time as the PTC ratio.
Inversely, it could mean the stock price is falling as well as the PTC ratio.

A significant negative correlation means the correlation is moving in the opposite direction. So in this case, if the stock price is climbing and the PTC ratio is falling proportionately, we would see a significant negative correlation.

So how does this work in real life?
To answer this, let's get into the actual indicator!

快照

In the image above, you will see the arrow pointing to an area of significant POSITIVE correlation.
The indicator will paint the bars on the actual chart purple (customizable of course) to signify this is an area of significant correlation.

So, in the above example this means that the PTC ratio is increase proportionately to the increase in the stock price in the SAME direction (Puts are going up proportionately to the stock price). Thus, we can make the assumption that the underlying sentiment is overwhelmingly BEARISH. Why? Because option trading activity is significantly proportionate to stock movement, meaning that there is consensus among the options being traded and the movement of the market itself.

And in the above example we will see, the stock does indeed end up selling:

快照

In this case, IWM fell roughly 1 point from where there was bearish consensus in the market.

Let's use this same trading day and same example to show the inverse:

快照

You will see a little bit later, a significant NEGATIVE correlation developed.
In this case identified, the stock wise RISING and the PTC ratio was FALLING.
This means that Puts were not being bought up as much as calls and the sentiment had shifted to bullish .

快照

And from that point, IWM ended up going up an additional 0.75 points from where there was a significant INVERSE correlation.


So you can see that it is helpful for identifying reversals. But what is also can be used for is identifying areas of LOW conviction. Meaning, areas where there really is no relationship between option activity and stock movement. Let's take spy on the 1 hour timeframe for this example:

快照

You can see in the above example there really is no consensus in the option trading activity with the overarching sentiment. The price action is choppy and so too is option trading activity. Option traders are not pushing too far in one direction or the other. We can also see the lack of conviction in the option trading activity by looking at the correlation SMA (the white line).

When a ticker is experiencing volatile and good movement up and down, the SMA will generally trade to the top of the correlation range (roughly + 1.0) and then make a move down to the bottom (roughly - 1.0), see the example below:

快照

When the SMA is not moving much and accumulating around the centerline, it generally means a lot of indecision.


Additional Indicator Information:

As I have said, the indicator is very simple. It pulls the data from the ticker PCC and runs a correlation assessment against whichever ticker you are on.
PCC pulls averaged data from all equities within the market and is not limited to a single equity. As such, its helpful to use this with indices such as SPY, IWM and QQQ, but I have had success with using it on individual tickers such as NVDA and AMD.

The correlation length is defaulted to 14. You can modify it if you wish, but I do recommend leaving it at this as the default and the testing I have done with this have all been on the 14 correlation length.

You can chose to smooth the SMA over whichever length of period you wish as well.

When the indicator is approaching a significant negative or positive relationship, you will see the indicator flash red in the upper or lower band to signify the relationship. As well, the chart will change the bar colour to purple:

快照

Everything else is pretty straight forward.

Let me know your questions/comments or suggestions around the indicator and its applications.

As always, no indicator is meant to provide a single, reliable strategy to your trading regimen and no indicator or group of indicators should be relied on solely. Be sure to do your own analysis and assessments of the stock prior to taking any trades.


Safe trades everyone!





發行說明
Revised update. Update includes:
1. Cosmetic changes;
2. Ability to smooth the plots;
3. Ability to toggle on and off the bar color change on reversals
CALLoptionsOscillatorsptcrputratiosentimentto

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?


For real-time updates and premium indicators, consider joining my group at: patreon.com/steversteves
更多:

免責聲明