Distance from High of Day Watchlist


Category:
0
0

Hello Hahn great work on this site, your work is truly an art form.

I wanted to know if you could put together a watchlist item that showed the how far the current price is from the daily high price represented by a color change in the font.

 

This will be helpful for watching stocks to see how far their current (last) price is from the High of Day Price quickly based on the color of the numbers being shown in the watchlist column.

What the watchlist item should display is the real-time LAST PRICE.

If the LAST PRICE is within 10 cents of the HIgh of day price, the color would turn green while displaying the current last price.

 

For example, if the HOD price of the stock is 9 dollars.

  • When the stock price is at 8.90-9.00. the color will become green
  • If the stock is making new highs, the color will remain green
  • If the stock price decreases out of this 10 cent range of High of day, then no color should be displayed on the watchlist column.

What I would like to change colors is the numbers themselves to change color if possible instead of the background similar to how the default %change and Last price column in TOS already are.

 

Also, I made another donation, your work is truly next level.

Marked as spam
Posted by (Questions: 22, Answers: 63)
Asked on May 3, 2018 12:39 pm
381 views
0

Thanks for the contribution. I want everyone to understand what I do here in the Q&A forum is monetized through advertising revenue. I don’t do this for the contributions. However I am grateful for every single contribution. Your comments and feedback are more valuable to me then the monetary gain. Yet I must pay the bills in order to keep this ball rolling. To that end, contributions matter.

Ok, but from here forward I am going to provide percentage multiplier as an input. You can set it to whatever you want. What we do here needs to be broadly applicable to our entire audience. We want it to be awesome, not just ‘good enough’ or ‘good for some’. When I post the solution I will explain how you will adjust the multiplier(s) inputs to achieve your stated goals.

Now to your present request. Everything is clear until you get to the “no color should be displayed”. The default color of the text could be black or white, depending on the “look and feel” selected by each user. To strictly interpret your description, with a black background the text should appear black (making the value invisible). Is that correct?

( at May 3, 2018 2:38 pm)
0

I think percent away from High of day is a brilliant idea.
If the current price is 0-3% near the high of day price then I would like the % to show green.
If the price is 4% or greater, I would like the price to show default. (black if white background or white or black background)

I can tweak the last part but for now assume black background please

( at May 3, 2018 3:49 pm)
0
Private answer

Ok, we have a quick and easy piece of code here. The very first line contains the user input for “percent threshold”. It’s value is positive, but is converted to negative within the code. The value in the watchlist shows the percentage of current price below the high of day (expressed as a negative value). A value of zero means current price is equal to high of day. Screenshot below shows the code applied to a watchlist column.

Here is the code:

input percentThreshold = 4.0;
def newDay = GetDay() <> GetDay()[1];
rec highOfDay = if newDay then high else if high > highOfDay[1] then high else highOfDay[1];
def percentFromHigh = 100 * (close / highOfDay - 1);
plot data = percentFromHigh;
data.AssignValueColor(if data > -percentThreshold then Color.GREEN else Color.CURRENT);

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on May 3, 2018 4:55 pm
0

We tried to deliver the following message to the email address on your user profile. The email came back, rejected by the email server. The message we tried to send is included here:

Just a friendly reminder to use the comment link when you have a new question or comment to add to an existing post in our Q&A forum. Do not use the “Post your Answer” box at the bottom of the thread unless you are adding a new or improved solution to the question. 

This answer will be deleted. You are encouraged to repost your response (included below) as a comment to the most recent answer, or a comment to the original question. The contents of your question appears in the email below.

Thanks!

( at May 3, 2018 5:16 pm)