Price Volume Rank Label


Category:
0
0

Hi Pete,

How do I show the PVR Rank 1 as bright green, 2 as a lighter green, 3 a lighter red and 4 as bright red on the chart?

Thanks!

Marked as spam
Posted by (Questions: 8, Answers: 18)
Asked on April 26, 2024 10:30 am
85 views
0
Private answer

First thing I want to show everyone is how they can use the Condition Wizard to build this solution on their own. The following line of code was created using the Condition Wizard:

PriceVolumeRank() is equal to 1

I have included a screenshot showing what that looks like on the Condition Wizard view. And you can repeat that to create the other 3 values of 2-4.

So what do we do with that? Well the following video shows how to use the Condition Wizard to build lines of code which can then be used to color the background of a watchlist column. (which is very similar to the methods used to build a chart study that displays a label in the upper left corner of the chart):

https://www.hahn-tech.com/thinkorswim-condition-wizard-watchlist/

Ok, those details are provided for those who are trying to learn how to do this stuff on their own. Now let's get to the final solution.

def pvrOne = PriceVolumeRank() is equal to 1;
def pvrTwo = PriceVolumeRank() is equal to 2;
def pvrThree = PriceVolumeRank() is equal to 3;
def pvrFour = PriceVolumeRank() is equal to 4;
def data = PriceVolumeRank();
AddLabel(yes, Concat("PRV: ", data), if pvrOne then Color.GREEN else if pvrTwo then Color.LIGHT_GREEN else if pvrThree then Color.RED else Color.LIGHT_RED);

Notice I used the same section of code created by the Condition Wizard. I then applied that to 4 different variables and adjusted each one to mark a specific value. Then I added two more lines to get the actual value of the PRV and also add the label to the chart. (notice that in this example "pvrFour" is not even used in the color statement). So the "def pvrFour" line can be removed entirely as it is not used. I just wanted you to see how you can create individual variables for each of the four values.

Second screenshot below shows this script has been added to a chart study (displaying the label in the upper left corner). And it has also been added to a custom watchlist column. (same exact code, no changes were required).

 

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on April 26, 2024 10:42 am
0
Thank you so much Pete! I couldn't figure out how to break down each number. I'll refer to this template for future labels.
( at April 26, 2024 10:51 am)
0
Hi Pete! I made a voluntary contribution!
( at May 3, 2024 8:54 pm)
0
Thank you very much! I really appreciate it.
( at May 3, 2024 9:08 pm)