Trend Strength

How do you know when a trend has started? Ended? This forum is for discussions about trend indicators and signals.
Post Reply
damian
Roundtable Knight
Roundtable Knight
Posts: 815
Joined: Tue Apr 15, 2003 8:43 pm
Location: dusseldorf

Trend Strength

Post by damian »

Hi,

Been hard to find the time to visit in the last few days. Anyhow, a while ago I posted a rambling idea (look for the second post) on this thread:

viewtopic.php?t=168

Just now I was taking a quick mental break from work and thought up the following (definitions can be found in the above mentioned/linked post):

XYZ = (MA50-LLV)/(HHV-LLV)

Perhaps:
- expect an up trend to start weakening when XYZ forms a peak above 0.8
- expect a down trend to start weakening when XYZ forms a trough below 0.2

XYZ should swing between 1 and 0.

I might try something like: "if long and XYZ>0.85 then tighten trailing exit".

This XYZ thingy is probably not worth a pinch, but I hoped that it may spark just a general discussion on trend strength relative to perhaps:

- position size,
- open risk,
- acceptance/rejection of orders in other systems that you trade.
edward kim
Roundtable Knight
Roundtable Knight
Posts: 344
Joined: Sun Apr 20, 2003 2:42 pm
Location: Silicon Valley / San Jose, CA USA
Contact:

Post by edward kim »

Hi Damian,

Are any of your trend indicators related to ADX? I hope someone can post to explain the differences between the two.

Edward
Kiwi
Roundtable Knight
Roundtable Knight
Posts: 513
Joined: Wed Apr 16, 2003 1:18 am
Location: Nowhere near

Post by Kiwi »

I think you asked for an explanation of ADX / DMI /D+ / D-
Also I think that Damian is playing with an idea and expects a serious attack/suggestions for mods. Apologies if otherwise :cry:

Playing with ideas here really.



You can find a good explanation of this (and all the other indicators I tried) at:
http://www.equis.com/Education/TAAZ/?page=49

The short explanation is that you calculate the positive movement, D+, by dividing the average of the H-H(prev) for 14 days and dividing it by the
Average True Range for 14 days. You calculate the negative movement by using the Lows. So in both cases you measure how much it pokes beyond yesterday and then normalise it by dividing it by the average true range of those days.

The DMI is then just the difference between the D+ and D- divided by the sum of the D+ and D-. The ADX is the average of the DMI to smooth it.

If things just wander back and forth then the D+ and D- will tend to cancel each other out leading to a 0 ADX.

When there is a lot of positive movement and little negative movement compared with the ATR then the ADX starts to build. After 14 good up days it hits max for the slope of the trend. If the trend continued up then the ADX will stay approximately the same (hence rules like buy if ADX is over 25 coming off a low base). If you get a number of sideways days it drops off so in a trend when you hit consolidation it declines.


By way of contrast Damian's indicator is more like a MACD (which is just a short moving average - a long moving average). The MACD behaves a lot like the ADX in that when the trend starts the short MA moves faster than the long so the gap starts to expand. However unlike the ATR if the trend keeps going up at a constrant rate the MACD falls to zero as the two moving averages move to the same value. It doesnt need consolidation to drop off.

Damian is using a 1 day moving average for the short MA but hes used the lowest day for the past X days (unspecified). In his case the indicator is a little weird (sorry D !) because he uses not the close but the lowest value for X days. This means that when there was no trend MA-LLV would be 0 as there is not difference.

When it the trend up began the MA would start to move up:
If the LLV was on X less than 50 (say 10) you are like to find that after 10 days the LLV would move up faster than the MA and would XYZ would cross back under zero staying there until the trend weakened!!!

Thats what I mean by weird :D

The effect of (HHV-LLV) is to normalize the trend with respect to the range for X days. You could also normalise it wrt either the average for a period or wrt the average of the trendiness for a period. For Damian's conditions that it stay between 0 and 1 to be true then X needs to be greater than 50 days otherwise the LLV could leap ahead of the MA50 and the range would be less than the difference between MA50 and LLV.

So I'd suggest a modification in a form like

(Close-MA50) / (HHV(50+)-LLV(50+))

this measures how far the close gets away from the medium term MA and normalises it wrt to a longish term high/low channel. The trouble is that it doesnt have the characteristics that Damian was looking for wrt 0.8 and 0.2

Hmmm ... I'm not sure that this was very helpful. Comments Damien?
damian
Roundtable Knight
Roundtable Knight
Posts: 815
Joined: Tue Apr 15, 2003 8:43 pm
Location: dusseldorf

Post by damian »

