Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

TDI Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
diceman
Posted : Wednesday, June 22, 2011 10:42:47 AM
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
Bruce_L
Posted : Wednesday, June 22, 2011 11:16:59 AM


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
diceman
Posted : Thursday, June 23, 2011 8:54:12 AM
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


 

Bruce_L
Posted : Thursday, June 23, 2011 10:06:24 AM


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
diceman
Posted : Thursday, June 23, 2011 10:30:51 AM
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

Bruce_L
Posted : Thursday, June 23, 2011 10:34:39 AM


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
Bruce_L
Posted : Thursday, June 23, 2011 10:49:03 AM


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
diceman
Posted : Friday, July 14, 2017 12:46:39 PM
Registered User
Joined: 1/28/2005
Posts: 6,049

Bruce can you put this into the new language.

 

 

Thanks

 

Bruce_L
Posted : Friday, July 14, 2017 1:08:56 PM


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
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.