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 |

50EMA crossing up/down through 100EMA Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
rob22
Posted : Tuesday, August 16, 2011 10:17:25 PM
Registered User
Joined: 5/31/2009
Posts: 65
Trying to write PCF for 50EMA crossing up/down through 100EMA on a 5 minute chart, within the 1ast 12 bars. Also, would like same PCF for 15min and 1 hour chart as well, 15min chart would be within last 8 bars and 1hour chart last 4 bars. I did try and use this formula for the 5 min, but it isn't quite working. XAVGC50>XAVGC100ANDXAVGC50.1
Bruce_L
Posted : Wednesday, August 17, 2011 8:54:53 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
QUOTE (rob22)
Trying to write PCF for 50EMA crossing up/down through 100EMA on a 5 minute chart, within the 1ast 12 bars.

You would set the Time Frame of the following Condition formula to 5-Minutes:

SGN(XAVGC50 - XAVGC100) <> SGN(XAVGC50.1 - XAVGC100.1) OR SGN(XAVGC50.1 - XAVGC100.1) <> SGN(XAVGC50.2 - XAVGC100.2) OR SGN(XAVGC50.2 - XAVGC100.2) <> SGN(XAVGC50.3 - XAVGC100.3) OR SGN(XAVGC50.3 - XAVGC100.3) <> SGN(XAVGC50.4 - XAVGC100.4) OR SGN(XAVGC50.4 - XAVGC100.4) <> SGN(XAVGC50.5 - XAVGC100.5) OR SGN(XAVGC50.5 - XAVGC100.5) <> SGN(XAVGC50.6 - XAVGC100.6) OR SGN(XAVGC50.6 - XAVGC100.6) <> SGN(XAVGC50.7 - XAVGC100.7) OR SGN(XAVGC50.7 - XAVGC100.7) <> SGN(XAVGC50.8 - XAVGC100.8) OR SGN(XAVGC50.8 - XAVGC100.8) <> SGN(XAVGC50.9 - XAVGC100.9) OR SGN(XAVGC50.9 - XAVGC100.9) <> SGN(XAVGC50.10 - XAVGC100.10) OR SGN(XAVGC50.10 - XAVGC100.10) <> SGN(XAVGC50.11 - XAVGC100.11) OR SGN(XAVGC50.11 - XAVGC100.11) <> SGN(XAVGC50.12 - XAVGC100.12)

QUOTE (rob22)
Also, would like same PCF for 15min... 15min chart would be within last 8 bars...

You would set the Time Frame of the following Condition Formula to 15-Minutes:

SGN(XAVGC50 - XAVGC100) <> SGN(XAVGC50.1 - XAVGC100.1) OR SGN(XAVGC50.1 - XAVGC100.1) <> SGN(XAVGC50.2 - XAVGC100.2) OR SGN(XAVGC50.2 - XAVGC100.2) <> SGN(XAVGC50.3 - XAVGC100.3) OR SGN(XAVGC50.3 - XAVGC100.3) <> SGN(XAVGC50.4 - XAVGC100.4) OR SGN(XAVGC50.4 - XAVGC100.4) <> SGN(XAVGC50.5 - XAVGC100.5) OR SGN(XAVGC50.5 - XAVGC100.5) <> SGN(XAVGC50.6 - XAVGC100.6) OR SGN(XAVGC50.6 - XAVGC100.6) <> SGN(XAVGC50.7 - XAVGC100.7) OR SGN(XAVGC50.7 - XAVGC100.7) <> SGN(XAVGC50.8 - XAVGC100.8)

QUOTE (rob22)
...and 1 hour chart... 1hour chart last 4 bars.

You would set the Time Frame of the following Condition Formula to 1-Hour:

SGN(XAVGC50 - XAVGC100) <> SGN(XAVGC50.1 - XAVGC100.1) OR SGN(XAVGC50.1 - XAVGC100.1) <> SGN(XAVGC50.2 - XAVGC100.2) OR SGN(XAVGC50.2 - XAVGC100.2) <> SGN(XAVGC50.3 - XAVGC100.3) OR SGN(XAVGC50.3 - XAVGC100.3) <> SGN(XAVGC50.4 - XAVGC100.4)

PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
rob22
Posted : Wednesday, August 17, 2011 1:10:21 PM
Registered User
Joined: 5/31/2009
Posts: 65
Hi Bruce,This is very awesome, thank you. Does the formula cover both up or down crossovers? or just the 50 down through the 100, not over?
Bruce_L
Posted : Wednesday, August 17, 2011 1:11:16 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
It should return true regardless of the direction of the crossover.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
rob22
Posted : Wednesday, August 17, 2011 9:48:35 PM
Registered User
Joined: 5/31/2009
Posts: 65
Hi Bruce,The hourly chart is not working quite right. When I look at the results on an Easyscan against S&P 500, it gives me 14 stocks and the 50 and 100 EMA's are very close over the last 4 hourly bars, but none seem to be crossing over.
Bruce_L
Posted : Thursday, August 18, 2011 7:43:41 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I can tell you why it happens, but I don't have a workaround. The WatchList Columns are not using the same amount of data to calculate the Exponential Moving Averages as the chart. They are using less data than the chart. You can use the same formula as a Custom PCF % True Indicator and the results should match the chart.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
rob22
Posted : Thursday, August 18, 2011 9:24:24 AM
Registered User
Joined: 5/31/2009
Posts: 65
Hi,I'm a little confused, so the PCF is working correctly, but what ends up on the easyscan list from the PCF is actually not quite correct because it won't calculate the same way? Can you give me the formula for the custom true to make this work correctly?
Bruce_L
Posted : Thursday, August 18, 2011 9:25:53 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
A 50 or 100-Period Exponential Moving Average isn't normally calculated using 50 or 100 bars of data. The calculation of an EMA once it is initialized is as described. You multiply the old value of the EMA by (Period - 1) / (Period + 1) and add it to 2 / (Period + 1) multiplied by the most recent value of whatever is being averaged.

In TC2000 version 12, the chart is using all of the available data in its calculations. This is 500-Bars of data for the far right value on the chart.

In situations where TC2000 version 12 is calculating EMAs for multiple symbols however (such as WatchList Columns and Scans), it is not using 500-Bars of data to calculate the EMA. It appears to be using fewer bars of data in the calculations being done on entire WatchLists than calculations done on the chart for a single symbol.

I have already stated I do not have a workaround. It should be noted that it is theoretically possible to expand the EMA calculations manually to use the same amount of data as the charts (and somewhat less data than this might actually be close enough to get the same results), but the formulas would end up being too long to be practical.

A Condition created by clicking on one of the EMAs instead of creating a formula will work correctly in a WatchList Column or as part of a Scan. But there is no way to OR the Conditions to check for both up and down crossings or to check if it happened anytime within the most recent 4, 8 or 12 bars.

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