[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

error in TS LinearRegSlope function



PureBytes Links

Trading Reference Links

While testing a strategy, I noticed some strange and unexpected
signals.  Here are the EL statements:

AD = 100*(adv-dec)/(adv+dec+unc);
mm1 = LinearRegSlope(AD, 6);
mm2 = LinearRegSlope(mm1, 4);

Here's a sample of what TradeStation 2000i calculated:

date          AD        mm1       mm2
1000627     10.70      4.73      2.78
1000628     19.55      7.91      3.60
1000629     -0.57     61.10     18.57
1000630      0.29     18.32      9.39
1000703     35.64    -14.95    -11.13
1000705      1.13    -53.88    -37.82
1000706      9.92    -90.12    -36.43

The AD column is calculated correctly.  However, the mm1 column is
NOT the linear regression slope of the last 6 AD values.  See that
last mm1 value -90.12?  It should be -0.22.  The value previous to
that, -53.88, should be 0.037.

Oddly, the mm2 column is calculated correctly (using the incorrect
mm1 values).

What's going on here?  I tried the LinerRegSlopeFC function with the
same result.  Also, when I make an indicator to plot mm1, it plots
with the correct values!  In my strategy, however, the values are
incorrect, and so are the buy/sell signals resulting from them.

I don't understand this.  Any clues?

-- 
  ,|___    Alex Matulich -- alex@xxxxxxxxxxxxxx
 // +__>   Director of Research and Development
 //  \ 
 // __)    Unicorn Research Corporation -- http://unicorn.us.com