Hi Arun
This piece of code is brilliant for me and something that I've spent several
years looking for. Even though I probably have the TASC article stored
somewhere it's not something I can remember reading before now.
My Multi-Frame indicators cannot (for the most part) use regular MetaStock
functions, so many functions must be recreated using more basic code before
conversion of the rewritten MFL version to the Multi-Frame format. When
re-coded in the only other available pattern using the Cum() function, Linear
Regression, Linear Regression Slope, and the two added together as Time Series
Forecast are acceptably accurate only for a limited amount of data. Once the
amount of data loaded gets much beyond 4000 bars the errors get worse and
quickly becomes quite useless.
It's long been my belief that Linear Regression (least Squares) should only
require enough data to meet the Periods parameter of the LinearReg() function,
so the need for the only available (until this article came to light)
alternative code to accumulate ALL data across a chart or data array has never
made sense to me. What the "new" code gives is a way of fixing the accuracy of
all Multi-Frame Linear Regression indicators.
Now what I'd like to do is use the code you've posted to come up with an
equivalent for Linear Regression Slope. If there's anyone out there with the
math skills to redefine the final line to generate Linear Regression Slope I'd
be more than happy to give them a Multi-Frame indicator kit, or something from
my website of similar value.
I guess what looks pointless to one MetaStock user might be pure gold to
another.
Regards
Roy
Metastock users please take note of this:
I plotted a 20-period Modified Moving Average by Joe Sharp with the formula
given below and then plotted a 20-period Linear Regression indicator [
LinearReg(C,20) ] on top of it and found that they plot on top of each other
and the end values on the title bar are same.
Therefore, both are actually one indicator with different names.
{Modified Moving Average - TASC Jan 2000 by Joe Sharp}
n:=20;
tn:=Mov(C,n,S);
s1:=((n-1)/2)*C + ((n-3)/2)*Ref(C,-1) + ((n-5)/2)*Ref(C,-2)
+ ((n-7)/2)*Ref(C,-3) + ((n-9)/2)*Ref(C,-4)
+ ((n-11)/2)*Ref(C,-5) + ((n-13)/2)*Ref(C,-6)
+ ((n-15)/2)*Ref(C,-7) + ((n-17)/2)*Ref(C,-8)
+ ((n-19)/2)*Ref(C,-9) + ((n-21)/2)*Ref(C,-10)
+ ((n-23)/2)*Ref(C,-11) + ((n-25)/2)*Ref(C,-12)
+ ((n-27)/2)*Ref(C,-13) + ((n-29)/2)*Ref(C,-14)
+ ((n-31)/2)*Ref(C,-15) + ((n-33)/2)*Ref(C,-16)
+ ((n-35)/2)*Ref(C,-17) + ((n-37)/2)*Ref(C,-18)
+ ((n-39)/2)*Ref(C,-19);
tn+(6*s1)/((n+1)*n);
So, why go through the hassle of plotting the above code for a 20-period MMA
when it can be easily plotted as LinearReg(C,20).
Any comments?
Arun
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 8186 (20130402) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com