hello kiwi, eck:

XYZ is certainly no where near as complicated as ADX... kiwi explained the diff quit well.

Kiwi mentions a 1 day MA. This is not correct and probably a result of my very un-specific posting. All look-backs for all MA's are the same, in this example I used 50 for the sake of needing a number.

If all look-backs used X then the MA would always sty inside LLV and HHV. [I just remembered that when I came up with this fellow years ago I actually called HHV HAV, meaning 'high average'].

To calculate HHV (using no meaningful look-backs, just numbers for the sake of demonstration):

take HH value for last 80 days (HH80)
take the HH for the last 40 days (HH40)
take HHV for the last 20 days (HH20).

next,

for each day, calculate: (HH80+HH40+HH20)/3

[Note that all the values summed here are todays values of different historical market levels. This is not a moving average].

Next, find the X day MA of the above average. You now have HHV.

Now do this using LL80, LL40, LL20 and you have LLV (still using MA of length X).

Now calc the simple MA of X days.

now that you have LLV, HHV and MA you can calc
XYZ = (MA50-LLV)/(HHV-LLV)

[In the original post as linked above, I used HH80[1] etc. That is, yesterdays HH80 value. This may not be needed, I only did this out of habit].

I hope this helped define the calculation a little better.

Thanks for the input and critique.

cheers
damian :D
Kiwi
Roundtable Knight
Roundtable Knight
Posts: 513
Joined: Wed Apr 16, 2003 1:18 am
Location: Nowhere near

Which Markets have the Strong Trends

Post by Kiwi »

A thought for this thread. I happened upon a post by Gary Fritz yesterday in which he discussed Dave Chamness' article on why the S&P doesnt trend. In this they introduce an indicator called the Trend StdDev developed by Alex Saitta.

I ran this indicator on a few commodities like JY, US and LC and it is quite enlightening. One of the interesting things is that different commodities are trendy over different timeframes. Gary's version for tradestation is at:

http://www.frii.com/~fritz/trading/

Because it prints the output and I am often mobile I created a version that generates a text file in the directory c:\data (which must be present or no file is generated). Mine is below.

Try it out. It seems a nice way of finding out if a market or a spread is likely to be profitable with trend following techniqes designed to catch different length trends or perhaps whether you should buy breakouts or dips. Perhaps someone will analyse some markets (or stocks vs commodities) and post them here?

John


{***************************************************************************
*
* Indicator: Trend StdDev
* Gary Fritz 1/7/99
* 7/20/99: Minor fixes and improvements
* Kiwi 7/6/03: Mod for storing the output as a file in c:\data
*
*
* Computes the standard deviation of Nlengs different lengths of
* price action: C-C[1], C-C[3], C-C[8], C-C[15], etc.
* In a pure Random Walk, the N^2-length sample will have a StdDev
* of N times the StdDev of the 1-length sample. If a particular
* price example shows larger-than-expected StdDevs it indicates
* a trending market; if the StdDevs are smaller than the expected
* values it indicates an anti-trending (reversing) market.
*
* Doesn't start recording data until 100 bars are available.
* Needs a lot of bars to compute valid data anyway, so just apply it
* to a long chart.
*
* StdDev values are printed to the Print Log.
*
* References:
* TASC Aug 95, Alex Saitta, Trending on a Historical Basis
* TASC Jan 92, E. Michael Poulos, Futures According to Trend Tendency
* (Thanks to Dave Chamness for the pointer & explanation!)
*
* Inputs: Price Price point used in SD calculations
* PlotStD If true, plots StdDev for 4 sample lengths
* (Probably not very useful)
*
***************************************************************************}

Inputs: Price(Close),
PlotStD(False); { Plot Std Devs of 9, 25, 49, 81-long samples }

Vars: Nlengs(14); { Compute stddev for lengths 1:Nlengs^2 }
Vars: Nbars(0), Index(0), Barsback(0), Diff(0), Mean(0), Sigma(0), SD1(0);
Arrays: BarSum[20](0), BarSum2[20](0);

if (currentBar = 1) then begin
FileAppend("C:\Data\TrndStdv.txt",Newline);
for Index = 1 to Nlengs begin
Nbars = 0;
BarSum[Index] = 0;
BarSum2[Index] = 0;
end;
end;

{ On each bar, add up sums & sum-of-squares,
for lookback lengths of Index^2 }

if (currentBar > Nlengs*Nlengs) then begin
Nbars = Nbars+1;
for Index = 1 to Nlengs begin
if (Index = 1) then Diff = (Price - Price[1]) / Price[1]
else Diff = (Price - Price[Index*Index-1]) / Price[Index*Index-1];
BarSum[Index] = BarSum[Index] + Diff;
BarSum2[Index] = BarSum2[Index] + Diff*Diff;
end;
end;

