New Intraday High or Low Watchlist / Scan


Category:
0
0

Hey Pete, I was watching your Thinkorswim Alert High Low Video on youtube and was wondering if this can be Applied into a Watchlist / Scan.

Say I scan in the S&P500 and and every time a ticker in the SP500 hits an intraday high it adds it in the result at the very top of the list the first time and assigns a bright green color box, if the next candle doesnt hit intraday high, it assigns a dark green color box.

The idea is to show what tickers are hitting intraday high and putting them on top of the watchlist. See attached Photo sample from etrade.

I hope I explained this articulately enough.

Thanks,

Attachments:
Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on December 9, 2019 11:49 pm
946 views
0
Private answer

I think this should do the trick. The code keeps track of each day's high and low. Then counts the number of times the high and low have exceeded the previous highest and lowest on the day. New highs are counted as positive integers while new lows are counted as negative integers.

The color scheme is based on those values. Above zero and value is colored red while below zero the value is colored green. Then we have the new highs change the background color to green and the new lows change the background color to red.

The column displays data for both new highs and new lows together. The count values allow you to sort by descending to show the stocks that have the largest number of new daily highs at the top. Flip that around to sort ascending and show the largest number of new daily lows at the top.

Set the time frame to any supported intraday time frame. The column will work with extended hours checked or unchecked. However if you check the extended hours option the counts will only include premarket data and not aftermarket data.

Here is your code:

def newDay = GetDay() <> GetDay()[1];
rec trackHigh = if newDay then high else if high > trackHigh[1] then high else trackHigh[1];
rec trackLow = if newDay then low else if low > 0 and low < trackLow[1] then low else trackLow[1]; def newHigh = high > trackHigh[1];
def newLow = low < trackLow[1]; rec countNewHighs = if newDay then 0 else if newHigh then countNewHighs[1] + 1 else countNewHighs[1]; rec countNewLows = if newDay then 0 else if newLow then countNewLows[1] - 1 else countNewLows[1]; plot data = if countNewHighs > AbsValue(countNewLows) then countNewHighs else countNewLows;
data.AssignValueColor(if newHigh or newLow then Color.BLACK else if data > 0 then Color.GREEN else if data < 0 then Color.RED else Color.CURRENT);
AssignBackgroundColor(if newHigh then Color.GREEN else if newLow then Color.RED else Color.CURRENT);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on December 10, 2019 8:58 am
0
Thanks Pete! Will Try this when I get home today! Hope all is well.
( at December 10, 2019 9:47 am)
0
Hi Pete, I stumbled upon this post and it was exactly what I was looking for... ? I copied the code and pasted it as a "custom" study on the "Scan" tab... but I'm puzzled on how to get the "Count Value" column to show so I can sort for the highest number of highs for the day, etc.... I'm trying to have a similar view (only 3 columns; symbol, price, count) to Patrick's attachment from E*Trade, but just for the highs... Thanks again for all your help.... Mark
( at August 18, 2020 10:33 am)
0
The code is designed for a custom watchlist column and not for a scan. Adding this code to the Study Filter of a scan will do nothing.
( at August 18, 2020 10:51 am)
0
Hey Pete. Thanks for this code. Can you please tell me how can I make it as a Scan, that will show only the stock which are currently in new intraday high and lows. Thanks again.
( at December 16, 2020 3:15 pm)