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 |

Stochastics crossing MA moving up Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
tonyofderby
Posted : Tuesday, April 18, 2006 11:24:55 AM
Registered User
Joined: 2/21/2006
Posts: 24
Hello

I am new to Telechart and have set myself the task of creating a
Personal Criteria Formula to find when the Stochastic crosses its
smoothed average going up from a low value. So, the ‘fast’ is above the ‘slow’ today whereas it was below the ‘slow’ two days ago.

I have set my chart criteria to 20:12:9 and wish to program a PCF
and then an Easyscan to find stocks meeting my criteria.

This is what I programmed:

(STOC20.12 <= 30) AND (STOC20.12 > STOC20.12.2) AND (AVG(STOC20.12,9) < STOC20.12) AND (AVG (STOC20.12.2,9 ) > STOC20.12.2)

The first two terms seem to work OK, but I am stumbling on using the averaging syntax for Stochastics.

Can you help?

Kind regards

Tony
Craig_S
Posted : Tuesday, April 18, 2006 11:34:58 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
This should work for you:

STOC20.12<=30 AND STOC20.12>STOC20.12.2 AND STOC20.12>AVG(STOC20.12,9) AND STOC20.12.2<AVG(STOC20.12.2,9)

- Craig
Here to Help!
Doug_H
Posted : Tuesday, April 18, 2006 11:35:11 AM


Worden Trainer

Joined: 10/1/2004
Posts: 4,308
Unless I'm reading this incorrectly, your PCF looks fine...and it tested fine in my TeleChart. What difficulty are you having?

- Doug
Teaching Online!
Craig_S
Posted : Tuesday, April 18, 2006 11:36:34 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
(you had a space after your second AVG)

- Craig
Here to Help!
tonyofderby
Posted : Tuesday, April 18, 2006 11:59:10 AM
Registered User
Joined: 2/21/2006
Posts: 24
Hi Doug and Craig

Many thanks for the swift responses. It seems I was pretty close!

I copied your version, updated it and ran it. I got 102 stocks, but many don't show the crossover I was expecting. For example, STT, MEDX, FMT and EMC, to name just 4 of the first few I scanned. Others did show the crossover.

Am I going wrong somewhere?

Regards

Tony
Doug_H
Posted : Tuesday, April 18, 2006 11:59:32 AM


Worden Trainer

Joined: 10/1/2004
Posts: 4,308
Good eye, Craig...missed it myself. Tested fine, but would have given erroneous results.

- Doug
Teaching Online!
Craig_S
Posted : Tuesday, April 18, 2006 12:01:50 PM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
The PCF is for a simple stochastic. Is your plotted stochastic exponential? Are you looking at a daily chart?

- Craig
Here to Help!
tonyofderby
Posted : Tuesday, April 18, 2006 12:05:11 PM
Registered User
Joined: 2/21/2006
Posts: 24
Hi Craig

Yes, I am looking for an exponential stochastic on a daily chart.

Thanks

Regards

Tony
Craig_S
Posted : Tuesday, April 18, 2006 12:08:44 PM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
If you change the stochastic on your chart to simple it will match up with the PCF above.

If you want the formula to be for an exponential stochastic, let me know.

- Craig
Here to Help!
tonyofderby
Posted : Tuesday, April 18, 2006 12:10:08 PM
Registered User
Joined: 2/21/2006
Posts: 24
Craig,

Yes I would please.

Many thanks

Tony
Bruce_L
Posted : Tuesday, April 18, 2006 12:23:47 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
tonyofderby,
Please try the following:

XAVG(STOC20.1,12) <= 30 AND XAVG(STOC20.1,12) > XAVG(STOC20.1.2,12) AND XAVG(STOC20.1,9) > XAVG(STOC20.1,12) AND XAVG(STOC20.1.2,9) < XAVG(STOC20.1.2,12)

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
tonyofderby
Posted : Tuesday, April 18, 2006 1:21:19 PM
Registered User
Joined: 2/21/2006
Posts: 24
Hi Bruce

That's good, it works. Many thanks.

However, it seems so different from my starting point. Can you help by explaining the syntax, or pointing me to where I can study this in more detail?

Presumably the X is for exponential, but the factors in the brackets don't seem to fully relate to my starting parameters, for example: XAVG(STOC20.1.2,9).

Hope you can help.

Kind regards

Tony
Bruce_L
Posted : Tuesday, April 18, 2006 1:40:26 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
tonyofderby,
It looks like you already understand the syntax used by TeleChart's Personal Criteria Formula Language for Stochastics:

STOC20.12.2

Would be the 12-Period Simple Moving Average of the 20-Period Stochastic from 2-Periods Ago. The PCF language does not have syntax for including an Exponential Moving Average as part of a Stochastic automatically, but does have an Exponential Moving Average Function.

XAVG(STOC20.1.2,12)

Is the 12-Period Exponential Moving Average of the 1-Period Simple Moving Average of the 20-Period Stochastic from 2-Periods Ago, which is the same thing as the 12-Period Exponential Moving Average of the 20-Period Stochastic from 2-Periods Ago.

If TeleChart's XAVG() function accepted formulas or functions as arguments, the slow line of an Exponential Stochastic 20,12,9 could be expressed as XAVG(XAVG(STOC20.1,9),12), but such nesting is not correct syntax. It is possible to use Theorem 1 from the following post however:

Cascades of Moving Averages

If we isolate just a portion of your formula after converting it from Simple to Exponential Moving Averages as shown above:

XAVG(STOC20.1,12) > XAVG(XAVG(STOC20.1,9),12)

becomes:

XAVG(STOC20.1,12) > 11 / 3 * XAVG(STOC20.1,12) - 8 / 3 * XAVG(STOC20.1,9)

subtract (XAVG(STOC20.1,12) - 8 / 3 * XAVG(STOC20.1,9)) from both sides to get:

8 / 3 * XAVG(STOC20.1,9) > 8 / 3 * XAVG(STOC20.1,12)

then divide by 8 / 3 to get:

XAVG(STOC20.1,9) > XAVG(STOC20.1,12)

The rather simple result is not a coincidence resulting from your particular choice of Moving Average Periods, but I'm hoping the outlined steps are still helpful in understanding why it works.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Craig_S
Posted : Tuesday, April 18, 2006 1:41:14 PM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
Watch this short video for me:

Understanding Stochastics

Your stoc is 20/12/9

The 12 is the avg period for the stoc20, thus:

XAVG(STOC20.1,12) returns the value of your stoc today

Does that help?



- Craig
Here to Help!
tonyofderby
Posted : Tuesday, April 18, 2006 2:04:46 PM
Registered User
Joined: 2/21/2006
Posts: 24
To Bruce, Craig and Doug,

Thank you for your explanations. I now understand the syntax. It was more complicated than I first thought. I will now reinforce my (hesitant) knowledge by extending the PCF a little.

Thank you all for your help.

Kind regards

Tony
tonyofderby
Posted : Sunday, April 30, 2006 11:37:42 AM
Registered User
Joined: 2/21/2006
Posts: 24
Hi Folks

I am coming back to this topic and would like some more explanation from Bruce if he is on line:

His 13:40:26 answer provided an explanation of how to manipulate exponential moving averages and referred to Theoerem 1. What is this? Can you either explain or refer me to the source?

Alternatively, could you provide more information on the maths you employed in your explanation.

Many thanks
Bruce_L
Posted : Sunday, April 30, 2006 11:56:21 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
tonyofderby,
I'm not sure why the post originally referenced itself instead of the topic containing the Theorem used, but it has been corrected.

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