This script implements the Binary Trade Logic (BTL) algorithm to calculate two distinct scores that range from 0 to 7. One score is calculated assigning a power of 2 weight to the positive sign of 3 Phi^3 distant Moving Average (MA) slopes. The other score is calculated assigning a power of 2 weight to the sign of the difference between the price and the value of 3 Phi^3 distant Moving Average (MA).
For the first score, hereafter called as the angle score (AS), 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.
For the second score, hereafter called as the value score (VS), if the price > largest MA, it receives weight 4. If the price > the middle length MA, it receives weight 2 and if the price > the the shortest MA, it receives weight 1. Therefore, for MAs 305, 72 and 17, if price < MA305, price > MA72 and price > MA17, then score will be 4*0 + 2*1 + 1*1 = 3. Up to my knowledge, this score was first proposed by Bo Williams and named by him as Prisma.
Both AS and VS are calculated for Phi^3 lengths (610, 144, 34) and for Phi^3/2 lengths (305, 72, 17). The scores of the same kind calculated for each set of length are combined multiplying the Phi^3 length score by 10 and adding with with the Phi^3/2 score, therefore providing a 2 digit score ranging from 0 to 77. For instance, if we have AS(610, 144, 34) = 7 and AS(305, 72, 17) = 5, we have AS=75. At the same time, if we have VS(610, 144, 34) = 6 and VS(305, 72, 17) = 4, we have VS=64.
VS score is plotted by default in black, but it can be on white for dark themes. AS is plotted with the color of the longest MA used.
Chart background is colored according to the range of values for AS and VS, checked in the following order:
if AS >= 13 and VS <= 13 then back color = red
if AS >= 13 or VS <= 13 then back color = orange
if AS >= 64 and VS >= 64 then back color = green
if AS >= 64 or VS >= 64 then back color = blue
otherwise back color = none (white o black)