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

Re: error in TS LinearRegSlope function



PureBytes Links

Trading Reference Links

According to the help files, the LinearRegSlope Len parameter is a
numeric simple type input.
Numeric simple inputs limit you to a number that doesn't change on a
bar-to-bar basis.

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

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

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

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

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

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

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

AM> I don't understand this.  Any clues?





Best regards,
Listening