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

John Bollinger describes BWI (Band Width Indicator) as the width of the bands divided by the average of the price:

4*(std(C,20))/mov(C,20,S)

I don't know if adding the moving average changes the usefulness of the prospecting; anyway, this is what Bollinger is suggesting.

I have written a MetaStock exploration to spot stocks whose BWI has reached extreme low readings. This shows when the BWI is at lower than its highest level for the last 250 days, divided by 3:

hhv(4*(std(C,20))/mov(C,20,S),250)/3

The stocks that pass this screening are usually in a non-trending mood, or rather in an
horizontal trend where the Bollinger Bands normally represent support and resistance levels. Otherwise, there are cases where the stock is just pausing before resuming a trend. In this second case the BWI doesn't remain under the trigger level for a long time.

A further remark is that when the stock enters a low-BWI period, it is often retesting a
previous support or resistance level.

Although I think BWI extreme lows are an interesting way to find low risk / low volatility stocks, they don't give any clue as of the direction of the following move.

from Alberto Torchio

 

Bollinger Band Histogram Karnish

Recently, the "group" was able to supply me with the formula for making a Histogram out of the "bands". I find this the most useful application of Bollinger's formula. The following is the picture I draw:

((C+2*Std(C,20) - Mov(C,20,S)) / (4*Std(C,20)))*4 - 2

