Swing Comparator

jarzido Premium Updated   
Here I bring you an array of methods to compare the swings and consistency between assets.
This indicator is excellent for swing traders and scalpers looking to maximize their profits by examining which of two closely related pairs provides greater price fluctuation during given period.
This indicator works against two assets, which are to be configured in settings.

This indicator has 5 particular plots for you to examine, each which can be considered for you to contemplate which pair for you to next perform a trade on.

First off, let's start with the blue.
The blue is simply a pearson correlation coefficient , thankfully now included in tradingview. This provides a value of 1 as values show to be close correlation, 0 showing no correlation, and -1 showing negative correlation - meaning an increase in one pair correlates to a decrease in another pair. This will turn green when greater than 0.975, showing a very strong relationship between the two pairs, and red when below -0.975. This is the only plot to be interpreted on a scale from -1 to +1.

Next, we have the purple and yellow background plots, followed by the white and green moving averages. Though similar, these are all slightly different.

For each of these 4 plots, a value greater than 0 indicates greater price swings for your Symbol #1, while a value less than 0 indicates greater price swings for Symbol #2.
These calculations are performed on a per bar basis, meaning you're likely going to be examining bars longer than what you'll normally be trading on. Use confluence, as well as your own judgement for this.

For example, if symbol #1 provides a bar with an open value 1% greater or less than close, providing a 1% swing on a given bar, but symbol #2 provides 2%, the indicator will fall down toward the negative, as Symbol #2 had the greater swing.

First, yellow focuses on only open/close bar values, and thus the body of the candlestick .
Purple, on the other hand, focuses on the wicks of the candle - thus, the high/low values. I've opted to make these two different values as a wick focuses on the embodiment within the time period, and body focuses on the open/close instant.

Next, the green is an extended EMA of the purple - High/Low ratio. This is important to examine trend overtime, and reduce unneeded noise.
Lastly, the white is simply difference in the standard deviation of the particular bars, between the two symbols you have selected. The tends to usually tie up with the green pretty well.

Considering this is going to by nature be very noisy datasets, I have included in settings the option to extend an EMA for everything. They have their default settings, but if you'd like to examine the trend without an EMA , feel free to set it to 1 to eliminate its effects.
I have additionally added the ability to introduce clipping, as well as scale the correlation coefficient to remain visible when examining very short term time scales. In the future, I hope to properly normalize all plots to remain within a -1 to +1 basis. Please be patient as I have multiple projects ongoing.

Suggestions and constructive criticism are very well encouraged.
Anyone is welcome to utilize this in their code, as well, i just ask you provide credit.

As you reduce to time frames less than a day, you will likely have to reduce the coefficient min/max closer to 0.025, or just hide it entirely.

  • Make it look better. Sorry, folks.

  • Introduce latency between pairs.

  • Examine significance of a coefficient of determination

  • Remove static weights and introduce z-score and linear normalization.

  • Consider adding room for a 3rd pair. This could get ugly, however.

Phát hành các Ghi chú: updated chart
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 đồ?