Watchlist Column for Gap prior close to open


Category:
0
0

How would I display a stock’s gap up or down during market hours as a dollar amount in a watchlist column?  Thank you.

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on June 13, 2023 10:21 am
97 views
0
Private answer

I contacted the author of this question before providing a solution so that I could get a clear definition of the "gap" they wanted to measure.

Response:

In this case it would be the difference between the price at the open and closing price of the most recent candle.

This means the solution would print one value for the current session and that value would not change as the current session unfolds. In that case, we go with the very simplest solution possible. Set the watchlist column to a daily time fame and add the following line of code to a new custom column:

plot data = open - close[1];

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on June 13, 2023 2:49 pm
0
OK. So, the solution I would need is one that changes as the trading day unfolds. So, I guess that would be the difference between the price at open and the current price (as a dollar value) Sorry for the mixup. Thank you.
( at June 13, 2023 3:41 pm)
0
Yep, that would be an entirely different set of specifications and does not fit the context of the question you posted here. So I suggest you use the solution provided in this previous post:
https://www.hahn-tech.com/ans/calculate-percent-change-from-opening-bell-to-current-close/
and change the very first line of code to def dailyPercentChange = open - close; And apply this to a daily time frame as described in that previous question.
( at June 13, 2023 4:16 pm)
0
Thanks for the quick reply. So, the numbers generated in this solution is the dollar amount of the change? Thanks
( at June 13, 2023 4:35 pm)
0
Well, everything on the chart is expressed in dollars. So anytime you subtract one data point from another it will always be in dollars. The previous solution I linked to in my last comment requires you to change the first line of code. If you do not make that change, then the code will display percent change. After you complete the change as instructed, it will display the net difference in dollars.
( at June 13, 2023 4:44 pm)
0
OK. Again, thank you for the quick reply. Also, I sent a donation. I definitely appreciate the great work you do with this website.
( at June 13, 2023 5:51 pm)
0
Thanks, I very much appreciate your voluntary contribution. (I try to discourage describing that as a "donation" since Hahn-Tech is a for-profit company). It's more of a tip jar. Every dollar gets reported as business income to the IRS.
( at June 13, 2023 6:00 pm)