Registered User Joined: 10/7/2004 Posts: 799 Location: Duluth, GA
|
Most active traders agree that Trailing Stops are essential for good Risk Control. I'll discuss them here in the context of a Long position, but they are equally applicable and useful for Shorts.
After you have entered the trade, and have an Initial Stop set, Trailing Stop (TS) logic is used to progressively move the stop up as the prices move up since the day of entry. There are two "rules" that most every TS system uses: 1) NEVER lower your Stop 2) Ratchet the Stop up based on the highest price since the day of entry
There are many ways to calculate and apply TS's within those two rules. The simplest is to use a fixed "delta" equal to the Entry - InitialStop price, and simply subtract it from the highest High since Entry day. More sophisticated methods will dynamically adapt the delta based on volatility and/or time in the trade.
For our purposes, let's assume that the initial delta is based on the average daily range for the past ten days ... we will apply a 3x multiplier to that to leave plenty of room for wiggles. On the night before entry, the delta would therefore be: 3 * (AvgH10 - AvgL10) We are presuming that the delta is locked in once we take the trade, so if we want to "refer back" to that same value once we get to the fifth day of the trade (i.e. calculating it the night before), the formula would change to: 3 * (AvgH10.5 - AvgL10.5) This would give us the SAME result as the prior formula did, as long as we used it only on the night before the fifth day of the trade.
For that fifth day, we want the Trailing Stop to be the Max price since entry day, minus the delta. The formula is pretty simple: MaxH4 - 3 * (AvgH10.5 - AvgL10.5) Similarly, for the night before the eighth day of the trade, the Trailing Stop would be: MaxH7 - 3 * (AvgH10.8 - AvgL10.8) ... and so on for other days since Entry.
The problem of implementing this in TC is that there is no way to "automate" a connection to the Entry day's bar within a formula. You need to write the formula to reference a specific number of daysago, as in the example above.
However, if you're willing to do a little extra work, there is a cool way to work around that limitation, using multiple PCF's, Watchlist columns, and the Tracking Days in List sort criteria. As an example, let's assume that your typical hold time is rarely more than ten days, and that you use Daily bars to trade on. Here's how you would set up the Trailing Stops for that application:
1) Create ten PCF's to calculate the Trailing Stop the night before each of the nine days that follow the trade's inception, using the methods above - the first one would be for the night before Day2: H - 3 * (AvgH10.1 - AvgL10.1) Formulae for the night before days five and eight are shown above ... you can fill in the others on your own :~)
2) Devote one of your Watchlist Tabs to holding eleven columns. The first is for the Symbol, the second is the Sort field, and the rest have these nine PCF's assigned to them. Make the PCF titles have the day# as the first or second character, so you can squish the columns and still see at least that part of the title.
3) Dedicate one Watchlist to all your Long open positions. Whenever you enter a trade, on that SAME DAY, add the symbol to that list. TC will keep track automatically of the date the symbol was added. If you need to, you can add the symbol later, but you'll need to manually change the Watchlist Tracking Date.
4) Every night, bring up that WatchList with your Trailing Stops tab in view, and Sort it by the Number of Tracking Days in List. TC2005 ignores the weekends, so (usually) the number shown in the sort column will tell you which of the Trailing Stop columns should be applied to each symbol. Watch out for market holidays, though! TC counts them as if they were trading days ... you will have to mentally subtract one from the Tracking Days for the nine days following a Holiday (not a big deal).
That's it. You can if you want set up another tab for Shorts. Using similar assumptions as above, the formula for a Short Trailing Stop to be applied on the third day of the trade (i.e. calc'd the night before) would be: MinL2 + 3 * (AvgH10.3 - AvgL10.3)
Please note that this is a VERY SIMPLE example of a Trailing Stop formula. It's quite possible to write much more dynamic algorithms, such as Wells Wilder's Parabolic, or my own TanExits approach. The key is to dedicate a Watchlist column for each bar after the Entry, and sort by Tracking Days in List.
One final comment ... what if your typical hold time is FIFTY days, not ten? Is it necessary to set up FIFTY columns? No. In fact, I advise you to adjust your whole perspective for extended hold times, and use longer barlengths rather than daily bars. If you think of a 50-day hold time as a 10-week hold time, then all you need is the nine columns and nine PCF setup discussed above, but your PCF's need to be formulated for weekly bars instead of daily bars. This is a little trickier to do, but by no means beyond the ability of TC to handle. You might want to review the following threads for further discussion about this:
Selecting Bar Lengths and Zoom Factors TC Makes you a Master of the Barlength ... Not its Slave!
Jim Dean
P.S. currently there is no way to apply this kind of solution if you typically trade on bars shorter than daily.
|
|
Registered User Joined: 1/14/2005 Posts: 21
|
Hi Jim: I like your basic approach to the problem of creating trailing stops which you have outlined here. However, I believe that it still fails to address the problem of not allowing your stop price to encroach upon the previous bar's (whatever time frame you are trading) high/low trading range. That idea is also a feature of many popular exit systems. So rather than tinker with the indicator codes of every open position every day it appears to me that the simpler solution is to continue to keep your stops on a spread sheet of your choice where the necessary tools for these calculations are readily available and you can actually use the PSAR calculation if that is your exit of choice. Regards, j2d2
|
|
Registered User Joined: 10/7/2004 Posts: 799 Location: Duluth, GA
|
Each to his own. Exits are a very personal style thing. I hope that the method of using TC's features is helpful. It certainly would be possible to apply the rule you mentioned (stop outside prior day's range) in addition to other TS logic if you wanted to. PSAR can be programmed to work within this structure as well, with appropriate mapping. Not perfect or easy in TC, but possible.
Jim Dean
|
|
Registered User Joined: 1/14/2005 Posts: 21
|
Hi Jim: Yes I agree with your thought of "to each his own". My main point was not to be critical but to offer the suggestion that while TeleChart is a great tool when used as it was designed, I don't believe the original intent was to have it do everything anyone could dream of doing in the way of code emulation. And in it's present incarnation I believe that there are some who would be better served by sticking with their spreadsheet software for some calculations which are more easily done in that manner. When and if the 'if/else' capability is added at some future date then I will be pleased to make use of that new feature. Regards, j2d2
|
|
Registered User Joined: 12/3/2004 Posts: 8
|
Hello Jim, Could you explain more on the "PSAR can be programmed to work within the ..." ? I have not been able to program it within TC framework. Thanks
|
|
Registered User Joined: 10/7/2004 Posts: 799 Location: Duluth, GA
|
Hi, Cdao:
First, please carefully read the initial post of this thread, and please set it up in your TC, to check if you LIKE the way it is used (re tracking days, etc). If that interface is not acceptable to you, then the PSAR solution would also be unacceptable.
I hope you understand that I don't want to go to a *bunch* of devel work on PSAR solution which requires that format, if no one finds it convenient to work with.
More direct answer to your question: the PSAR logic has a "rule" at which the position reverses and the acceleration factors start incrementing all over again ... that is the aspect that PCF's can't handle. The solution would be to have a PCF which finds the reversal points, then take all the symbols that "hit" on that day, and put them in a WL. Then use multiple columns of the WL tab for ensuing days, and the Sort based on Tracking days in list, to implement the Parabolic calcs.
Jim Dean
|
|
Registered User Joined: 12/3/2004 Posts: 8
|
Hello Jim,
Thanks for the explanation of PSAR logic. But for now, I continue to use the Technic Filter Plus s/w to compliment the TC program.
|
|
Registered User Joined: 10/7/2004 Posts: 799 Location: Duluth, GA
|
Hmm. Never heard of that product. But I'm glad I did not spend an hour or so creating and doc'ing a solution for somebody who already had one. :~)
|
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
QUOTE (Tanstaafl) The problem of implementing this in TC is that there is no way to "automate" a connection to the Entry day's bar within a formula. You need to write the formula to reference a specific number of daysago, as in the example above.
Jim D.,
That is a very strong statement. It says that there is something sensible that you can do with the data sequences O, H, L, C, V that cannot be done with the PCF language and that is very doubtful. You appear to have overlooked the use of, for example, C'mm/dd/yy'.
One could add variables, conditionals, loops, etc. to the PCF language to make it easier, but it would not increase its capability.
Thanks, Jim Murphy
PS. Mikey, aka Bruce_L, can do it and so can you and maybe even I can.
|
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
QUOTE (j2d2000wor) When and if the 'if/else' capability is added at some future date then I will be pleased to make use of that new feature.
j2d2,
Please notice that:
If P then x = a Else x = b End if
returns the same value as the PCF:
(1+P)*b-P*a
Thus, essentially, 'if/else' is already available. If you perfer to use only documented functions, you can accomplish the same thing using the signum function SGN.
Thanks, Jim Murphy
|
|
Registered User Joined: 10/7/2004 Posts: 799 Location: Duluth, GA
|
Jim M:
Yes, I made a strong statement or two ... and a LOT of thought and time have gone into it. Let me share a bit of my reasoning. I did certainly consider the dit-date thing at the outset, long ago, but rejected it because it would be TOTALLY IMPRACTICAL to use for real trading.
You are correct in pointing out that PCF syntax allows for an explicit definition of a specific date. Putting aside for the moment that there are currently some bugs with that syntactical form in certain cases, there is a bigger issue, here.
If you consider my original post on this thread, I was describing a GENERAL METHOD that I feel is PRACTICAL for DAILY USE to help TRADERS implement dynamic Trailing Stops for a full portfolio.
It was not intended to be a general theoretical comment on the potentialities and limitations of the PCF language. I understand, as you do, that with sufficient string-length, patience, and algebra, the PCF syntax is quite versatile ... BUT, the implementation of that versatility is often so onerous that to seriously suggest its application for some uses is absurd.
The presumption in my posting (and for normal trading) is that the entry date varies for EACH of the symbols in the portfolio at any given time, AND that the symbol list itself varies over time as well.
Further, the assumption is that the Trailing Stop system rules might be pretty robust, at least using ratcheting vs the extreme price since entry, and possibly doing other things like gradually tighening the volatility-multiple &/or the volatility-lookback window as the trade progresses, etc. These kinds of things are a part of Wilder's PSAR logic, btw.
For a PRACTICAL implementation of this, one PCF per bar since the entry of the trade is needed, arranged in individual WL tab columns, SINCE the PCF formula necessarily differs for each day since entry. That is, a ten-bar typical hold time requires ten PCF's and ten WL tab columns.
The huge ADVANTAGE of doing it this way is that you ONLY write 10 PCF's, one time, and you RE-USE those SAME 10 PCF's for all symbols that you might have in your portfolio at any time. No need to continually RE-write them with different "dit-dates" being substituted in.
The alternative (which you seem to be proposing) is that a UNIQUE set of PCF's (or one really huge composite PCF) be custom-written for EVERY INDIVIDUAL SYMBOL, since that symbol has its own entry dates. Or, possibly, for EVERY INDIVIDUAL DATE (using WL tracking to help map comparable entry days to each equation).
TC is not set up to conveniently apply individual PCF's to individual symbols, unless you dedicate a WL to each symbol (absurd) ... there are no "replaceable param's" in the PCF language that are symbol-specific - THAT is the key limitation here .. no two ways about it. It is unreasonable to argue that PCF's can do *anything* ... for example, they cannot process fundamental data, or compare symbols to market indices, etc. There ARE limitations. And a calculation which requires the entry date and price on a symbol by symbol basis is one of them - at least for all PRACTICAL purposes.
So ... I think you need to reconsider your comments above that promote the use of the dit-format for this application. I suggest you try actually creating a trailing stop system, that works day in and day out on a variable list of symbols, which ratchets off the max high since entry and gradually compresses the volatility delta multiplier from say 3x to 1.5x over ten days. Now try USING that for real trading management on a regular basis.
If you can do so, in a way that you feel is USEFUL, which is also SIMPLER to apply than the method I described above, then please post the details of the steps involved, so we can consider them from a pragmatic rather than theoretical point of view.
I have spent countless hours on this TS area to refine its application for use in TC, and I have used the method I describe on a regular basis .. as do some other folks who have implemented it with my assistance. It works well. And, AFAIK, it is the *only* way to practically meet the defined needs within the scope of TC's limitations, and the TIME limitations of most traders.
Of course, Excel or a standalone VB program can make this much easier and faster and so forth, but that is beyond the scope of this forum, or of my original posting. I was trying to demonstrate how TC, on its own, could be used to practically implment robust, dynamic trailing-stop contol of a trader's portfolio on a daily basis.
Jim Dean
|
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
Jim D.,
I was in no way criticizing your work. Please accept my apologies for not being clear. I think your post is excellent with the single exception:
"... there is no way to "automate" a connection to the Entry day's bar within a formula."
Now you seem to be of the opinion that the resulting PCF would only be impractical. I certainly would not use such a thing, I would do it exactly as you have. The PCF can be written as a linear combination of the 10 stop pcfs but the coefficient pcfs have to be changed with each new addition to the WatchList. Each of the 10 stop PCFs need be written only once. With this constraint, you might have to take some risk of it giving erroneous results. I am not proposing that one should use such a PCF, only that it can be done.
QUOTE (Tanstaafl) It is unreasonable to argue that PCF's can do *anything* ... for example, they cannot process fundamental data, or compare symbols to market indices, etc. There ARE limitations.
Please accept my apologies again. I stated:
"It says that there is something sensible that you can do with the data sequences O, H, L, C, V that cannot be done with the PCF language and that is very doubtful. One could add variables, conditionals, loops, etc. to the PCF language to make it easier, but it would not increase its capability."
I should have made it clear that the sequences O, H, L, C, V were only for the symbol for which the PCF is being evaluated and not some other index, for example. Also, PCFs cannot handle any data not derivable from those sequences, for example, fundamental data.
Congradulations on your excellent post.
Sorry. Jim Murphy
|
|
Registered User Joined: 10/7/2004 Posts: 799 Location: Duluth, GA
|
Thanks for the clarification, Jim. No apologies were necessary! Your contributions to the TC community have been stellar, over many years. Much of what I do today is based on your mathematical insights.
This trailing-stop capability is, to my knowledge, little understood in the TC community. My posting was an attempt to interest folks (both users and W staff) in the possibilities inherent in the combo of WL tab columns, dedicated days-ago PCF's, and sort by WL tracking date.
Also, I think that a good set of Trailing Stops (and Profit Grabs) are truly crucial to trading success ... it's a "soapbox" issue for me. IMHO, a great entry can be ruined by a poor stop system ... but a poor entry can be rescued by a good stop system. Folks seem to spend 99% of their energy on entry ID, and little focus or thot on optimizing their stops.
Ah, well. Hopefully this will help out some enterprising TC users. It would help if W would fix the Tracking Days count to skip over market holidays (as it does over weekends). That should be easy to implement.
Jim Dean
|
|
Registered User Joined: 6/24/2005 Posts: 38
|
Jim D,
Any chance you would be willing to share your TanExits approach?
Mike
|
|
Registered User Joined: 10/7/2004 Posts: 799 Location: Duluth, GA
|
You will need to address this via the telechart Auxilliary group on yahoo
|
|
Registered User Joined: 10/7/2004 Posts: 799 Location: Duluth, GA
|
Or, get a copy of tc-companion
|
|
Registered User Joined: 6/24/2005 Posts: 38
|
Tanks Jim. I am a member over there, so I'll pop over in the next day or so.
|
|
Guest-1 |