MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

A B C D E F G H I J K L M N O P R S T U V W Y Z #

LinReg Indicator/Slope by Jose Silva
Linear Regression Indicator/Slope MS formula. Precision accumulation errors courtesy
of MetaStock's Cum() single-precision function.


LinReg Indicator/Slope

{ Linear Regression Indicator/Slope MS formula }
{ Precision accumulation errors courtesy of }
{ MetaStock's Cum() single-precision function }
{ (C) Copyright 2003-2004 Jose Silva }
{ For private use only }
{ http://www.metastocktools.com }

{ User inputs }
pds:=Input("Linear Regression periods",
2,2520,21);
plot:=Input("Linear Regression: [1]Indicator, [2]Slope",1,2,1);
x:=Input("[1]Open, [2]High, [3]Low, [4]Close, [5]WgtCl, [6]P",1,6,4);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,WC(),If(x=6,P,C)))));

{ Lin Reg Slope }
counter:=Cum(1)-pds;
y:=pds*Sum(counter*x,pds)
-Sum(counter,pds)*Sum(x,pds);
z:=pds*Sum(Pwr(counter,2),pds)
-Pwr(Sum(counter,pds),2);
z:=
LastValue(ValueWhen(1,Cum(IsDefined(z))=1,z));
LRS:=y/z;

{ Lin Reg Indicator - LR trendline end point }
LRI:=LRS*pds-LRS*(pds+1)/2+Mov(x,pds,S);

{ Lin Reg trendline start point }
LRstart:=Ref(LRI-LRS*(pds-1),pds-1);

{ Plot }
If(plot=1,LRI,LRS)

 

Source / From: TOP
http://www.metastocktools.com

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.

TradeStation® Pro, TradeStation® 2000i, OptionStation®, SuperCharts®, PowerEditor® and EasyLanguage®
are registered trademarks of TradeStation Technologies, Inc. Other names and marks referred to are the property of their respective owners.

All information provided on this website is for educational purposes only. Trading involves risk, including possible loss of principal and other losses.

Ten i inne materiały na tej stronie zostały zamieszczone zostały jedynie w celach edukacyjnych, nie ponoszę żadnej odpowiedzialno¶ci za ich stosowanie.

Gra na giełdzie i rynkach walutowych (FOREX) niesie ze sob± ryzyko poważnych strat finansowych!