Platinum Customer
Joined: 9/23/2016 Posts: 3

I'd like to scan the criteria when the arverage of close price of last X bars is in a very narrow range, or let's say slop of X( for example 8 Day) MA/EMA kind of flat. what would this formula look like?
thank you
regards
Kevin

Worden Trainer
Joined: 10/7/2004 Posts: 61,183

The range of closing prices over the last 8 bars is:
MAXC8  MINC8
You can express this as a percentage of the average price over the period as:
100 * (MAXC8  MINC8) / AVGC8
So if you wanted this to be less than 5% for example, you could write this as follows.
100 * (MAXC8  MINC8) / AVGC8 < 5
The 10 period linear regression slope of the 8 period exponential moving average (I used different periods so you can see which is which) can be written as follows in TC2000 v17.
6 * (FAVG(XAVGC8, 10)  AVG(XAVGC8, 10)) / (10  1)
The change as a percent of the average value of the 8 period exponential moving average over those 10 bars can be written as follows.
600 * (FAVG(XAVGC8, 10)  AVG(XAVGC8, 10)) / AVG(XAVGC8, 10)
So checking for the absolute value of this being less than 3% for example could be written as follows.
600 * ABS(FAVG(XAVGC8, 10)  AVG(XAVGC8, 10)) / AVG(XAVGC8, 10) < 3
The above formulas are all just examples. You can adjust the periods and percentages as desired.
Bruce Personal Criteria Formulas TC2000 Support Articles
