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

Re: error in TS LinearRegSlope function



PureBytes Links

Trading Reference Links

Variables do not exist in the max bars back area.  MM1 should not be
calculated until CurrentBar >= 6.  CurrentBar begins its count at one after
the max bars back area.  Thus, the first time MM1 can correctly be
calculated is at CurrentBar = 6.  We need four iterations ( Bar 6, 7, 8, 9 )
of MM1 to correctly calculate MM2 for the first time.  Thus, MM2 should not
be calculated until CurrentBar >= 9.  For example:

AD = 100*(adv-dec)/(adv+dec+unc);
if CurrentBar >= 6 then mm1 = LinearRegSlope(AD, 6);
if CurrentBar >= 9 then mm2 = LinearRegSlope(mm1, 4);


Best regards,

Benjamin "ElGuru" Blanco
Certified EasyLanguage Specialist
http://www.blancofamily.net/elguru

----- Original Message -----
From: "Alex Matulich" <alex@xxxxxxxxxxxxxx>
To: <omega-list@xxxxxxxxxx>
Sent: Wednesday, July 03, 2002 12:45 AM
Subject: error in TS LinearRegSlope function


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