Download software Tutorial videos
Subscription & data-feed pricing Class schedule

New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
 Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

 How to write a fomula that the Close price of last X bars within y% of stock price Rate this Topic:
 Previous Topic · Next Topic Watch this topic · Print this topic ·
Kevin_Wang28
 Posted : Thursday, September 21, 2017 11:43:46 AM
Registered User
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

Bruce_L
 Posted : Thursday, September 21, 2017 12:05:50 PM

Worden Trainer

Joined: 10/7/2004
Posts: 65,138

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
Users browsing this topic
Guest-1

 Forum Jump Customer Training & Support - Ask a Trainer - TC2000 version 12/18 - Ask a Trainer - TC2000 version 7 - Ask a Trainer - StockFinder 5.0 - PCFs, EasyScan and Custom Indicators General Discussions - Stock and Market Talk - TC2000 version 12 or 18 - TC2000 version 7 - StockFinder 5.0 - RealCode for StockFinder 5.0 Tutorial Videos - TC2000 version 12 tutorial videos - TC2000 version 7 tutorial videos You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot delete your posts in this forum. You cannot edit your posts in this forum. You cannot create polls in this forum. You cannot vote in polls in this forum.