| Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
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
|
|

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

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

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

 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
|
|
|
Guest-1 |