♥ 0 |
Hello Hahn, Can you design a watchlist column that interprets multiple indicators and outputs a phase? For example, These indicators will be
The conditions shall be
Anything else that doesn’t fit these criteria = “none”
Marked as spam
|
Private answer
AddLabel() MethodHow to dynamically set the label in a watchlist column. The very same method of adding a label to a chart is the same as we use for the text of a watchlist column. It is named: “AddLabel()”. We have two prior posts that demonstrate how to dynamically set the text of the AddLabel() method. One of these is used in a watchlist, but the logic is exactly the same as would be applied to a chart: https://www.hahn-tech.com/ans/trailing-stop-alert-column/ This is one that is applied to a chart: https://www.hahn-tech.com/ans/conditionally-set-color-text-of-chart-label/ RVI Watchlist ColumnYou have previously posted a request for the RVI changing background colors of a custom watchlist: https://www.hahn-tech.com/ans/relative-volatility-index-rvi-custom-watch-list/ The SolutionSo we’ll be using most of that code in the solution for this one. You did not provide your own code so I will take that to mean you don’t care to learn how to do this and are only looking for the solution. So I will only present the code. Here is the full code. Screenshot below shows what it looks like.
Marked as spam
|
|||||
Private answer
Sorry to post here, but I did not know another way to post attachments outside of the main post Marked as spam
|
Please log in to post questions.
The RVI code from the past is perfect, thank you. I will test this now
So from further testing the code, there seems to be a requirement that needs to be added that I missed in the original post. Along with the current code, can you please add one more condition as a trigger. The condition that should be added is that the current candle bar candle must have at least 50k shares of volume before any of these are displayed.
Thank you
def volumeCondition = volume > 50000;
def up = volumeCondition and RVI >= 55.0 and RelVol >= 2 and AbsValue(percentChange) < = 9.0; def down = volumeCondition and RVI <= 55.0 and RelVol >= 2 and AbsValue(percentChange) < = 9.0; def halt = volumeCondition and RVI <= 55.0 and RelVol >= 2 and AbsValue(percentChange) > 9.0;
Im sorry Pete, where do I add this code to the current code already provided?
In the section that contains the conditions:
#———- Conditions
You should have been able to see that pretty quick. I only added one new line for the volume condition and then modified the three conditions to include the volume condition. So only one new line of code. The other three lines already existed, “def up”, “def down”, and “def halt”. This should be self evident?
Yes, I figured that but I still got the error invalid statement: def at 22:133
Ok, I see what happened. When I pasted those lines into the comment box it managed to break them. Have no idea how that is even possible. So I will repeat those lines of code individually, one line at a time and hope they don’t get broken this time.
def volumeCondition = volume > 50000;
def up = volumeCondition and RVI >= 55.0 and RelVol >= 2 and AbsValue(percentChange) <= 9.0;
def down = volumeCondition and RVI <= 55.0 and RelVol >= 2 and AbsValue(percentChange) <= 9.0;
def halt = volumeCondition and RVI <= 55.0 and RelVol >= 2 and AbsValue(percentChange) > 9.0;
In fact just to get those lines to code correctly I had to go into the administrative side of the site and man-handle them into place. Wow. Sorry about that. Should be good now.
I see I am still getting an error, I have a notepad attachment with the compiled code and errors. below