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

[amibroker] Linear Regress Reversal Indicator



PureBytes Links

Trading Reference Links

Functions written for the Traders' Tips section of "Technical 
Analysis of Stocks and Commodities" magazine.

FUNCTION: Linear Regression Reversal Indicator
FORMULA: LinRegReverse
DESC: Return 1 if the Linear Regression of a value is increasing or 
unchanged and -1 if it is decreasing.
NOTES: This function returns 1 if the Linear Regression of a value 
is increasing or unchanged and -1 if it is decreasing.

Parameters
------------------
Data          The data to use in the regression. This is typically a 
field in a data series or a calculated value.

Period        The number of bars of data to include in the 
regression, including the current value. For example, a period of 3 
includes the current value and the two previous values.

Function Value
------------------------
The linear regression indicator is calculated by fitting a linear 
regression line over the values for the given period, and then 
determining the current value for that line. A linear regression 
line is a straight line which is as close to all of the given values 
as possible.  The linear regression indicator at the beginning of a 
data series is not defined until there are enough values to fill the 
given period.

This function returns 1 if the Linear Regression of a value is 
increasing or unchanged and -1 if it is decreasing.

Source
------------
This function is based on the article "Trade The Price Swings" by 
Barbara Star in the December 2003 issue of "Technical Analysis of 
Stocks and Commodities".

iff(GE(Change(LRI(Data,Period),1),0),1,-1)

END OF NOTES
   HASBUFFER

   INPUT: Data
      TYPE: series

   INPUT: Period
      TYPE: integer
      DEFAULT: 5

   STEP: 1
      PERFORM: LRI

      INPUT COLUMN: 1

      INPUT COLUMN: 2

   STEP: 2
      PERFORM: Change

      INPUT COLUMN: -1

      INPUT VALUE: 1

   STEP: 3
      PERFORM: GE

      INPUT COLUMN: -2

      INPUT VALUE: 0

   STEP: 4
      PERFORM: If

      INPUT COLUMN: -3

      INPUT VALUE: 1

      INPUT VALUE: -1

END OF FUNCTION


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/