| 
 PureBytes Links 
Trading Reference Links 
 | 
Gary, extending your thoughts, have you found similar correlations in other
markets? Naz vs. ND M1? CIEN daily vs. 10 min. intraday? ND M1 daily vs. 10
min.?
TIA
Gene
----- Original Message -----
From: "Gary Fritz" <fritz@xxxxxxxx>
To: "Omegalist" <omega-list@xxxxxxxxxx>
Sent: Saturday, May 19, 2001 10:55 AM
Subject: Re: trendiness measures
> > Could someone please briefly explain some measures of trendiness
> > that I could use to decide which markets tend to trend more than
> > others?   ... Yes, I'm familiar with the ADX, the CMO, etc., but
> > how are indicators like these used to give a summary of a market's
> > trendiness over, say, a year?
>
> Here's an indicator you can apply to a market to get a statistical
> measure for  its trendiness.  It measures the movement of the market
> over several sample lengths, and compares the result to what would be
> expected of a "random walk."  If the market has moved more than a
> random walk, that indicates it tends to trend in that timeframe.  If
> it moves less, it's *anti*-trending -- that is, it reverses more than
> would be expected of even a random walk.
>
> Also note that you must apply it to a chart with AT LEAST 100 bars.
> Longer charts will give you a more accurate result.
>
> Here's an example of the indicator's output:
>
>  Trend data for SP M1:
>    10-minute bars
>   1926 samples
>  Bars     StdDev  Expected  Actual
>     1     0.00260     1     1.00000
>     4     0.00492     2     1.89514
>     9     0.00761     3     2.93162
>    16     0.01032     4     3.97341
>    25     0.01313     5     5.05649
>    36     0.01590     6     6.12256
>    49     0.01835     7     7.06543
>    64     0.02091     8     8.05145
>    81     0.02333     9     8.98652
>   100     0.02536    10     9.76810
>
> Since the "Actual" value for the sample lengths 25, 36, 49, and 64 is
> slightly longer than the "Expected," that indicates the 10min SP
> tends to trend (slightly) in this period when you look at 25-64 bar
> moves.  Longer and shorter moves tend NOT to trend, since their
> "Actual" value is slightly LESS than the "Expected."
>
> Here's an interesting result:  this is a year of DAILY S&P:
>
>  Bars     StdDev  Expected  Actual
>     1     0.01399     1     1.00000
>     4     0.02595     2     1.85540
>     9     0.03649     3     2.60854
>    16     0.04641     4     3.31798
>    25     0.05049     5     3.60985
>    36     0.05489     6     3.92427
>    49     0.05456     7     3.90075
>    64     0.05884     8     4.20646
>    81     0.06229     9     4.45316
>   100     0.06400    10     4.57589
>
> Note that the S&P shows anti-trending (reversing) behavior at ALL
> sample lengths, especially at longer lengths.  This should come as no
> surprise.  The S&P is known as a reversing market -- that's why "buy
> the dips" works.  "Trending" means "if it's going up, it will tend to
> keep going up, and vice versa."  But in the S&P it usually works to
> say "if it's going down, buy, because soon it will go back up."
> That's ANTI-trending behavior.
>
> By default the indicator DOES NOT PLOT ANYTHING.  It prints its
> results in the Print Log.  Several people had trouble with that the
> last time I posted an indicator like this.  Remember to scroll down
> to the bottom of the Print Log.  :-)  If you set the PlotSD input to
> True, it will plot the SD's of several sample lengths, but I don't
> think this is very useful.
>
> Gary
>
>
>
{***************************************************************************
>  *
>  *  Indicator:  Trend StdDev
>  *  Gary Fritz  1/7/99
>  *    7/20/99:  Minor fixes and improvements
>  *
>  *  Computes the standard deviation of Nlengs different lengths of
>  *  price action:  C-C[1], C-C[4], C-C[9], C-C[16], 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(10);            { 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
>   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 Price[Index*Index] = 0
>       then Diff = 0
>       else Diff = (Price - Price[Index*Index]) / Price[Index*Index];
>     BarSum[Index] = BarSum[Index] + Diff;
>     BarSum2[Index] = BarSum2[Index] + Diff*Diff;
>     end;
>   end;
>
> if LastBarOnChart and (Nbars > 1) then begin
>   print("Trend data for ",GetSymbolName,":");
>   if (DataCompression = 4) then print("  Monthly bars")
>   else if (DataCompression = 3) then print("  Weekly bars")
>   else if (DataCompression = 2) then print("  Daily bars")
>   else if (DataCompression = 1) then print(" ",BarInterval:3:0,"-minute
bars");
>   print(Nbars:5:0," samples");
>
>   { 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. }
>
>   print("Bars     StdDev  Expected  Actual");
>   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;
>     print(Index*Index:4:0,"    ",Sigma:2:5,"    ",Index:2:0,"
",Sigma/SD1:2:5);
>     end;
>   end;
>
> { If desired, plot 4 of the SD's.  I'm not sure this is useful but
>   I thought somebody might like to see it.  The repeated code is not
>   very pretty, but EL's limits made it a pain to do it via looping. }
>
> if PlotStD and (Nbars > 10) then begin
>   Mean = BarSum[3] / Nbars;
>   Sigma = SquareRoot((BarSum2[3]-Nbars*Mean*Mean)/(Nbars-1));
>   plot1(Sigma, "StD3");
>   Mean = BarSum[5] / Nbars;
>   Sigma = SquareRoot((BarSum2[5]-Nbars*Mean*Mean)/(Nbars-1));
>   plot2(Sigma, "StD5");
>   Mean = BarSum[7] / Nbars;
>   Sigma = SquareRoot((BarSum2[7]-Nbars*Mean*Mean)/(Nbars-1));
>   plot3(Sigma, "StD7");
>   Mean = BarSum[9] / Nbars;
>   Sigma = SquareRoot((BarSum2[9]-Nbars*Mean*Mean)/(Nbars-1));
>   plot4(Sigma, "StD9");
>   end;
>
>
 |