I don't recall exactly how things are set up in TS4, but I believe it's the same as in TS6 (possibly with minor adjustments): There's a SWINGHIGHLO "show me" and a TRENDLINES AUTOMATIC indicator... If you have them, try applying the former to daily charts first... There are also some sample "signals" - the Trendlines Auto tests surprisingly well with simple stops, not that I'd trade it as such...
Do you have them?
I don't use either indicator, though I did learn some stuff from the code that I've applied to some custom indicators and signals.
If you're trying to plot the function as an indicator - which may or may not make sense - why don't you cut-and-paste the code here and maybe we can figure out what's wrong?