Registered User Joined: 10/2/2008 Posts: 16
|
Hi,
Is there a formula that I can use to scan for stocks with closing prices that have been above the 150 day moving average (simple) for the last 52 days. I don't want to see any stocks greater than or less than 52 days.
Au197
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 710
|
Au197,
If I understand what you're asking for correctly, this Personal Criteria Formula is one way that might work:
C53 < AvgC150.53 and MinC52 > AvgC150
The stocks basically crossed their 150 day SMA 52 days ago and have remained above it since.
Let me know if this suits your purpose.
|
|
Registered User Joined: 5/6/2013 Posts: 9
|
If an Easy Scan condition is for the 20 day MA to turn up, how does one limit that appearance in Easy Scan results to when that event occurs ONLY and NOT all those whose 20 day MA is rising for. the past 10 days?
Only that day event. How can one limit it in Easy Scan to that one event,,,a turn>.
TY
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 710
|
tradergarrett,
An example would be 20 Crossing up through 50 SMA 5 days ago. Formula could be:
AVGC20.5 > AVGC50.5 AND AVGC20.6 <= AVGC50.6
The only stocks that would be returned in an EasyScan would be those which met the condition 5 days ago. The .5 and .6 in the formula "sets it back" to scan for the condition 5 days ago. It really doesn't have any reference to what has happened to those moving averages before or since.
You also have the ability to use Dates in PCFs in a limited format. Click here and type into the index field "PCF"...you can find some Formula examples that might be helpful to you.
|
|
Registered User Joined: 5/6/2013 Posts: 9
|
Michael,
As a Gold member, I certainly appreciate your assistance. However, I assume a regular easy scan condition cannot be included to limit results to just a 20 MA turn up today. unless it's wrtten somehow using just a PCF formula.
Is that correct?
Thanks.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 710
|
Because you have streaming (though delayed) data, if your condition is daily or above, it will fire intraday for you in Gold (though again, it can be up to 15 min delayed).
For example, if you have price crossing a 20 day-moving average condition (built on a daily time frame) if the price crosses that average during the market day, it will pass your Scan/Sort condition and thus be in your EasyScan WatchList when you refresh your scan.
Intraday conditions (e.g. price crossing a 20-minute moving average) are Platinum exclusive features.
|
|
Registered User Joined: 5/6/2013 Posts: 9
|
You perhaps were answering someone else's question.
One final time...If a 20 day MA turns up at the end of day, how can Easy Scan (or a pcf) identify that condition?
Once again, thank you.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 710
|
Sorry TG...my previous response was just intended to show you could see the MA movement intraday in TC Gold.
Depending on how you define "turns up at the end of the day" we should certainly be able to find the condition. However, if you are looking for the moving average turning up on say the last 30 minute bar of the day, then that would be a platinum condition.
Can you describe exactly what you're looking for with "turns up at the end of the day"...I'll try to see if I can create something for you from that.
|
|
Registered User Joined: 5/6/2013 Posts: 9
|
Thank you for your interest.
If a 20 day MA (or any MA) has turned up at the end of the day's trading...on any price chart, I want to screen just for that condition and just for today,...NOT "crossing up thru another MA" or "moving up net" etc, but at the end of today, the MA has turned up.
How does one do that in Easy Scan or in a PCF to obtain scan results just for that specific condition on an end of day basis?
Thanks.
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
This will return True if the moving average has turned up from moving down or flat...
AVGC20 > AVGC20.1 AND AVGC20.1 <= AVGC20.2
|
|
Worden Trainer
Joined: 4/26/2007 Posts: 508
|
tradergarrett,
You're not going to be able to look for intraday activities, such as "MA turning up at the end of the day" at the Gold level of service. The Platinum service level provides the ability to create scan conditions (point and click as well as PCF conditions) that study intraday price and indicator data. Such a scan could be structured such that it looked for stocks whose Moving Averages moved up over the last hour of trading, the last ten minutes of trading, or even the last minute of trading. It sounds like that's the functionality you're after.
I'm sorry to say that won't be possible at your current level of service. If we can help you in setting up an alternative method of finding the types of stocks you're looking for, please let us know.
Best,
Julia Ormond
|
|
Registered User Joined: 5/6/2013 Posts: 9
|
Finally.
Thank you for your kind assistance.
|
|
Registered User Joined: 5/6/2013 Posts: 9
|
Julia,
As clearly stated, intraday etc is not the object, only at the end of day after the market closes. It one wants to view those stocks whose 20 day MA has now risen, this should be possible (just like the condition for "moving up net", etc.). Same principle.
Unless I am mistaken, the formula provided above by "stockguy" should do just that.
Again, thanks.
|
|
Registered User Joined: 5/6/2013 Posts: 9
|
I see the 20 simple moving avg is "AVGC20".
What is the PCF language for a 20 weighted MA.?
Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
An Indicator Formula for a 20-Period Front Weighted Moving Average can be written as:
(20 * C + 19 * C1 + 18 * C2 + 17 * C3 + 16 * C4 + 15 * C5 + 14 * C6 + 13 * C7 + 12 * C8 + 11 * C9 + 10 * C10 + 9 * C11 + 8 * C12 + 7 * C13 + 6 * C14 + 5 * C15 + 4 * C16 + 3 * C17 + 2 * C18 + C19) / 210
An Indicator Formula for a 20-Period Volume Weighted Moving Average can be written as:
(V * C + V1 * C1 + V2 * C2 + V3 * C3 + V4 * C4 + V5 * C5 + V6 * C6 + V7 * C7 + V8 * C8 + V9 * C9 + V10 * C10 + V11 * C11 + V12 * C12 + V13 * C13 + V14 * C14 + V15 * C15 + V16 * C16 + V17 * C17 + V18 * C18 + V19 * C19) / 20 / AVGV20
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/6/2013 Posts: 9
|
Bruce,
Thanks but was looking for the abbeviation. For example:.
Avg = Simple moving average
XAvg = is for exponential
Is there not one for the weighted MA? Could not find it.
Thanks again.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
There isn't any built in syntax for front weighted or volume weighted moving averages or I would have given the formulas in that form originally.
I'm not in the habit of providing long formulas when a shorter one will do unless the longer formula is both more intuitive for a customer to understand and still relatively short.
The PCF Formula Descriptions topic referenced in my previous response has a fairly comprehensive list of the syntax which is valid in the Personal Criteria Formula Language. Anything that isn't listed probably isn't built into the language and would need to be constructed from the syntax which is listed.
Some things such as front weighted and volume weighted moving averages can be constructed as demonstrated above. Some things such as ADX cannot be constructed using the available syntax without the resulting formulas being too long and slow to be practical or post in the forums.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/6/2013 Posts: 9
|
It' is unfortunate there is none available..
Like the simple or exponential MA, a shorter version for the WMA should also be constructed to join its cousins in avoiding long language and confusion. That is my suggestion and is simple logic.
In any case, thanks.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Thank you for your suggestion.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Gold Customer
Joined: 5/6/2013 Posts: 27
|
I have a formula in a different program that I am having replicating here in the form of a PCF formula. Can someone help me?
Formula using the RSI indicator (all daily)
A = 5 period RSI of the close
B = 6 period moving average of the above result
C = Highest "B" in the last 6 days
D = Lowest "B" in the last 6 days
The formula should be (B minus D) divided by (C minus D) times 100
Can you help me put this formula into a PCF?
Thanks!
Garry
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
We can create the formula for a non-Wilder's Smoothed RSI:
100 * (RSI5.6 - MIN(RSI5.6,6)) / (MAX(RSI5.6,6) - MIN(RSI5.6,6))
But a similar formula for a Wilder's Smoothed version of this is too long and slow to be practical or post in the forums.
That said, it is possible to reproduce this as an indicator using the TC2000 version 12.4 beta:
http://www.tc2000.com/beta
Add an RSI - Wilder's indicator to the chart. Set the Period of the Wilder's RSI indicator to 5 and the period of the moving average to 6.
Add a Stochastics indicator to the chart. Set the Period of the Stochastic to 6 and the %K to 1. You can remove the %D from the chart if you want.
Then click on the Stochastic indicator and select Change Data Source. You will want to set the data source to the 6-period moving average of the 5-period Wilder's RSI.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Gold Customer
Joined: 5/6/2013 Posts: 27
|
It does exactly duplicate my end result but I can and will work with it.
Thanks for your generous help.
Garry
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The technique provided in my post should match the results of a calculation done using the steps described exactly. Note that there is a similar indicator called Stochastics RSI which is built into the program and involves all of the same indicators, but which does the steps in a different order than described in your post. If the results are not matching, you may want to try the built in Stochastics RSI indicator to see if it matches.
The Stochastics RSI calculates an RSI, takes a Stochastic of that RSI and then applies the moving average instead of taking an RSI, applying a moving average and then taking a Stochastic as described in your post.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Gold Customer
Joined: 5/6/2013 Posts: 27
|
Thanks for your help and guidance. It now works!
If I could ask...there is one final request on a different complicated formula, from the other program, that I need to transfer to TC2000 and can't install properly using PCF guide.
HH = highest high for last 21 periods
LL = lowest low for last 21 periods
--------------------------------------------
A = (Close - LL)
B = 8 period exp-ma of "A"
C = 5 period exp-ma of "B"
D = (HH - LL)
E = 8 period exp-ma of of "D"
F = 5 period exp-ma of "E"
G = (100 X "C") divided by ("E")
H = 3 period MA of ("G")
Could you help me to properly set up this formula?
Thanks!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The algorithm as described calculates F but does not use it.
100 * ((XAVG(XAVGC8,5) - (7 * XAVG(MINL21,8) - 4 * XAVG(MINL21,5)) / 3) / (XAVG(MAXH21,8) - XAVG(MINL21,8)) + (XAVG(XAVGC8.1,5) - (7 * XAVG(MINL21.1,8) - 4 * XAVG(MINL21.1,5)) / 3) / (XAVG(MAXH21.1,8) - XAVG(MINL21.1,8)) + (XAVG(XAVGC8.1,5) - (7 * XAVG(MINL21.1,8) - 4 * XAVG(MINL21.1,5)) / 3) / (XAVG(MAXH21.1,8) - XAVG(MINL21.1,8))) / 3
Using F instead of E to calculate G results in:
100 * ((XAVG(XAVGC8,5) - (7 * XAVG(MINL21,8) - 4 * XAVG(MINL21,5)) / 3) / ((7 * (XAVG(MAXH21,8) - XAVG(MINL21,8)) - 4 * (XAVG(MAXH21,5) - XAVG(MINL21,5))) / 3) + (XAVG(XAVGC8.1,5) - (7 * XAVG(MINL21.1,8) - 4 * XAVG(MINL21.1,5)) / 3) / ((7 * (XAVG(MAXH21.1,8) - XAVG(MINL21.1,8)) - 4 * (XAVG(MAXH21.1,5) - XAVG(MINL21.1,5))) / 3) + (XAVG(XAVGC8.2,5) - (7 * XAVG(MINL21.2,8) - 4 * XAVG(MINL21.2,5)) / 3) / ((7 * (XAVG(MAXH21.2,8) - XAVG(MINL21.2,8)) - 4 * (XAVG(MAXH21.2,5) - XAVG(MINL21.2,5))) / 3)) / 3
But I'm guessing the description actually has similar issues to the Stochastics RSI description and is actually doing things in the wrong order. If this is the case, you can just use a Stochastics indicator with the following settings:
- Period: 21
- %K: 8
- Average Type: Exponential
The %D indicator in the chart would have the following settings:
- Period: 5
- Average Type: Exponential
Then you would add a 3-period moving average to the %D indicator to get the final result.
If the 3-period moving average is simple (I've made that assumption as it is the only moving average not specified as exponential), then the version of H plotted by the 3-period moving average above could also be written using the following formula:
(7 * XAVG(STOC21.3,8) - 4 * XAVG(STOC21.3,5)) / 3
Understanding Stochastics
Cascades of Moving Averages
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Gold Customer
Joined: 5/6/2013 Posts: 27
|
Thank you for your excellent guidance and assistance.
Garry
|
|
Gold Customer
Joined: 5/6/2013 Posts: 27
|
Bruce,
I wrote a formula as follows and which is indicated as valid in PCF:
((MAXH8)+(MAXL8)+(C))/3
I can't seem to get two MA indicators (5 & 10 period Weighted MA) of that result. Can you help me?
Appreciate your help one last time.
Garry
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
A 5-Period Weighted Moving Average of your Indicator Formula can be written as:
(5 * (MAXH8 + MAXL8 + C) + 4 * (MAXH8.1 + MAXL8.1 + C1) + 3 * (MAXH8.2 + MAXL8.2 + C2) + 2 * (MAXH8.3 + MAXL8.3 + C3) + MAXH8.4 + MAXL8.4 + C4) / 45
And a 10-Period Weighted Moving Average of Your Indicator Formula can be written as:
(10 * (MAXH8 + MAXL8 + C) + 9 * (MAXH8.1 + MAXL8.1 + C1) + 8 * (MAXH8.2 + MAXL8.2 + C2) + 7 * (MAXH8.3 + MAXL8.3 + C3) + 6 * (MAXH8.4 + MAXL8.4 + C4) + 5 * (MAXH8.5 + MAXL8.5 + C5) + 4 * (MAXH8.6 + MAXL8.6 + C6) + 3 * (MAXH8.7 + MAXL8.7 + C7) + 2 * (MAXH8.8 + MAXL8.8 + C8) + MAXH8.9 + MAXL8.9 + C9) / 165
Note that MAXL8 is the highest low of the most recent 8 bars. If you want the lowest low of the most recent 8 bars you should use MINL8 instead.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Gold Customer
Joined: 5/6/2013 Posts: 27
|
Bruce,
You are indeed correct. Unfortunately, I misread/copied my own formula.The first parmeters in my former setup reads...
HH8 = Highest(HIGH,8)
LL8 = Lowest(LOW,8)
So for any "MaxL8", that should now be replaced with "MINL8" instead, if I understand your presentation.
Thanks again for all your help.
Garry
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You are correct in your understanding.
A 5-Period Weighted Moving Average of your new Indicator Formula can be written as:
(5 * (MAXH8 + MINL8 + C) + 4 * (MAXH8.1 + MINL8.1 + C1) + 3 * (MAXH8.2 + MINL8.2 + C2) + 2 * (MAXH8.3 + MINL8.3 + C3) + MAXH8.4 + MINL8.4 + C4) / 45
And a 10-Period Weighted Moving Average of your new Indicator Formula can be written as:
(10 * (MAXH8 + MINL8 + C) + 9 * (MAXH8.1 + MINL8.1 + C1) + 8 * (MAXH8.2 + MINL8.2 + C2) + 7 * (MAXH8.3 + MINL8.3 + C3) + 6 * (MAXH8.4 + MINL8.4 + C4) + 5 * (MAXH8.5 + MINL8.5 + C5) + 4 * (MAXH8.6 + MINL8.6 + C6) + 3 * (MAXH8.7 + MINL8.7 + C7) + 2 * (MAXH8.8 + MINL8.8 + C8) + MAXH8.9 + MINL8.9 + C9) / 165
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Gold Customer
Joined: 5/6/2013 Posts: 27
|
Bruce,
Thanks again for your assistance. It has now been successfully completed.
Happy Holidays to you and your family..
Garry
|
|
Gold Customer
Joined: 5/6/2013 Posts: 27
|
Bruce,
This may be off the wall but is there any way to run a RSI on a 20 day WMA or SMA in TC2000 using a PCF?
As always, thanks for your help.
Garry
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You could probably write a PCF for an RSI based on a 20-period simple moving average instead of price if the settings of the RSI were known (period and if it is the plain RSI or RSI - Wilder's indicator). A similar PCF for a 20-period front weighted moving average would be too long and slow to be practical or post in the forums.
A better way to do this in TC2000 version 12.4 would be to add both the 20-period moving average and RSI indicators to the chart. Then click on the RSI indicator and select Change Data Source to use the 20-period moving average instead of price.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Gold Customer
Joined: 5/6/2013 Posts: 27
|
Bruce,
Have only version 12.3 right now (until they get the bugs out)
Was thinking along the lines of 5 period regular RSI on a 20 period SMA. How is this done?
Thanks again!
Garry
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try using the following Indicator Formula as the Formula in a Custom PCF Indicator:
100 * ((AVGC20 > AVGC20.1) * (AVGC20.1 - AVGC20) + (AVGC20.1 > AVGC20.2) * (AVGC20.2 - AVGC20.1) + (AVGC20.2 > AVGC20.3) * (AVGC20.3 - AVGC20.2) + (AVGC20.3 > AVGC20.4) * (AVGC20.4 - AVGC20.3) + (AVGC20.4 > AVGC20.5) * (AVGC20.5 - AVGC20.4)) / (ABS(AVGC20 - AVGC20.1) + ABS(AVGC20.1 - AVGC20.2) + ABS(AVGC20.2 - AVGC20.3) + ABS(AVGC20.3 - AVGC20.4) + ABS(AVGC20.4 - AVGC20.5) + .00001)
It should probably be noted that TC2000 version 12.4 actually fixes bugs found in TC2000 version 12.3 and should have fewer bugs overall.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Gold Customer
Joined: 5/6/2013 Posts: 27
|
Bruce,
Thanks again for your assistance on this formula. It works.
A suggestion that I have offered customer service many times and that is this. TC2000 is very good but a nice charting platform without a backtesting feature is about effective as a table without legs.
Their suggestion was "marking it on a chart (with easy scan) but that is cumbersome procedure with multiple conditions."
They also said "you can plot the formula as a Custom PCF % True Indicator and you will see a spike in the indicator each time the formula condition(s) are met. If you are using mulitple custom conditions (which I do), you can combine them into one by creating a new condition and adding all of your condition formulas with AND between each one."
Correct me if I am wrong but assume easy scan type conditions would not work in this environment.
If you can give a simple and multiple PCF condition example with proper construction in what they advised, I will try to work and adapt it with some PCF formulas I already have and go from there.
Again, appreciate your help
Garry
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
If I'm understand "easy scan type conditions would not work in this environment" correctly, your assumption is correct. It is not possible to include fundamentals or conditions created by clicking on an indicator and selecting Create Scan Condition in a Custom PCF % True Indicator. Only requirements which can be expressed in the Personal Criteria Formula Language can be included.
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!
Let us take four simple requirements and explore how they might be combined. A Condition Formula for the close being above the open can be written as:
C > O
A Condition Formula for the close being above the previous close can be written as:
C > C1
A Condition Formula for the high being above the previous high can be written as:
H > H1
And a Condition Formula for the low being above the previous low can be written as:
L > L1
Any of the above Condition Formulas could be used as the Boolean Formula in a Custom PCF % True Indicator to display a spike on the chart when the Boolean Formula is true. We could check for all four requirements being true by putting AND in between all of the individual formulas to create a longer Boolean Formula for the Custom PCF % True Indicator:
C > O AND C > C1 AND H > H1 AND L > L1
Let's imagine for a moment that we only need either the first two requirements to be true or the last two requirements to be true. We could do this using OR instead of AND:
(C > O AND C > C1) OR (H > H1 AND L > L1)
Note the use of parentheses around the first two and last two requirements. This is to force the AND operators to happen before the OR operator. If this is not done, the formula would have been interpreted as:
C > O AND (C > C1 OR H > H1) AND L > L1
This is because OR happens before AND in the order of operations.
*,/
+,-
>,>=,<,<=,=,<>
OR
AND
If you are ever in doubt about the order in which various calculations and comparisons will happen, use parentheses to force the order. They may not be necessary, but they also shouldn't cause any problems as long as they are well formed and clearly delineate which calculations should happen first.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Gold Customer
Joined: 5/6/2013 Posts: 27
|
Bruce,
Thank you for the very clear examples and format. If there are any issues or questions, will let you know.
Thanks also for the education and assistance on this project.
Best regards,
Garry
|
|
Gold Customer
Joined: 5/6/2013 Posts: 27
|
Bruce,
Good Morning.
Is there an effective way to screen for stocks that have been in a 6 to 8 week consolidation period and a fairly narrow sideways trend?
Thanks again for your help.
Garry
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It would depend on how you want to define consolidation. For example if you just wanted to check for the high over the most recent six weeks to be 10% or less above the low over the most recent six weeks, you could create something similar to the following weekly Condition Formula:
MAXH6 <= 1.1 * MINL6
Or something similar to the following for a daily Condition Formula:
MAXH30 <= 1.1 * MINL30
If you have a different definition in mind, then the Condition Formula would need to change as well.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |