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

RE: [amibroker] AFL for Linear Regression Study



PureBytes Links

Trading Reference Links

Vinay,

That particular line requires a late version of Amibroker.  I am using ver
5.15 and the code works for me.  Just delete that line or comment it out and
let me know if it works.  Also what version of AB are you using?

Grover

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of Vinay Gakkhar.
Sent: Saturday, July 26, 2008 5:41 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] AFL for Linear Regression Study

Grover,

SetBarsFillColor( IIf( C > O, colorBrightGreen, colorRed ) ); shows syntax
error.

Please check & correct.

vgakkhar



On Sat, 26 Jul 2008 23:11:58 +0530, Grover Yowell <gyowell1@xxxxxxxxxx>
wrote:

> Herman,

> I adapted the code in the portfolio equity function as suggested by Paul,
> and have everything working now.  It draws the linear regression line and
> the channels.  Also there is good agreement between the built in linear
> regression channel study and my adapted code.  Had to use setbarsrequired
to
> make it work, not quite sure why.

> Here is the code:

> SetBarsRequired(100000,0);
>
> bar = BarIndex();
>
> islastbar = bar == BarCount -10;
>
> isfirstbar = bar == BarCount - 100;
>
> firstbar = LastValue( ValueWhen( isfirstbar, bar ) );
>
> lastbar = LastValue( ValueWhen( islastbar, bar ) );
>
> al = LastValue( ValueWhen( islastbar, LinRegSlope( C, Lastbar - firstbar +
1
> ) ) );
>
> bl = LastValue( ValueWhen( islastbar, LinRegIntercept( C, Lastbar -
firstbar
> + 1 ) ) );
>
> Lr = al * ( BarIndex() - firstbar ) + bl;
>
> Lr = IIf( bar >= firstbar AND bar <= lastbar , Lr, Null );
>
> se = StdErr(C,Lastbar - firstbar);
>
> se = LastValue( ValueWhen( islastbar, StdErr( C, Lastbar - firstbar + 1 )
)
> );
>
> upper = Lr + se;
>
> Lower = Lr - se;
>
> Plot(Lr, "lr", colorYellow, styleThick );
>
> Plot(upper, "upper", colorGreen, styleThick );
>
> Plot(Lower, "lower", colorRed, styleThick );
>
> SetBarFillColor( IIf( C > O, colorBrightGreen, colorRed ) );
>
> Plot(C, "C", colorWhite, styleCandle );
>
> Title = "bar= " + bar + " firstbar= " + firstbar + " lastbar= " + lastbar+
"
> se= "+ se;
>
> 
>
> Again thanks to you and Paul for all the help.
>
> 
>
> Grover
>
> 
>
> 
>
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf
> Of Herman
> Sent: Saturday, July 26, 2008 7:31 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: RE: [amibroker] AFL for Linear Regression Study
>
> 
>
> The code below adds HL channels, you can probably modify it to plot the
> StdErr() instead of Highs and Lows:
>
> Plot(C,"",1,128);
> HosArray = HHV(H-LRL,Length);
> Hos = HosArray[LastPoint];
> LosArray = HHV(LRL-L,Length);
> Los = LosArray[LastPoint];
> LL = LRL-Los;
> UL = LRL+Hos;
> Plot(LL,"",5,1);
> Plot(UL,"",4,1);
>
> Good luck,
>
> herman
>
> 
>
>
> -----Original Message-----
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]On
Behalf
> Of Grover Yowell
> Sent: July 26, 2008 9:16 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [SPAM]RE: [amibroker] AFL for Linear Regression Study
>
>
> Hi,
> Thanks Paul and Herman.  Just what I needed to get started. Have it
working
> and plotting the linear reg line for arbitrary starting and end dates.
>
> Next step is to be able to plot the standard error bands for the linear
> regression channel.
>
> Any suggestions on how to calculate the standard error with starting and
end
> dates coinciding with those of the linear regression line?
>
> Thanks,
>
> Grover
>
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf
> Of Paul Ho
> Sent: Friday, July 25, 2008 8:40 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: RE: [amibroker] AFL for Linear Regression Study
>
> take a look at the canned indicator for portfolio equity. It has an option
> for linear Reg. just port it over to your own need.
>
>
>
>
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf
> Of gyowell2000
> Sent: Saturday, 26 July 2008 11:08 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] AFL for Linear Regression Study
> Hello,
>
> Is the AFL code for the Linear Regession Study available? I would
> like to be able to place the study on a chart starting and ending on
> selscted dates under program control rather than doing it manually.
>
> I have checked the Amibroker user's guide, the AFL library and Googled
> but have found nothing useful.
>
> Grover
>
> 
>
> 




------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links




------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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