alexgrover

Periodic Ellipses

The following script periodically plot ellipses to the chart, where the maximum height of the ellipses is determined by the price high of the user-selected time frame while the price low determines the minimum height of the ellipses.

The selected time frame affects the frequency at which the ellipses are plotted, for example, a selected time frame of 1 week will plot an ellipse every week


Note that time frames that are close to the one used in the main chart can return noncircular shapes


Here the main time frame is 15 minutes, while the time frame in the script is 1 hour.

By default the script uses future data, and as such repaint which makes it only useful in offline (non-real time) situations, you can make the script use only past data by deselecting the "repaint" option.


Interpretation And Construction

In terms of usages and interpretation ellipses are similar to bands indicators, as such we can use ellipses in a breakout methodology, where a closing price crossing over the upper bound indicating an uptrend and a closing price crossing under the lower bound indicating a downtrend.


By default, the color of the plots are based on a gradient determined by the position of the closing price relative to the ellipse, with a closing price closer to the upper bound of the ellipse returning a blue color and a closing price closer to the lower bound returning a red color, the intermediate color is violet. When repainting mode is deactivated a blue color indicates an up-trend, while a red color indicates a down-trend, violet colors on the other hand indicate a ranging market.

The ellipses can also determine possible retracements, as such the upper bound of the ellipse can act as a support in an uptrend while the lower bound can act as a resistance in a downtrend.


Construction

Peoples might be interested in the construction of ellipses, this task is not complicated. We can construct circular shapes by using the equation of a semi-circle described as follows:

C = √(1 - x*x)

with 1 ≥ x ≥ -1, values of x greater than 1 or lower than -1 will return na. In the script, the variable basis creates a line starting at -1 and ending at 1, we then only need to apply the previous equation to this line to have a semi-circle. This semi-circle is in a range of (0,1), so we need to rescale it in a useful range, let's define the highest high of the selected time frame as H and the lowest low as L, the upper and lower bound of the ellipse are calculated as follows:

upper = avg(H,L) + C*(H - avg(H,L))

lower = avg(H,L) - C*(avg(H,L) - L)


Summary

A script plotting ellipses has been proposed, we have seen that the signals that can be generated are similar to the one generated by band indicators, note however that the script has not been made to be a serious indicator, it would be more advisable to use regular band indicators instead.

Thx to @freds_view for the question.


Check out the indicators we are making at luxalgo: www.tradingview.com/u/LuxAlgo/
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 đồ?