PureBytes Links
Trading Reference Links
|
At 10:10 PM -0500 12/30/98, Alex wrote:
>Could somebody from the group help me in writing a system in Easy Language.
>I would like to write a system defined in following manner:
> - buy when Linear Regression crosses above a Simple Moving Average and
> today's Lin. Regression is higher than yesterday's.
> - sell when Lin. Reg. crosses below a Simple Moving Average and today's
> Lin. Reg. is lower than yesterday's.
>The code for Lin. Reg is attached.
>The help would be appreciated.
Try the attached code. It buys and sells next bar at the market. You can
change this as you require.
Bob Fulks
----------
Input: LR.Len(10), MA.Len(10);
Vars: LReg(0), Ave(0);
LReg = LinearRegValue(Close, LR.Len, 0);
Ave = Average(Close, MA.Len);
if LReg crosses over Ave and LReg > LReg[1] then
Buy next bar at market;
if LReg crosses under Ave and LReg < LReg[1] then
Sell next bar at market;
|