luyikaibr

Custom EMA Prism

luyikaibr Mis à jour   
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.


Notes de version:
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.
Notes de version:
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.
Notes de version:
his update is just to change sample chart.
Notes de version:
*This update...
Notes de version:
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.
Notes de version:
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.
Notes de version:
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.
Notes de version:
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.
Notes de version:
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.
Notes de version:
This update adds a new and more meaningful angle calculation method.
Notes de version:
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.
Script open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?