Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 1/28/2005 Posts: 6,049
|
I would like a 10 period Trend Detection Index (TDI)
(for some reason explorer wont let me paste the formula here but Im sure you can find it on the web)
Thanks
diceman
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I would think it would be something like the following (but don't have anything against which to make a comparison):
ABS(10 * (AVGC10 - AVGC10.10)) - ABS(C10 - C20) - ABS(C11 - C21) - ABS(C12 - C22) - ABS(C13 - C23) - ABS(C14 - C24) - ABS(C15 - C25) - ABS(C16 - C26) - ABS(C17 - C27) - ABS(C18 - C28) - ABS(C19 - C29)
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: 1/28/2005 Posts: 6,049
|
The equation is correct for TDI. (it matches tradestation)
Unfortunately this is more confusing than I thought.
There is Boolean logic that determines buy and sell signals
If TDI.1=TDI yesterday,
MomSum.1= MomSum yesterday,
MktPos.1= MktPos yesterday (If we were on a Buy or Sell signal yesterday)
The logic works like this:
TDI.1<=0 then MktPos=MktPos.1
TDI.1>0 and MomSum.1>0 then MktPos=Buy
TDI.1>0 and MomSum.1<=0 then MktPos=Sell
(it only checks MomSum.1 if TDI.1>0 otherwise MktPos is yesterdays value)
I don’t think theres a way to find TDI.1<=0 then MktPos=MktPos.1 that were sells?
(condition could be underway for many bars)
Seems like the best I can do is demand the day before yesterday was a sell and yesterday was a buy.
Which would be:
TDI.2>0 and MomSum.2<=0
And
TDI.1>0 and MomSum.1>0
This is what I need.
Hope that makes sense.
Thanks
diceman
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It could be simplified a bit if you want, but if we actually calculate TDI and MomSum, I think something similar to the following should work:
ABS(10 * (AVGC10.2 - AVGC10.12)) - ABS(C12 - C22) - ABS(C13 - C23) - ABS(C14 - C24) - ABS(C15 - C25) - ABS(C16 - C26) - ABS(C17 - C27) - ABS(C18 - C28) - ABS(C19 - C29) - ABS(C20 - C30) - ABS(C21 - C31) > 0 AND 10 * (AVGC10.2 - AVGC10.12) <= 0 AND ABS(10 * (AVGC10.1 - AVGC10.11)) - ABS(C11 - C21) - ABS(C12 - C22) - ABS(C13 - C23) - ABS(C14 - C24) - ABS(C15 - C25) - ABS(C16 - C26) - ABS(C17 - C27) - ABS(C18 - C28) - ABS(C19 - C29) - ABS(C20 - C30) > 0 AND 10 * (AVGC10.1 - AVGC10.11) > 0
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/28/2005 Posts: 6,049
|
Well out of 7188 items in "All Stocks" I get no hits.
I dont know if its the market mode, or my thinking is off, or the formula is incorrect.
Just looking quickly, shouldnt this "(AVGC10.2-AVGC10.13)" be "(AVGC10.2-AVGC10.12)" ?
(doubt that would be enough not to make it not trigger)
Thanks
diceman
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Yes, both instances of AVGC10.13 should be AVGC10.12. That's what happens when I manually create formulas instead of using Excel. Corrected above. I'm not sure what else could be wrong.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
OK, try plotting both of the following as Custom PCF % True Indicators:
ABS(10 * (AVGC10.2 - AVGC10.12)) - ABS(C12 - C22) - ABS(C13 - C23) - ABS(C14 - C24) - ABS(C15 - C25) - ABS(C16 - C26) - ABS(C17 - C27) - ABS(C18 - C28) - ABS(C19 - C29) - ABS(C20 - C30) - ABS(C21 - C31) > 0 AND 10 * (AVGC10.2 - AVGC10.12) <= 0
ABS(10 * (AVGC10.1 - AVGC10.11)) - ABS(C11 - C21) - ABS(C12 - C22) - ABS(C13 - C23) - ABS(C14 - C24) - ABS(C15 - C25) - ABS(C16 - C26) - ABS(C17 - C27) - ABS(C18 - C28) - ABS(C19 - C29) - ABS(C20 - C30) > 0 AND 10 * (AVGC10.1 - AVGC10.11) > 0
I think you will find there is normally gaps between them. The fact that the Buy remains a Buy and the Sell remains a Sell under most circumstances seems to be pretty important in determining the transition between Sell and Buy or Buy and Sell.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/28/2005 Posts: 6,049
|
Bruce can you put this into the new language.
Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following for the first formula.
ABS(AVGC10.2 - AVGC10.12) > AVG(ABS(C12 - C22), 10) AND AVGC10.2 <= AVGC10.12
And the following for the second formula.
ABS(AVGC10.1 - AVGC10.11) > AVG(ABS(C11 - C21), 10) AND AVGC10.1 > AVGC10.11
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |