Percent change from daily close to current premarket


Category:
0
0

How do I make a column to show gap % in premarket ? It would be something like: (daily close- last price)/last price

I try to use (close-last)/last, but it says ‘last’ is an invalid statement

Saw this post: https://www.hahn-tech.com/ans/percent-change-comparing-previous-day-close-to-premarket/

But the code there use close price from the last intraday bar, I want to use close from the daily bar

Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on June 27, 2022 9:51 pm
871 views
0
Private answer

It seems you are mistaken. But don't worry, this is a common mistake among users of Thinkorswim. I will explain....

And yes this topic has already been discussed in great detail on this forum. However most of those solutions are found in the Stock Scanners topic. So your post here in the Watchlists topic will help to make this easier for folks to find when searching for this solution.

First off, I will start by assuring you can be absolutely certain that the previous solution you linked to in your latest request is the correct, final and only solution available. Here is the link again in case one of our other viewers missed it in your question:

https://www.hahn-tech.com/ans/percent-change-comparing-previous-day-close-to-premarket/

And for those who would like to include the background color of the watchlist column you can get that here:

https://www.hahn-tech.com/ans/custom-dynamic-real-time-change-column/

Ok, now let's take this apart and explain everything so you understand why that is the only solution available. And more importantly, why it is also 100% correct.

  1. It is impossible to combine two different time frames in a custom watchlist column.
    1. Daily time frame does not include premarket data
    2. Intraday time frame cannot access daily time frame data
  2. Because of this, any solution must be done from the intraday time frame
    1. This is why the solution you linked to is designed to work on the intraday time frame. And the only way to read the day session close is to capture to close of the last bar of the regular session. Which is exactly what that solution does.
  3. "Last" (as a price type) does not exist anywhere in the Thinkorswim language. The only way to read the current price of the active bar during premarket is to do the following:
    1. Set your custom watchlist column to an intraday time frame
    2. Make sure to check the box to include extended hours session
    3. Once those two details are set, the current price of the active bar during premarket session is read by using the "Close" price type.

So in summary. The only way to read the daily close AND include premarket data is to set the watchlist column to intraday time frame AND include extended hours session. The code must then read the daily close from the last bar of the previous day's regular session. During premarket session, the current price of the current active bar is always going to be accessed by the following type of statement:

plot currentPremarketPrice = close;

And just to make sure nobody misses the most important detail of all... This requires that you set up your custom watchlist column exactly as described in sections 3-1 through 3-3.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on June 28, 2022 8:42 am
0
Right, You explain pretty well, appreciate it
( at July 2, 2022 10:36 am)