New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.
Percent change syntax
Comments
-
go to the advanced scan workbench in StockCharts and select the PctChange from the Technical Indicators dropdown.
Of course, first select a universe of stocks to scan, like the SP500, for example, and/or other security limitations.
Then add your PctChange criteria.
It will default into your scan like this
and [PctChange(10,close) > 10]
You would change the period from 10 as in 10 days, to what period you want. The > 10 is greater than 10 percent, so you'd change that to 200 if that is what you want. Close can be changed to Low, or High but it's looking at the beginning price, be it close, high, low or open, and comparing it to current last as it is written.
If you run into an issue, post your code here for assistance.0 -
You can express the extreme prices over a period of time using the min( ) and max( ) functions.
So the lowest price over the last month (21 trading days) would be
min(21, low)
and the highest price over the same period would be
max(21, high)
A year is approximately 251 trading days (52 weeks x 5 days = 260 days - 9 market holidays = 251).
In a scan, per cents are expressed as decimals. So, 1.0 is 100%, 80% would be .8, 125% would be 1.25.
A per cent has to be expressed in terms of a base value or a denominator. For instance, if price advances from a low of 5 to a high of 7, the difference from low to high is 2 points. So the low is the base value (the denominator) and the gain (the difference) is the numerator. So, the per cent gain is 2/5 or .4 or 40%.
In your case, you want the gain (high minus low) to be twice (200%) the low.
So, applying the rules of syntax for the scan engine, you would write:
and [ [max(251, high) - min(251, low)] / min(251,low) > 2]
Note that you use brackets [ ] not parentheses ( ) to group numbers in an arithmetic expression.0
Categories
- All Categories
- 2.3K StockCharts
- 395 SharpCharts
- 146 Other Charting Tools
- 69 Saved Charts and ChartLists
- 1.5K Scanning
- 73 Data Issues
- 177 Other StockCharts Questions
- 218 Technical Analysis
- 155 Using Technical Analysis
- 2 InterMarket and International
- 19 Market and Breadth Indicators
- 42 Market Analysis
- 109 Trading
- 109 Trading Strategies
- 163 S.C.A.N the StockCharts Answer Network forum
- 65 Using this StockCharts Answer Network forum
- 98 s.c.a.n. archives
- 5 Off-Topic
- 6 The Cogitation & Rumination Emporium
- Forum Test Area