Click here to Login

How to detect stocks trading near all time highs

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

Share |

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.


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


- 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.


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).

one review (Log in)

Other how-to articles

How to hide a trading indicator from a particular time frame

How to quickly download the most recent EOD data for your stocks

How to generate buy/sell signals from a trading system

How to download a trading item from the Sharing Server

How to download earnings calendar data for various stocks

How to hide stock data outside of regular trading hours

How to create trading rules based on Put and Call volume data

How to filter stocks in a market composite

How to get trading orders from a portfolio programmatically

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2024
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.