Worden Discussion Forum
Customer Training & Support
Ask a Trainer - TC2000 version 12.4
I'm new to V12.1, however I was a subscriber many years ago, probably more than 10.
I would like to create a PCF that will allow me to evaluate two moving averages crossover by backtesting. Is this possible in this version?
For example, I would like to test a 4-day FW Mov Avg crossing an 8-day FW Mov Avg of the 4-day FW Mov Avg?
Can you help with the formula for this?
In general, you are better off adding the Moving Averages to the chart and then clicking on one of them to select Create Scan Condition than creating a Condition Formula. The Condition created by clicking on the chart is easier to create and will run more efficiently than the Condition Formula.
A Condition Formula for a 4-Period Front Weighted Moving Average crossing up through its own 8-Period Front Weighted Moving Average could be written as:
112 * C + 56 * C1 + 11 * C2 > 24 * C3 + 50 * C4 + 40 * C5 + 30 * C6 + 20 * C7 + 10 * C8 + 4 * C9 + C10 AND 112 * C1 + 56 * C2 + 11 * C3 <= 24 * C4 + 50 * C5 + 40 * C6 + 30 * C7 + 20 * C8 + 10 * C9 + 4 * C10 + C11
A Condition Formula for a 4-Period Front Weighted Moving Average crossing down through its own 8-Period Front Weighted Moving Average could be written as:
112 * C + 56 * C1 + 11 * C2 < 24 * C3 + 50 * C4 + 40 * C5 + 30 * C6 + 20 * C7 + 10 * C8 + 4 * C9 + C10 AND 112 * C1 + 56 * C2 + 11 * C3 >= 24 * C4 + 50 * C5 + 40 * C6 + 30 * C7 + 20 * C8 + 10 * C9 + 4 * C10 + C11
A Condition Formula for a 4-Period Front Weighted Moving Average crossing through its own 8-Period Front Weighted Moving Average in either direction could be written as:
SGN(112 * C + 56 * C1 + 11 * C2 - 24 * C3 - 50 * C4 - 40 * C5 - 30 * C6 - 20 * C7 - 10 * C8 - 4 * C9 - C10) <> SGN(112 * C1 + 56 * C2 + 11 * C3 - 24 * C4 - 50 * C5 - 40 * C6 - 30 * C7 - 20 * C8 - 10 * C9 + 4 * C10 - C11)
That said, neither the TC2000 version 7 nor TC2000 version 12 has any built in backtesting features. In StockFinder, backtesting is provided using BackScanner.
It is possible to visually backtest the technical (but not fundamental) portions of a scan using TC2000 however. You could just use the current version of the formula as a Custom PCF % True Indicator in TC2000 version 12 (or as a Custom Perecent True Indicator in T2000 version 7) and scroll back to the appropriate date to see if there was a spike using Pointer Mode (select the period key (.) on your keyboard to bring up Pointer Mode, selecting it again twice will disable Pointer Mode):
Visually Backtesting Specific Symbols
Clipping your chart back to a previous date
It is also possible to write Personal Criteria Formulas based on past dates (again, this is only for technicals). You may wist to review the following section of the Online Help Files:
Days Ago parameter
There are two distinct ways to use historical data with Personal Criteria Formulas.
Any criteria can be used to scan X number of days back by adding '.XX' where XX is equal to the number of market days past to calculate for. An example of this is (AVGC21.21), which is a 21 day moving average 21 of close, 21 days ago. This use of historical data always refers to the market day XX number of days ago (in this case, 21). If you wish to use a specific date’s data, use the option detailed below.
The other method of using historical data is by specifying a precise date in history to use. For example, (AVGC21.'11/13/08') will provide a 21 day moving average of close for November 13, 2008 (the period should be used in cases where the first method requires a period and not used when the first method does not use a period). Always confirm that the date you wish to use using this parameter was a market day.