Dynamic Hi/Lo watchlist


Category:
0
0

Hi

Is it possible to create a dynamic watchlist with ThinkScript that’ll show all tickers that have reached a new high/low

1. for X period, eg. 52 week, daily, weekly, etc
2. sets the color to Green/Red respectively
3. Has a count column that shows the amount of times the high/low has been broken since the first break occurred

Option 1 is my main objective, the others are bonus

tx

Marked as spam
Posted by (Questions: 1, Answers: 3)
Asked on March 20, 2017 5:24 pm
1600 views
0
Private answer

Ok let’s break this down into your three main time spans. You can adapt it as needed. The dynamic watchlist is achieved very simply by creating and saving a custom scan. Then from the watchlist you select that saved scan as your watchlist. From that point, the scan runs dynamically in the watchlist. The very last line of code I provide is used to color the background of a custom watchlist column based on your conditions.

This one can be set to daily time frame and it will compare the current bar’s high to the highest high in 252 trading days, roughly 52 weeks.

plot scan = high > Highest(high[1], 252);

This one can be set to hourly time frame and it will compare the current bar’s high to the highest high in the previous 7 hours. (seven hourly bars in a day)

plot scan = high > Highest(high[1], 7);

This one can be set to a daily time frame and it will compare the current bar’s high to the highest high in the previous 5 days (one trading week)

plot scan = high > Highest(high[1], 5);

In order to color the background of a custom column in the watchlist we’ll need to add a single line to any of the scans listed above. The install this in a custom column in your watchlist:

AssignBackgroundColor(if scan == 1 then Color.GREEN else Color.BLACK);

In order to cover the other side (lowest low in period), you should be able to adapt the code samples given to achieve the results you requested.

In order to show the number of times a previous high has been breached requires a very complicated solution that is not provided in the scope of this forum.

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on March 20, 2017 8:40 pm
0

Thanks for the info.

So there’s no way to incorporate the code into the scan itself, it can only be added as a custom column in the watch list after you’ve specific scan criteria to limit the tickers?

I know there’s a limit of 300 rows per custom column or something to that effect which limits scanning the entire market for new highs/lows

( at March 21, 2017 1:59 am)
0

I don’t understand the question here. Perhaps I should have gone into more detail. You wanted a dynamic watchlist. That is accomplished by creating and saving a custom scan. Then opening that saved scan in a watchlist. Thus ”incorporating the code into the scan itself”. The part that is added to the custom column merely changes the background color based on the condition.

( at March 21, 2017 7:06 am)
0

Hi

I understand the creation of a dynamic watchlist from a saved scan. What I meant was, is there a way to have the custom scan limit the results to those stocks near their x day(s) Hi/Lo because I see there is an option in the scan to add a study filter.

So the watchlist will then contain only stocks near their Hi/Lo and the custom column will then highlight those that reach/surpass their HiLo.

Hope I’ve explained it better this time
Tx

( at March 25, 2017 2:04 am)
0

Sorry. My responses in the Q&A forum are made in the context of our published videos. Since you are asking about the option to add a study filter to a scan, it seems you have not seen any of our videos on customized stock scanners. I’m sure after you view several of our videos in the Scan category things will clear up. We provide many examples of adding a study filter to a custom scan, along with code samples to download.

( at March 25, 2017 8:38 am)
0
Private answer

Can the last/ask be used instead of the high? Does thinkscript in a watch list execute only on the close of a candle and if so, which timeframe candle is used or how does TOS choose? E.g.. If we used 252/52 week would it use a weekly/daily candle?

Just wondering because it would greatly affect the valueness of the watch list as it will only show you a new high/low when the candle closes as opposed to when the new high actually occurred which could have been 20mins ago

Also, how often does a dynamic watch list refresh?

Thanks again

Marked as spam
Posted by (Questions: 1, Answers: 3)
Answered on March 21, 2017 3:23 am
0

The mark, last, ask and bid are all available from a watchlist. You raise a concern about the watchlist signaling only on the close of the candle. The way I structured the code is to check the high of the current and active bar against the previous high. This can trigger ”intra-bar” and does not wait for the close. As to the refresh rate of a watchlist, you have two things in play. One is the scan that you created and saved, that is then running in the watchlist. The other is the watclist itself. I have not tested the refresh rate but I have heard that during the high volumes of the regular markets hours it takes 3-4 minutes for signals in the watchlist to respond to underlying conditions.

( at March 21, 2017 7:12 am)
0

You mentioned in your initial answer ”This one can be set to daily time frame and it will compare the current bar’s high to the highest high in 252 trading days, roughly 52 weeks….”

Can you set the scan to a specific timeframe or do you have to have a chart running in a specific timeframe thereby ”linking” the watchlist?

Sorry, I’m quite new to TOS

( at March 25, 2017 2:13 am)
0

May have answered my own question after doing some Googling….

Do I set the the timeframe by using the period option eg. Highest(high(period=”DAY”)[1], length))?

( at March 25, 2017 3:14 am)
0

Again, you really should be viewing our videos on stock scanners. We demonstrate this in nearly every single video on stock scanners. You cannot use secondary aggregation period within the study filter itself. Once you see where it is set, it will all make sense.

( at March 25, 2017 8:40 am)