Registered User Joined: 11/14/2004 Posts: 2
|
I want to be able to scan for stocks, and the scan needs to include the following four conditions:
-
The DPO(20) on the current bar is positive.
-
The MACD(12,26,9) on the current bar is positive.
-
The price is above the weighted moving average.
-
One or more of the previous three conditions was not true one bar ago.
New to this language, could anyone help me write the corresponding PCFs?
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
A Condition Formula for TC2000's 20-Period Detrended Price Oscillator (DPO) being above zero could be written as:
C > AVGC20.11
A Condition Formula for an Exponential MACD 12,26 being above zero could be written as:
XAVGC12 > XAVGC26
A Condition Formula for an Exponential MACD Histogram 12,26,9 being above zero could be written as:
XAVGC12 + XAVG(XAVGC26,9) > XAVGC12 + XAVG(XAVGC12,9)
A Condition Formula for Price being above its Front Weighted Moving Average would depend on the period of the Front Weighted Moving Average. For example, a Condition Formula for Price being above its 5-Period Front Weighted Moving Average could be written as:
C > (5 * C + 4 * C1 + 3 * C2 + 2 * C3 + C4) / 15
Combining these into a single formula which checks for all three requirements being true during the current bar and at least one of the three requirements isn't true during the previous bar would depend on if you are interested in the raw MACD or MACD Histogram and the period of the Front Weighted Moving Average.
If you were interested in the raw MACD and a 5-Period Simple Moving Average, the Condition Formula could be written as:
C > AVGC20.11 AND XAVGC12 > XAVGC26 AND C > (5 * C + 4 * C1 + 3 * C2 + 2 * C3 + C4) / 15 AND (C1 <= AVGC20.12 OR XAVGC12.1 <= XAVGC26.1 OR C1 <= (5 * C1 + 4 * C2 + 3 * C3 + 2 * C4 + C5) / 15)
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: 11/14/2004 Posts: 2
|
Wow that was fast. Thanks, Bruce!
|
Registered User Joined: 2/13/2005 Posts: 368
|
Bruce, Are you saying that the Detrended price Oscillator is just a moving average with an 11 day lookback?? Thanks
QUOTE (Bruce_L)
A Condition Formula for TC2000's 20-Period Detrended Price Oscillator (DPO) being above zero could be written as:
C > AVGC20.11
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It is actually the close minus an offset moving average of the close. There is no universal agreement on if the price or moving average should be offset or even if the plot should extend all the way to the right of the chart.
There is an extensive discussion of this in the Detrended Price Oscillator topic. The version being used in TC2000 subtracts a Simple Moving Average with the same Period as the Period of the DPO from the current price with the moving average being offset (Period / 2) + 1 bars.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|