Under "properties", I then drop in +2 and -2 (because I'm not bright enough to program them in permanently). I think this is a much better view of the bands. As the price moves up and down as a % of the band width, all the classic applications of other "oscillator type" indicators work well (divergence, support/resistance, and overbought/oversold conditions when the price exceeds the Standard Dev. of +/-2).

This is just one of ten indicators that I use ... but, for traders trying to understand Bollinger's "envelopes", I think this reconfiguration gives a simpler, cleaner view which allows the technician to analyse the underlying issue without the "squiggles".

from Steve Karnish
 

System Test Examples
from Glen Wallace

"Buy at the open plus half the average true range of the last ten days?"

HIGH >= OPEN + 0.5*Ref(ATR(10), -1)

"If these two moving averages cross today, buy on tomorrow's open."

MA1:= Mov(CLOSE, 10, SIMPLE);
MA2:= Mov(CLOSE, 20, SIMPLE);
Ref(Cross(MA1, MA2), -1)
(with System Testing Options | Testing tab | Entry Price set to "Open" and delay set to
zero)

"Exit five bars after entry."

EntryCondition:= {your trade entry conditions};
BarsSince(EntryCondition >= 5)

 

Bollinger Optimised Synergy System

BOSS -- Synergy with Bollinger by John Lowe (March 1998 issue of TAM, a Dutch
TA mag)

In this article John Bollinger gets mentioned as insisting on using a Price/Close
indicator in conjunction with a combined Price/Volume indicator. For example, Price
as a moving or exponential average, the Typical Price(High+Low+Close/3) or one of
the other on this theme of existing varieties. Bollinger strives for synergy, which has
to be confirmed by two of three indicators based on:

Closing-price, price and volume, the Bollinger Optimised Synergy System (BOSS):

1st criteria -- Bollinger Bands are best used in conjunction with Wilders' RSI(9 or 14),
an indicator based on closing price.

2nd criteria -- Price and volume, combined in the Chaikin Oscillator, are the other part
of the BOSS.

According to most analysts, the Chaikin Oscillator, a diverse
accumulation/distribution line, is a very good alternative to the OBV indicator.
Chaikin Oscillators' basics are that a healthy trend will be confirmed by a healthy,
positive volume-development in the trend-direction. The Chaikin Oscillator can be
substituted for with the Money Flow Index (MFI).

Chaikin Oscillator formula:

Mov(cum(((C-L)-(H-C)/(H-L))*V),3,E)-Mov(cum(((C-L)-(H-C)/(H-L))*V),10,E)

from Ton Maas


Bianchi Approach


enter long

When(Mov( Mid(C, opt1) ,opt1,E),>,Mov(Mid(C, opt1),opt2,E))AND When(Ref(Mov(Mid(C,opt1),opt1,E),-1), <= ,(Ref(Mov((Mid(C,opt1)),opt2,E),-1)))AND When(Mov(Abs((Mo(opt3))),opt4,E),>,Ref(Mov(Abs((Mo(opt3))),opt4,E),-1))


enter short

When(Mov( Mid(C, opt1) ,opt1,E),<,Mov(Mid(C, opt1),opt2,E))AND When(Ref(Mov(Mid(C,opt1),opt1,E),-1), >= ,(Ref(Mov((Mid(C,opt1)),opt2,E),-1)))AND When(Mov(Abs((Mo(opt3))),opt4,E),>,Ref(Mov(Abs((Mo(opt3))),opt4,E),-1))

OPT 1: 5 to 20 step 1
OPT 2:10 to 16 step1
OPT3:5 to 15 step 1
OPT4:20 to 29 step 1
but you are free to change any value of OPT!

 

Starc Band

STARC BAND Formula = (Mov(Typical(),5,S))

Starc Upper Band:
Fml( "STARC BAND" )+ (ATR(15)*1.33)

Starc Lower Band:
Fml( "STARC BAND" )-(ATR(15)*1.33)

Any five day moving average will work.

Contributed by J. Seed
 

Money Flow Index

The MFI (Money Flow Index) can be used in place of the OBV (On Balance Volume) and Chaikin Oscillator to confirm Bollinger Bands.

From Stocks & Commodities magazine, v. 12:8 (321-324): SIDEBAR: The Money Flow Index

"The money flow index (MFI) is a volume-weighted form of the relative strength index (RSI). Instead of using up closes versus down closes, the MFI compares today's average price to yesterday's average price and then weighs the average price by volume to calculate money flow (MF). The ratio of the summed positive and negative money flows are then normalized to be on a scale of zero to 100."

Here are the MetaStock formulas for the Money Flow Index:

Positive Money Flow:
sum ( if ( typ( ) ,> ,ref ( typ ( ) ,-1 ) ,V * typ ( ) ,0 ) , PERIODS)

Negative Money Flow:
sum ( if ( typ( ) ,< ,ref ( typ( ) ,-1) ,V * typ ( ) * -1 ,0 ) , PERIODS)

Money Flow Ratio:
fml ( "Positive Money Flow" ) / fml ( "Negative Money Flow" )

Money Flow Index:
100 - ( 100 / ( 1 + fml ( "Money Flow Ratio" ) ) )

NB:The time periods are controlled by PERIODS in the Positive & Negative Money Flow formulas.


Bollinger Band Confirmation

From: Ton Maas

According to most analysts, the Chaikin Oscillator, a diverse accumulation/distribution line, is a very good alternative to the OBV (On Balance Volume) indicator. Chaikin Oscillator basics are that a healthy trend will be confirmed by a healthy, positive volume development in the trend direction. The MFI (Money Flow Index) can also substitute for the Chaikin Oscillator.

Chaikin Oscillator formula:

Mov(cum(((C-L)-(H-C)/(H-L))*V),3,E)-Mov(cum(((C-L)-(H-C)/(H-L))*V),10,E)


Bollinger Band Width 2

From: Philip Schmitz

MetaStock v6 does not appear to provide an indicator which shows the width of Bollinger
Bands, so I have concocted a simple one to suit my own needs:

"Band Width" = BBandTop(C, 70, E , 2) - BBandBot(C, 70, E , 2)

As a next step, I would like to devise an indicator which tells me how the current value of
"Band Width" relates to the overall range of Band Widths for a specified period, or, since my interest is commodities, the life of the contract -- in other words all data loaded. Where, on a percentage basis, does it fall?


Karnish Bollinger Band Histogram Trading System

{EnterLong and Close Short}
BBHistogram:= (CLOSE + 2*Std(CLOSE,20) -
Mov(CLOSE,20,SIMPLE)) / (4*(Std(CLOSE,20)))
* 100;
Cross(0,BBHistogram)

{Enter Short and Close Long}
BBHistogram:= (CLOSE + 2*Std(CLOSE,20) -
Mov(CLOSE,20,SIMPLE)) / (4*(Std(CLOSE,20)))
* 100;
Cross(BBHistogram,100)


Here's a "freebie".
BB Histogram:
((C+2*Std(C,20)-Mov(C,20,S))/(4*(Std(C,20)))*100)

Sell the opening days after the BB Histogram penetrates 100 and buy when it penetrates zero. Add to positions when the BB Histo leaves "above 100" or "below zero" and then "repenetrates" the trigger levels.

I believe this approach has recorded 11 straight S&P winners, with 700+ points. "But Steve, this system must not be working any more because it is losing the last trade you put on". Right!

My only disclaimer is that I guarantee that I will sell software, charting services and anything else that I can think of to make a "buck" in 2000. In the meantime, suck all the free stuff from me you can copy. And most of all, please note, the biggest antagonists on the list provide absolutely "zero" when it comes to helping you trade. Seek the answers from "within" (with some shortcutting help from people that are willing to share).

Steve Karnish


CMA


"1) Sell the opening (long or short) X-number of days(?) after the indicator above moves from below 100 to
above 100. (Is this on a close-to-close basis?)"

Specifically, sell the opening the day after the BB Histo closes above 100.

"2) Buy or cover when the indicator goes from above 100 to below 100 or from above 0 to below 0 X-number
of days after that occurs."

Buy, when the BB Histo dips below zero (the following morning).

"a) how many days after the signal does one act;"

The following morning.

" b) Is this close-to-close or intra-day?"

close to close

"c) Is this to initiate or to go short or add to a position?"

Add to positions if the indicator "repenetrates" these levels ... otherwise, reverse when it triggers.


Steve Karnish
 

Cleaning out unwanted stocks from Metastock

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