#twitter-follow { border: 0;position: fixed; top: 240px; left:0;} #live-support { border: 0;position: fixed; top: 370px; left:0;} #knowledge-base { border: 0;position: fixed; top: 170px; left:0;}

 Difficulty All Easy Intermediate Advanced Section All Application Charting Indicators Watchlist Screener Downloader Composite Analysis Simulator Portfolio Pivot Table Artificial Intelligence
How to detect stocks trading near all time highs

Updated on 2012-04-28 06:12:28

Stocks that hit new all-time highs are very interesting for several reasons. These stocks are trending up by definition and they have no overhead resistance, which means that investors owning these stocks are making profits.

All-time highs can be detected using the "hhv" function (highest value over a specified period). In this case, the period is infinite and we just need to pass a very high period value.

Stocks trading at all time highs:

a = hhv(close, 1000000);

In the above function, the highest value is calculated based on the stock price time-series ("close" variable).
This function returns the all-time highs level for each trading day.

Screener:

a = hhv(close, 1000000);
filter = (close == a);

Chart:

- Right click on a chart, select "Edit Formula" then type the following formula:

a = hhv(close, 1000000);
plot(a, "Stocks trading At All Time Highs");

Stocks trading NEAR all time highs:

a = hhv(close, 100000);
b = ((a / close) - 1) * 100;

The variable "b" returns the distance, in percentage, between the stock's price and the all time high level. A value of zero indicates that the analyzed stock hits a new all time high.

Screener:

a = hhv(close, 100000);
b = ((a / close) - 1) * 100;
filter = b < 1; // Near all time highs

To detect stocks trading at all time lows simply replace the "hhv" function by "llv" (lowest value over a period).

 Other how-to articles