if LastBarOnChart and (Nbars > 1) then begin
FileAppend("C:\Data\TrndStdv.txt","Trend data for "+GetSymbolName+":"+NewLine);
if (DataCompression = 4) then FileAppend("C:\Data\TrndStdv.txt","Monthly bars ")
else if (DataCompression = 3) then FileAppend("C:\Data\TrndStdv.txt","Weekly bars ")
else if (DataCompression = 2) then FileAppend("C:\Data\TrndStdv.txt","Daily bars ")
else if (DataCompression = 1) then FileAppend("C:\Data\TrndStdv.txt"," "
+NumtoStr(BarInterval,3)+"-minute bars"+NewLine+NewLine);
FileAppend("C:\Data\TrndStdv.txt",NumtoStr(Nbars,5)
+" samples"+NewLine+NewLine);

{ An N^2 day test, with a perfect random walk, is expected to have
a standard deviation N times larger than a 1-day test.
So the "Expected" column is N, and the "Actual" column is
N^2-day_StdDev / 1-day_StdDev. }

FileAppend("C:\Data\TrndStdv.txt","Bars StdDev Expected Actual"+NewLine);
for Index = 1 to Nlengs begin
Mean = BarSum[Index] / Nbars;
Sigma = SquareRoot((BarSum2[Index]-Nbars*Mean*Mean)/(Nbars-1));
if (Index = 1) then SD1 = Sigma;
FileAppend("C:\Data\TrndStdv.txt",NumtoStr(Index*Index,4)
+" "+NumtoStr(Sigma,2)+" "+NumtoStr(Index,2)+" "
+NumtoStr(Sigma/SD1,2)+NewLine);
end;
end;
blueberrycake
Roundtable Knight
Roundtable Knight
Posts: 125
Joined: Mon Apr 21, 2003 11:04 pm
Location: California

Re: Which Markets have the Strong Trends

Post by blueberrycake »

Kiwi wrote: * Computes the standard deviation of Nlengs different lengths of
* price action: C-C[1], C-C[3], C-C[8], C-C[15], etc.
* In a pure Random Walk, the N^2-length sample will have a StdDev
* of N times the StdDev of the 1-length sample. If a particular
* price example shows larger-than-expected StdDevs it indicates
* a trending market; if the StdDevs are smaller than the expected
* values it indicates an anti-trending (reversing) market.
Do they show a proof of why this assertion is correct?

-bbc
Kiwi
Roundtable Knight
Roundtable Knight
Posts: 513
Joined: Wed Apr 16, 2003 1:18 am
Location: Nowhere near

Post by Kiwi »

BBC,

They probably do in the articles that are quoted (and can no doubt be downloaded for $3-5 each from the TASC website). The output says quite a bit. Compare your big winners with the high scorers.

John
Attachments
Trendiness2.gif
Trendiness2.gif (87.41 KiB) Viewed 19295 times
Toni
Senior Member
Senior Member
Posts: 31
Joined: Mon Apr 21, 2003 3:10 am
Location: Ukraine
Contact:

Post by Toni »

I use simple thing:
ATRin%(n days) ;-) and
% of price move from N days ago.

Trend Strength=%Move/ATR%

;-)
sapna
Contributor
Contributor
Posts: 4
Joined: Wed Jun 11, 2003 5:35 am
Location: Mumbai, India

Strength Filters

Post by sapna »

Hi Forum Mgmnt,
When using strength filters, do you ignore signals for the stocks filtered out even if you are not fully loaded?
Asamat
Roundtable Knight
Roundtable Knight
Posts: 175
Joined: Fri Jun 03, 2005 7:50 am
Location: Walldorf, Germany

Post by Asamat »

Hi,

I stumbled across the investigation mentioned above (Indicator: Trend StdDev) and could not understand the following point of the calculation. Does anybody have an explanation?

The formula calculates 10 relative price changes between today and 10 bars a number of days ago. "A number of days" is calculated as

Code: Select all

number = index * index
which means the first price change is compared to 1 day ago, the second to 4 days, then 9, 16, 25, ... At least that is what is described in the related articles. However, the code is written to give what is described in the comment as well not the series 1,4,9,16,25, ... but rather 1,3,8,15,24,... So it's

Code: Select all

number = index * index - 1
with a special treatment for the first.

Did anybody look into this? Can anybody think of a reason for not using the squares without the minus 1?

Thanks,
Asamat
Post Reply