Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Gold Customer
Joined: 5/13/2010 Posts: 146
|
Bruce,
I am rying to covert a Trend Strength Indicator tha I found on the web to a PCF,but I am hviong a problem convertin i to a PCF.
Here is the formula: TSI = Average( ( Average( Ratio , 10) ), 100 ) • This is the average of the Ratio over the past 10 days, followed by averaging that resulting array for 100 days -- an average of an average, if you will. • Ratio = Absolute Value( Close - ( Close Ten Days Ago ) ) / ATR(10) • ATR(10) = Average of the True Range over the last 10 days
I got Rato,10 OK as follows but can't get the rest due to syntax errors:
ABS(C-(C10))/ABS(C-(C10))/ ((AVGH10 - AVGL10) /((AVGH10 - AVGL10) / 2 + (ABS(H - C1) + ABS(C1 - L) + ABS(H1 - C2) + ABS(C2 - L1) + ABS(H2 - C3) + ABS(C3 - L2) + ABS(H3 - C4) + ABS(C4 - L3) + ABS(H4 - C5) + ABS(C5 - L4) + ABS(H5 - C6) + ABS(C6 - L5) + ABS(H6 - C7) + ABS(C7 - L6) + ABS(H7 - C8) + ABS(C8 - L7) + ABS(H8 - C9) + ABS(C9 - L8) + ABS(H9 - C10) + ABS(C10 - L9)) / 20))
Ref: http://www.nonrandomwalk.com/Blog/tsi.html
Please help.
Thanks,
vince
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The Trend Strength Index can be written as follows for TC2000 v17.
AVG(AVG((C - C10) / ATR10, 10), 100)
But any formula for earlier versions of TC2000 would be too long and slow to be practical. About the best you can do is create the formula for the Ratio as a Custom PCF Indicator with the smoothing set to 100 and then add a 10 period moving average to that. The moving average would be the Trend Strength Index.
ABS(C - C10) / ((AVGH10 - AVGL10) / 2 + (ABS(H - C1) + ABS(C1 - L) + ABS(H1 - C2) + ABS(C2 - L1) + ABS(H2 - C3) + ABS(C3 - L2) + ABS(H3 - C4) + ABS(C4 - L3) + ABS(H4 - C5) + ABS(C5 - L4) + ABS(H5 - C6) + ABS(C6 - L5) + ABS(H6 - C7) + ABS(C7 - L6) + ABS(H7 - C8) + ABS(C8 - L7) + ABS(H8 - C9) + ABS(C9 - L8) + ABS(H9 - C10) + ABS(C10 - L9)) / 20)
That is just this short snippet of the first formula.
ABS(C - C10) / ATR10
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/28/2005 Posts: 6,049
|
Bruce
the link provided contains other trading systems.
Can you supply the PCFs for these:
Historical Volitility(100)<=1.0
PCF#2:
Target Exit: (0.5 * ATR(20)) above open
|
PCF#3:
Stop: (1.5 * ATR(20)) below open
|
Please note that because this system trades at the open of the day only, the previous day's moving averages, trend lines, ATRs, etc. were used. However, the ATR oscillator, which is similar to a Keltner Channel (explained here), does use the open price. The oscillator measures the distance between the current price and a moving average (previous day) normalized by an average true range ( ATR ). The formula for the ATR oscillator is:
-
ATR Oscillator at Open (10,20) = ( Open - SMA(10) ) / ATR(20)
-
...where the SMA and ATR are the previous day's values.
We use only the close of the day in our SMA calculation.
PCF#4:
ATR Oscillator at Open(20,10) <= -1.0
|
PCF#5:
Regression Trend Line Open(20) > 1.05
|
PCF#6:
Regression Trend Line Open(50) > 1.05
|
The regression trend line is the slope of the regression line fit to the price data (closing prices). A value of 1.0 represents a flat line. A value of 1.05 indicates a line that grew 5% over the time frame. A value of .95 would represent a line that lost 5% in value over the time frame. The threshold in the system ensures that our stock has a general upward trend over the time frames.
Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
All of the following formulas are for TC2000 v17.
Let me start then by providing the Trend Strength Index for 1 bar ago.
AVG(AVG((C1 - C11) / ATR10.1, 10), 100)
PCF#1:
1600 * ABS((SUM(LOG(C1 / C2) ^ 2, 100) - LOG(C1 / C101) ^ 2 / 100) / 100) ^ .5 <= 1
Although I'm wondering if they don't convert it into a percentage and it needs to be <= 100 instead.
PCF#2:
O + ATR20.1 / 2
PCF#3:
O - 1.5 * ATR20.1
PCF#4:
(O - AVGC10.1) / ATR20.1 <= -1
PCF#5:
123 * FAVGC20.1 > 124 * AVGC20.1
PCF#6:
123 * FAVGC50.1 > 124 * AVGC50.1
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/28/2005 Posts: 6,049
|
PCF#4:
(O - C1) / ATR20.1 <= -1
This should be:
(O - AVGC10.1) / ATR20.1 <= -1
PCF#5:
123 * FAVGC20.1 > 124 * AVGC20.1
PCF#6:
123 * FAVGC50.1 > 124 * AVGC50.1
How do you determine the "123" and "124"?
I assume they check for the 1.05 slope?
Other slopes could be checked by changing those variables?
Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
That was a simplification of the following. You probably don't really need to simplify it. Any efficiency gained is probably fairly small.
3 * FAVGCx.z - 2 * AVGCx.z > 1.05 * (4 * AVGCx.z - 3 * FAVGCx.z)
Where x is the period and z is the offset.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |