Page 11
Trading the Trend 2 Trading the Trend (TTT) -- by Andrew Abraham, TASC Magazine 9/1998, was about one form of stoploss exit: subtract some manipulation of the true range from the highest high (or add it to the lowest low) and exit when the close crosses that. (Members of Chuck LeBeau's Traders Club will recognise the "Chandelier Exit".) THE CHANDELIER EXIT: The exit stop is placed at a multiple of average true ranges from the highest high or highest close since the entry of the trade. As the highs get higher the stop moves up but it never moves downward. In MS 6.5 as a variable or custom indicator : DaysinTrade:= Barssince(previous composite entry criteria = 1) THE YO YO EXIT: This exit is very similar to the Chandelier Exit except that the ATR stop is always pegged to the most recent close instead of the highest high. Since the closes move higher and lower, the stop also moves up and down (hence the Yo Yo name). Name: Trading the Trend Pds:=21; Mult:=3; TruRan:=Mov(ATR(1),Pds,W)*Mult; HiLimit:=HHV(H,Pds)-TruRan; LoLimit:=LLV(L,Pds)+TruRan; If(C>HiLimit,HiLimit,LoLimit) 1. After closing the Indicator Builder click on the Expert Advisor (the guy in the bowler/derby hat). 2. Click on New, then the Name tab, type in Trading the Trend. 3. Click on the Highlights tab, select the first line so that it is highlighted, click Edit, type in the name Uptrend, select Colour Blue, select Condition, type in C>FmlVar("Trading the Trend","HiLimit"), and click OK, 4. Still on the Highlights tab, select the second line, click Edit, type in the name Downtrend, select Color Red, select Condition, type in C<=FmlVar("Trading the Trend","HiLimit"), click OK, and then click OK again. 5. If you have a chart open that you want to use this on, click Attach, otherwise click Close. In the latter case, when you open a chart and plot the trendline, click on the Expert Advisor, select Trading the Trend, and click on Attach. I've given the Expert steps in detail for any who may not be familiar with its use. To experiment with variations in the lookback periods and the multiplier you can do so in either the Indicator Builder, or right-click the indicator on the chart, select Properties, then the Formula tab, and make the changes (e.g. try a lookback period of 10, and a multiplier of 2.5). As implemented above, the Expert should change accordingly. This shows the trade-offs that have to be made between near and distant stops. This is too rudimentary to be traded as a system - the whipsaws would chop you to pieces - but the exits should help to limit drawdowns. A very similar stoploss is given in Chande & Kroll "The New Technical Trader", pp.167 - 169, "Volatility-Based Trailing Stops". My preference is to plot both the high and the low exit lines in contrasting colours, dispensing with the switch between them, and dispensing with the Expert. If anyone wants help with the code, just say so. Assuming you entered everything exactly in both the Indicator Builder and the Expert Advisor, one question comes to mind. Did you decide to adapt the formula to MS v.6.5 and use an Input function for Pds and Mult? It seems like a logical thing to do, and in fact I coded it that way at first. The problem is that the Expert Advisor always reverts to the default value (the System Tester does the same thing). Thus if you used something like: Pds:=Input("Lookback Periods?",1,1000,20) and then when you applied it you changed the periods to 15, the Expert Advisor will still read 20. I hard-coded the Pds and Mult parameters for that reason. From Harvey Pearce hhp@home.com Trading the Trend 1 TTT--TREND TRAILING Indicator -- Andrew Abraham Could have been called: -STOP LOSS Indicator -SUPPORT & RESISTANCE Indicator -DYNAMIC SUPPORT & RESISTANCE Indicator -BUY/SELL TRIGGER Indicator -INVESTORS DREAM Indicator -TRADING Indicator fml("VOLAInd"): Mov(ATR(21),1,W)*3; If(C>Ref(C,-21) AND C>fml("VOLAInd"), HHV(H,21)-Ref(fml("VOLAInd"),-1), Ref(fml("VOLAInd"),-1)+LLV(L,21)) .or. VOLAInd :=Mov(ATR(21),1,W)*3; If(C>Ref(C,-21) AND C>VOLAInd, HHV(H,21)-Ref(VOLAInd,-1), Ref(VOLAInd,-1)+LLV(L,21)) {CHANGE BAR COLORS: double click on the price plot in the chart, from the Color/Style page click the UP drop-list and choose darkblue for upwards, and red for downward price changes} From Ian Burgoyne iburgy@one.net.au
Bollinger Band Width
Bollinger Band Histogram
Karnish
System Test Examples
Bollinger Optimised Synergy
System
Starc Band
Money Flow Index A fast method to clean out unwanted stocks from Metastock and also save them for future viewing. On your hard drive, create a series of folders and sub folders like your present Metastock data system. In my case OLD_META_DATA/ALL01/A01,B01,C01 etc to Z01. (Be sure no more than 450 stocks go in each folder when you do copy/deletions) Open METASTOCK/Tools/DOWNLOADER and once in DOWNLOADER open Tools/Copy . Browse to the folder you wish to make deletions from. In the "Copy Securities" window make sure you can read the Last Date column with the Name column showing. If not,do not use the scroll bar but place the cursor in the Name box at its RH end almost in the Symbol box and when your cursor turns into a cross hold down the LH button on the mouse and drag it left thereby narrowing the Name column till the Last Date column is visible.( This is also a good tip when printing out Metastock reports that do not fit on the width of an A4 page, just reduce the width of a column or eliminate it completely if it is not wanted on the print out.) Hold down the Control key and highlight each Name you wish to delete. I go on the Last Date column to find useless stocks. If you use the scroll bar to go down the list be sure not to let go of the control key as you will lose all your previous selections. When finished highlighting let go of control key and press copy. Browse to the new folder you created, tick the "Delete Source Security" box and press OK. Old securities gone out of current data base and saved for future reference. You can do hundreds in a matter of minutes. If you want to ever see the old securities just alter the lead folders names in explorer. From Basil Holloway Bollinger Bands 2 I am sure Steve has done something better, but here is a simple (MetaStock) formula allowing you to draw Bollinger Bands as an oscillator: 100*(C-Mov(C,20,S)+2*Stdev(C,20))/(4*Stdev(C,20)) Alberto Torchio Torino, Italy Bull Fear/ Bear Fear with DX System enter long: n :=opt2{Time periods}; BullFear := (HHV(HIGH,n) - LLV(HIGH,n))/2 + LLV(HIGH,n); Cross(CLOSE,bullfear) AND DX(10) > opt1 close long: n :=opt2{Time periods}; BearFear := (HHV(LOW,n) - LLV(LOW,n))/2 + LLV(LOW,n); CLOSE < bearfear {Mike Arnoldi} Bull Fear/ Bear Fear The system is a trend follower that appears to get you in at the early in a trend. If the trend breaks down for any reason, the system seems to take you out with relatively little pain, and there is a relatively high percentage of losing trades (usually around 50%). Therefore, the system seems to perform best on issues that are prone to make prolonged moves. The trick is to find those issues. I do admit that the system is not perfect; for instance, it is my belief that the exit could be improved on winners to preserve more profit. However, I've been unable to develop an alternative exit that improves the system return. I've been trading this system myself for about a year and have had good results. Even in the April-September period when everything seemed to stall and move sideways, I was, at least able to hold my own and maintain my capital until the October break-always started to occur. For awhile, until I got bored with it, I phantom traded this system in the Yahoo Investment Challenge. I typically made about 20% a month using the system in that venue. Buy n :=opt2{Time periods}; BullFear := (HHV(HIGH,n) - LLV(HIGH,n))/2 + LLV(HIGH,n); Cross(CLOSE,bullfear) AND DX(10) > opt1 Sell n :=opt2{Time periods}; BearFear := (HHV(LOW,n) - LLV(LOW,n))/2 + LLV(LOW,n); CLOSE < bearfear Optimize the time periods from 10 to 50 in increments of 1 while testing the DX from 5 to 30 in increments of 5 (you can do it in increments of 1 but it takes longer). Once the Optimal time period is determined in this manner, then retest with the determined optimal time period and the DX in increments of 1. Note that this system is intended to be a stop and reverse system and you can use it to go short as well if you'd like to. Jeff 5 Day High {"Today must make a five-day high and today the close must be below the open."} {Place the following in the MetaStock Explorer filter section.} HIGH > Ref(HHV(HIGH,4),-1) AND CLOSE < OPEN {or you can write it this way too ...} HIGH > Ref(HIGH,-4) AND HIGH > Ref(HIGH,-3) AND HIGH > Ref(HIGH,-2) AND HIGH > Ref(HIGH,-1) AND CLOSE < OPEN {from bdog} Stoch RSI Although I keep the best of the bunch as a "super secret" for friends, relatives, and clients ... here is a smattering of formulae that might be useful. StoRSI's perform very differently when you plug in various numbers. Experiment and determine which are most suitable for your style and markets. Substitute numbers, apply moving averages, get creative. These are just a few: ((RSI(21)-LLV(RSI(21),8))/((HHV(RSI(21),13))-LLV(RSI(21),13))) ((RSI(21)-LLV(RSI(21),21))/((HHV(RSI(21),21))-LLV(RSI(21),21))) ((RSI(14)-LLV(RSI(14),14))/((HHV(RSI(14),14))-LLV(RSI(14),14))) Mov((RSI(21)-LLV(RSI(21),13))/(HHV(RSI(21),8)-(LLV(RSI(21)+.00001,13))),8,E) *100 Mov((RSI(5)-LLV(RSI(5),5))/(HHV(RSI(5),5)- (LLV(RSI(5),5))),3,E)*100 Mov((RSI(13)-LLV(RSI(13),13))/(HHV(RSI(13),13)- (LLV(RSI(13),13))),3,E)*100 from Steve Karnish Cedar Creek Trading ADX Raw {MetaStock code written by Equis and published in the Oct99 TASC} Periods:= Input("Enter time periods",1,100,14); PlusDM:= If(HIGH>Ref(HIGH,-1) AND LOW>=Ref(LOW,-1), HIGH-Ref(HIGH,-1), If(HIGH>Ref(HIGH,-1) AND LOW<Ref(LOW,-1) AND HIGH-Ref(HIGH,-1)>Ref(LOW,-1)-LOW, HIGH-Ref(HIGH,-1), 0)); DIPlus:= 100 * Wilders(PlusDM,Periods) / ATR(Periods); MinusDM:= If(LOW<Ref(LOW,-1) AND HIGH<=Ref(HIGH,-1), Ref(LOW,-1)-LOW, If(HIGH>Ref(HIGH,-1) AND LOW<Ref(LOW,-1) AND HIGH-Ref(HIGH,-1)<Ref(LOW,-1)-LOW, Ref(LOW,-1)-LOW, 0)); DIMinus:= 100 * Wilders(MinusDM,Periods) / ATR(Periods); DIDif:= Abs(DIPlus - DIMinus); DISum:= DIPlus + DIMinus; ADXRaw:= 100 * Wilders(DIDif/DISum, Periods); ADXRaw |