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

RE: [amibroker] Linear Regression lines compressing the charts?



PureBytes Links

Trading Reference Links

Graham,

 

Thank you

Where would you suggest I add it in this formula?   I have tried adding it in different locations but keep getting syntax errors

 

 

 

 

P = ParamField("Price field",-1);

Daysback = Param("Period for Liner Regression Line",21,1,240,1);

shift = Param("Look back period",0,0,240,1);

 

 

//  =============================== Math Formula =============================================================

 

x = Cum(1);

lastx = LastValue( x ) - shift;

aa = LastValue( Ref(LinRegIntercept( p, Daysback), -shift) );

bb = LastValue( Ref(LinRegSlope( p, Daysback ), -shift) );

y = Aa + bb * ( x - (Lastx - DaysBack +1 ) );

 

 

// ==================Plot the Linear Regression Line ==========================================================

 

 

LRColor = ParamColor("LR Color", colorCycle );

LRStyle = ParamStyle("LR Style");

 

LRLine =  IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y, Null );

Plot( LRLine , "LinReg", LRCOLOR, LRSTYLE ); //  styleDots );

 

// ==========================  Plot 1st SD Channel ===============================================================

 

SDP = Param("Standard Deviation", 1.5, 0, 6, 0.1);

SD = SDP/2;

 

width = LastValue( Ref(SD*StDev(p, Daysback),-shift) );   // THIS IS WHERE THE WIDTH OF THE CHANELS IS SET 

SDU = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width , Null ) ;

SDL = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width , Null ) ;

 

SDColor = ParamColor("SD Color", colorCycle );

SDStyle = ParamStyle("SD Style");

 

Plot( SDU , "Upper Lin Reg", SDColor,SDStyle );

Plot( SDL , "Lower Lin Reg", SDColor,SDStyle );

 

//  ==========================  Plot 2d SD Channel ===============================================================

 

SDP2 = Param("2d Standard Deviation", 2.0, 0, 6, 0.1);

SD2 = SDP2/2;

 

width2 = LastValue( Ref(SD2*StDev(p, Daysback),-shift) );   // THIS IS WHERE THE WIDTH OF THE CHANELS IS SET 

SDU2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width2 , Null ) ;

SDL2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width2 , Null ) ;

 

SDColor2 = ParamColor("2 SD Color", colorCycle );

SDStyle2 = ParamStyle("2 SD Style");

 

Plot( SDU2 , "Upper Lin Reg", SDColor2,SDStyle2 );

Plot( SDL2 , "Lower Lin Reg", SDColor2,SDStyle2 );

 

// ============================ End Indicator Code ==============================================================

 

 

Mark

 

 

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Graham
Sent: Friday, July 22, 2005 6:37 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Linear Regression lines compressing the charts?

 

try adding
+stylenorescale
to the plot of linreg line
On 7/22/05, Mark Keitel <mkeitel@xxxxxxxxxxxxxxx> wrote:
>
>
> I was curious why when I place a set of linear regression lines on the
> candle-stick charts it compresses the candles and the whole chart making it
> look different when there were no lines there
>

>
> Took the same line configurations from Telechart2005 where it did not do
> this to the chart
>

>
> Was curious as to why this may happen and if there is s fix for it?
>

>
> Thank you
>

>
> Mark
> ________________________________
>
>
> 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 other support material please check also:
> http://www.amibroker.com/support.html
>
>
>
>
>
> SPONSORED LINKS
> Investment management software Investment property software Investment
> software
> Investment tracking software Return on investment software Stock investment
> software
> ________________________________
> YAHOO! GROUPS LINKS
>
>  Visit your group "amibroker" on the web.
>  
>  To unsubscribe from this group, send an email to:
>  amibroker-unsubscribe@xxxxxxxxxxxxxxx
>  
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>  To unsubscribe from this group, send an email to:
>  amibroker-unsubscribe@xxxxxxxxxxxxxxx
>  
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
> ________________________________
>


--
Cheers
Graham
AB-Write AFL Writing Service
http://e-wire.net.au/~eb_kavan/ab_write.htm



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 other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software Stock investment software


YAHOO! GROUPS LINKS