Steversteves

Cross Period Comparison Indicator

Really excited to be sharing this indicator!

This is the cross-period comparison indicator, AKA the comparison indicator.

What does it do?
The cross-period comparison indicator permits for the qualitative assessment of two points in time on a particular equity.

What is its use?

At first, I was looking for a way to determine the degree of similarity between two points, such as using Cosine similarity values, Euclidean distances, etc. However, these tend to trigger a lot of similarities but without really any context. Context matters in trading and thus what I wanted really was a qualitative assessment tool to see what exactly was happening at two points in time (i.e. How many buyers were there? What was short interest like? What was volume like? What was the volatility like? RSI? Etc.)

This indicator permits that qualitative assessment, displaying things like total buying volume during each period, total selling volume, short interest via Put to Call ratio activity, technical information such as Stochastics and RSI, etc.

How to use it?

The indicator is fairly self explanatory, but some things require a little more in-depth discussion.
The indicator will display the Max and Min technical values of a period, as well as a breakdown in the volume information and put to call information. The user can then make the qualitative determination of degrees of similarity. However, I have included some key things to help ascertain similarity in a more quantitative way. These include:

1. Adding average period Z-Score
2. Adding CDF probability distributions for each respective period
3. Adding Pearson correlations for each respective period over time
4. Providing the linear regression equation for each period

So let us discuss these 4 quantitative measures a bit more in-depth.

Adding Period Z-Score

For those who do not know, Z-Score is a measure of the distance from a mean. It generally spans 0 (at the mean) to 3 (3 standard deviations away from the mean). Z-Score in the stock market is very powerful because it is actually our indicator of volatility. Z-Score forms the basis of IV for option traders and it generally is the go to, to see where the market is in relation to its overall mean.

Adding Z-Score lets the user make 2 big determinations. First and foremost, it’s a measure of overall volatility during the period. If you are getting a Z-Score that is crazy high (1.5 or greater), you know there was a lot of volatility in that period marked by frequent deviations from its mean (since on average it was trading 1.5 standard deviations away from its mean).

The other thing it tells you is the overall sentiment of that time. If the average Z Score was 1.5 for example, we know that buying interest was high and the sentiment was somewhat optimistic, as the stock was trading, on average, + 1.5 SDs away from its mean.

If, on the other hand, the average was, say, - 1.2, then we know the sentiment was overall pessimistic. There was frequent selling and the stock was frequently being pushed below its mean with heavy selling pressure.

We can also check these assumptions of buying / selling buy verifying the volume information. The indicator will list the Buy to Sell Ratio (number of Buyers to Sellers), as well as the total selling volume and total buying volume. Thus, the user can see, objectively, whether sellers or buyers led a particular period.

Adding CDF Probability
CDF probabilities simply mean the extent a stock traded above or below its normal distribution levels.

To help you understand this, the indicator lists the average close price for a period. Directly below that, it lists the CDF probabilities. What this is telling you, is how often and how likely, during that period, the stock was trading below its average. For example, in the main chart, the average close price for BTC in Period A is 29869. The CDF probability is 0.51. This means, during Period A, 51% of the time, BTC was trading BELOW 29869. Thus, the other 49% of the time it was trading ABOVE 29869.

CDF probabilities also help us to assess volatility, similar to Z-Score. Generally speaking, the CDF should consistently be reading about 0.50 to 0.51. This is the point of an average value, half the values should be above the average and half the values should be below. But in times of heightened volatility, you may actually see the CDF creep up to 0.54 or higher, or 0.48 or lower. This means that there was extremely extensive volatility and is very indicative of true “whipsaw” type price action history where a stock refuses to average itself out in one general area and frequently jumps up and down.

Adding Pearson Correlation

Most know what this is, but just in case, the Pearson correlation is a measure of statistical significance. It ranges from 0 (not significant) to 1 (very significant). It can be positive or negative. A positive signifies a positive relationship (i.e. as one value increases so too does the other value being compared). If it is a negative value, it means an inverse relationship (i.e. one value increases proportionately to the other’s decline).

In this indicator, the Pearson correlation is measured against time. A strong positive relationship (a value of 0.5 or greater) indicates that the stock is trading positive to time. As time goes by, the stock goes up. This is a normal relationship and signifies a healthy uptrend.
Inversely, if the Pearson correlation is negative, it means that as time increases, the stock is going down proportionately. This signifies a strong downtrend.
This is another way for the user to interpret sentiment during a specific period.

IF the Pearson correlation is less than 0.5 or -0.5, this signifies an area of indecision. No real trend formed and there was no real strong relationship to time.

Adding Linear Regression Equation

A linear regression equation is simply the slope and the intercept. It is expressed with the formula y= mx + b.

The indicator does a regression analysis on each period and presents this formula accordingly. The user can see the slope and intercept.

Generally speaking, when two periods share the same slope (m value) but different intercept (b value), it can be said that the relationship to time is identical but the starting point is different.

If the slope and intercept are different, as you see in the BTC chart above, it represents a completely different relationship to time and trajectory.
Indicator Specific Information:

The indicator retains the customizability you would expect. You can customize all of your lengths for technical, change and Z-Score. You can toggle on or off Period data, if you want to focus on a single period. You can also toggle on a difference table that directly compares the % difference between Period A to Period B (see image below):


You will also see on the input menu a input for “Threshold” assessments. This simply modifies the threshold parameters for the technical readings. It is defaulted to 3, which means when two technical (for example Max Stochastics) are within +/- 3 of each other, the indicator will light these up as green to indicate similarities. They just clue the user visually to areas where there are similarities amongst the qualitative technical data.

Timeframes

This is best used on the daily timeframe. You can use it on the smaller timeframe but the processing time may take a bit longer. I personally like it for the Daily, Weekly and 4 hour charts.

And this is the indicator in a nutshell!

I will provide a tutorial video in the coming day on how to use it, so check back later!

As always, leave your comments/questions and suggestions below. I have been slowly modifying stuff based on user suggestions so please keep them coming but be patient as it does take some time and I am by no means a coder or expert on this stuff.
Safe trades to all!

Premium indicators and content have launched! Get access at: www.patreon.com/steversteves
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?