Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

help with a scan criteria Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
rbayliss40
Posted : Thursday, June 26, 2014 10:55:11 AM
Registered User
Joined: 8/30/2011
Posts: 161

im not sure how to do this, i can find the basic stuff like crossing above but when i try to build a more complex criteria i fail.

I have made and indicator formula for my chart. It is

(c/avgc20)+(c/avgc40)+(c/avgc60)/3

This is set to display as a line on my charts with a 30 simple moving average.

I have added the indicator to my chart and in the edit box called it close performance.

The criteria im after is

2 closes ago was below 30sma

1 closes ago was above 30 sma

todays close is above close 1

It will find my indicator as named recent performance but i dont seem to be able to add the other criteria id like.

 

Bruce_L
Posted : Thursday, June 26, 2014 11:29:54 AM


Worden Trainer

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

Let's start with the indicator itself. As currently written, it is only dividing C / AVGC60 by 3 and then adding it to the other two terms. I suspect you actually want something like the following instead.

(C / AVGC20 + C / AVGC40 + C / AVGC60) / 3

As it adds together all of the terms and then divides the result by 3.

You can only create conditions for the current bar when you click on an indicator and select Create Scan Condition.

So if you want to create conditions based on the past bars by clicking on indicators and selecting Create Scan Condition, you would need to create a version of the indicator which plots the past value at the location of the current bar.

This can be done using the Offset setting of a moving average indicator. If the Offset setting is set to 1, it will plot the value of the moving average from one bar ago ot the location of the current bar. Setting the Offset setting to 2 would use the value of the moving average from two bars ago instead.

Another interesting thing about a moving average is that if he period of the moving average is set to 1, it is just going to return the same results as whatever is being averaged.

Combining these two features of the moving average indicator allows you to plot past values of indicators by adding a 1-period moving average with the offset set to the number of bars ago of interest. In most instances a 1-period simple moving average would work, but there are some cases where you will need to use a 1-period exponential moving average instead to get the correct results in scans and WatchLists.

So to create a 2 closes ago was below 30-sma condition, you would add a 1-period moving average to the Custom PCF Indicator with the Offset set to 2. You would also set the Offset on the 30-sma to 2. Then Click on the 1-period offset moving average of the Custom PCF Indicator and select Create Scan Condition to create a condition for it being below the now offset 30-period moving average.

For 1 close ago, you can just change the offsets from 2 to 1 on both the 1-period moving average of the Custom PCF Indicator and the 30-sma.

You can delete the 1-period offset moving average of the Custom PCF Indicator and change the offset of the SMA30 back to 0 after creating these conditions if desired.

A condition for today's close being above close 1 is just a Moving Up Net condition with its period set to 1 and the Net Change > setting set to 0.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
rbayliss40
Posted : Thursday, June 26, 2014 11:56:09 AM
Registered User
Joined: 8/30/2011
Posts: 161

This makes sense thanks bruce ill have a play around with it

trout2
Posted : Thursday, June 26, 2014 12:28:15 PM
Registered User
Joined: 12/9/2008
Posts: 30

Hi Bruce,   I tried to send this yesterday but I may have done it incorrectly. Here goes:     After 5 or more down days     the next days open     opens below yesterdays close      and closes below yesterdays close   ( it never reaches the previous days close )  Thank You  

Bruce_L
Posted : Thursday, June 26, 2014 12:34:53 PM


Worden Trainer

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

You asked it a bit differently than how you asked it in the Screening for BATS traded us stocks topic, so the formulas are a bit different as well.

If by down days you mean the close is below the previous close.

H < C1 AND C1 < C2 AND C2 < C3 AND C3 < C4 AND C4 < C5 AND C5 < C6

If by down days you mean the close is below the open.

H < C1 AND C < C1 AND C1 < O1 AND C2 < O2 AND C3 < O3 AND C4 < O4 AND C5 < O5

Learn how to use the forums: post a new topic, reply, Search existing topics
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

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