luyikaibr

Custom EMA Prism

luyikaibr Cập nhật   
This script implements the Binary Logic Trading (BLT) algorithm to calculate a score from 0 to 7. This score is calculated assigning a power of 2 weight to the positive sign of 3 Phi^3 distant EMAs' slopes. The largest EMA slope positive sign receives weight 4, the middle length EMA slope positive sign receives weight 2 and the shortest EMA slope positive sign receives weight 1. The positive sign of an EMA is defined as 1 if the slope of the EMA is positive and 0, otherwise. Therefore, for EMAs 305, 72 and 17, if slope(EMA305) > 0, slope(EMA72) < 0 and slope(EMA17) > 0, then score will be 4*1 + 2*0 + 1*1 = 5. Up to my knowledge, this score was first proposed by Bo Williams and named by him as Prisma.

Due too sampling issues, this script ONLY WORKS with graphic time of 1d. I would like to thanks to MrBitmanBob for showing me how to get quotations from a graphic time distinct from the current one.

This script also gets sampling data from graphic times 2h and 30m to calculate their score. As, even for smaller graphic times, price data is sampled at the current time frequency, the EMA lengths for those smaller graphic times needed to be proportionally decreased, meaning that when calculating the score for 1d with lengths 305, 72 and 17, the score for 2h must be calculated with lengths 72, 17 and 4, and the score for 30m must be calculated with lengths 17, 4 an 1. I understand that some precision may be lost but it is the best that is possible.

There is an optional setting for Crypto Currencies that instead of calculating the score for 1d, 2h and 30m, it calculates the score for 1d, 4h and 60m. This is due to the fact that Crypto Currencies are traded 24x7. Despite of this setting, the labels at the Style tab of the settings window remains 2h and 30m, because they must be constants.

This script with the corresponding EMAs chart and the EMAs Angle chart provides a broader view of the trading scenario.


Phát hành các Ghi chú:
This update normalizes the price before calculating the angle in order to minimize rounding loss of precision. It also adds an option to use current data src instead of using security() to retrieve smaller times. This option is due to my lack of confidence that this security() function returns useful data.
Phát hành các Ghi chú:
Due to the lack o accuracy on smaller graphic times, this update simplifies the indicator to show just the prism score for the current graphic time.
Phát hành các Ghi chú:
his update is just to change sample chart.
Phát hành các Ghi chú:
*This update...
Phát hành các Ghi chú:
This update is just to make it clear that this indicator now works fine with every graphic time, not only 1d as before. For sharper candle movements delta should be set to 2, otherwise 4 works fine.
Phát hành các Ghi chú:
This update brings back other graphic times score calculation with some options offered. I finally managed to understand how to properly operate on distinct graphic times with security() function. I believe it works on any graphic time but I recommend it to be used with 1d.
Phát hành các Ghi chú:
This update just changes the order the scores are plot in order to make their value order match the order displayed by the chosen graphic times.
Phát hành các Ghi chú:
This update is just to fix the EMA calculation in the absence of enough candles. Instead of using TV standard zero price, I use the source (close) price.
Phát hành các Ghi chú:
This update adds the concept of Prism of Prism, calculating a new line that shows the score of the 3 scores. It also adds 2 new sets of graphic time options and it changes the default length of the top MA to 610. It the Buy and Sell indication conditions.
Phát hành các Ghi chú:
This update adds a new and more meaningful angle calculation method.
Phát hành các Ghi chú:
This update just optimizes some functions to use binary search and decrease average execution time from n/2 to log2(n). It also adds some options to available graphic times.
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 đồ?