luyikaibr

MyMA Prism

luyikaibr Updated   
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 Moving Average (MA) slopes. The largest MA slope positive sign receives weight 4, the middle length MA slope positive sign receives weight 2 and the shortest MA slope positive sign receives weight 1. The positive sign of an MA is defined as 1 if the slope of the MA is positive and 0, otherwise. Therefore, for MAs 305, 72 and 17, if slope(MA305) > 0, slope(MA72) < 0 and slope(MA17) > 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.

The used Moving Averages can be chosen between EMA and MyMA. MyMA is a Moving Average that tries to mimic Bo William's MIMA. Due to the close resemblance between MyMA and MIMA, I do not feel comfortable to open this script source code. In order to learn how this script operates with EMAs, please refer to my Custom EMA Prism indicator that has its source code open.

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 MA 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 MyMAs chart and the MyMAs Angle chart provides a broader view of the trading scenario.
Release Notes:
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.
Release Notes:
This update is just to change sample chart.
Release Notes:
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.
Release Notes:
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.
Release Notes:
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.
Release Notes:
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.
Release Notes:
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.
Release Notes:
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.
Release Notes:
This update fixes the Prism of Prism calculation and the Buy and Sell indication conditions.
Release Notes:
This update adds a new and more meaningful angle calculation method and adjusts the MA calculation method.
Release Notes:
This update just optimizes some implementation aspects. It also adds some graphic time options.
Protected script
This script is published closed-source but you may use it freely. You can favorite it to use it on a chart. You cannot view or modify its source code.
Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?