/*[[ Name := linear regression indicator Author := Copyright e 2004, Nick Bilak, beluck[at]ukr.net Link := http://bilak.port5.com Separate Window := No First Color := Red First Draw Type := Line Second Color := Red Second Draw Type := Line Use Second Data := Yes ]]*/ Inputs : Fib1Period(13); Variables : WT2(0),shift(0), cnt(0), loopbegin(0), first(True), prevbars(0); Variables : sum(0), length(0), i(0), mt(0), WT(0), vWT2(0),value(0); SetLoopCount(0); // initial checkings If Fib1Period < 1 Then Exit; length=Fib1Period; loopbegin = 500-length-1; For shift = loopbegin Downto 0 Begin WT=ima(55,MODE_SMA,Shift)+Fib1Period*Point; WT2=ima(55,MODE_SMA,Shift)-Fib1Period*Point; SetIndexValue(shift,WT); SetIndexValue2(shift,WT2); End;