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

Re: [amibroker] Re: Help with AFL Formula Please!



PureBytes Links

Trading Reference Links

Jim,
 
I added this to the bottom of the formula you posted...and ran an explore in AA:
 

Buy=LinRegSlope(C,60) > 0 AND C >= sdl AND C <= sdl*1.10 ;

Sell=0;

//Buy=ExRem(Buy,Sell);

Filter=Buy > 0;

AddColumn(C,"");

----- Original Message -----
From: jnk1997
Sent: Monday, March 21, 2005 5:26 PM
Subject: [amibroker] Re: Help with AFL Formula Please!


Anthony,

When I run with my formula I get an error on your line as follows:

Error 29, variable "sdl" used without having been initialized

What is sdl and how do I initialize it?

I tried posted the Linear regression code before the trading formula
and the AFL checker keeps finding errors in that code even though the
code works perfect as an indicator on my charts.


Thanks

Jim




--- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso" <ajf1111@xxxx>
wrote:
> Jim,
>
> try this:
> LinRegSlope(C,60) > 0 AND C >= sdl and C <= sdl*1.10
>
>
>
>  ----- Original Message -----
>
>   From: jnk1997
>   To: amibroker@xxxxxxxxxxxxxxx
>   Sent: Monday, March 21, 2005 4:37 PM
>   Subject: [amibroker] Re: Help with AFL Formula Please!
>
>
>
>   Yes Anthony,
>
>   The lower Line (not the lowest) is the line I'm interested in
finding
>   stocks closing price at. It's basically finding stocks in an
uptrend
>   (Thats why the slope has to be greater than 0) that have pulled
back
>   to the lower regression line.
>
>   Thanks for your help!
>   Jim
>
>
>
>   _SECTION_BEGIN("Lin Regr Line w 2 Standard Deviation Channels ");
>   //  Linear Regression Line with 2 Standard Deviation Channels
Plotted
>   Above and Below
>   //  Written by Patrick Hargus, with critical hints from Marcin
>   Gorzynski, Amibroker.com Technical Support
>   //      Designed for use with AB 4.63 beta and above, using drag
and
>   drop feature. 
>   //  Permits plotting a linear regression line of any price field
>   available on the chart for a period determined by the user. 
>   //     2 Channels, based on a standard deviation each determined
by
>   the user, are plotted above and below the linear regression line.
>   //             A look back feature is also provided for examining
>   how the indicator would have appeared on a chart X periods in the
>   past.   
>
>
>   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
>   ==============================================================
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>   --- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso"
<ajf1111@xxxx>
>   wrote:
>   > Jim,
>   >
>   > What is this:
>   > (Linear
>   > > Regression Index - LR Channel)
>   >  Do you have formula ?
>   >
>   > Anthony
>   >   ----- Original Message -----
>   >   From: jnk1997
>   >   To: amibroker@xxxxxxxxxxxxxxx
>   >   Sent: Monday, March 21, 2005 3:47 PM
>   >   Subject: [amibroker] Re: Help with AFL Formula Please!
>   >
>   >
>   >
>   >   Is there no one willing to translate this into AFL?
>   >   Thanks in advance
>   >   JIm
>   >
>   >
>   >
>   >   --- In amibroker@xxxxxxxxxxxxxxx, "jnk1997" <jnk1997@xxxx>
wrote:
>   >   >
>   >   > Hello,
>   >   >
>   >   > I would like to add the following condition to an AFL buy
>   formula:
>   >   > Can someone translate this into AFL?
>   >   >
>   >   >
>   >   > AND 60 day slope of close (LR) is above 0
>   >   > AND low (close price) is near bottom (within 10%) LRI(60)
>   (Linear
>   >   > Regression Index - LR Channel)
>   >   >
>   >   > Thanks
>   >   > Jim
>   >
>   >
>   >
>   >
>   >
>   >   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
>   >
>   >
>   >
>   >
>   >         Yahoo! Groups Sponsor
>   >               ADVERTISEMENT
>   >             
>   >       
>   >       
>   >
>   >
>   > ----------------------------------------------------------------
----
>   ----------
>   >   Yahoo! Groups Links
>   >
>   >     a.. To visit your group on the web, go to:
>   >     http://groups.yahoo.com/group/amibroker/
>   >      
>   >     b.. To unsubscribe from this group, send an email to:
>   >     amibroker-unsubscribe@xxxxxxxxxxxxxxx
>   >      
>   >     c.. Your use of Yahoo! Groups is subject to the Yahoo!
Terms of
>   Service.
>   >
>   >
>   >
>   >
>   > ----------------------------------------------------------------
----
>   ----------
>   >
>   >
>   >   No virus found in this incoming message.
>   >   Checked by AVG Anti-Virus.
>   >   Version: 7.0.308 / Virus Database: 266.7.4 - Release Date:
>   3/18/2005
>   >
>   > No virus found in this outgoing message.
>   > Checked by AVG Anti-Virus.
>   > Version: 7.0.308 / Virus Database: 266.7.4 - Release Date:
3/18/2005
>
>
>
>
>
>   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
>
>
>
>
>         Yahoo! Groups Sponsor
>               ADVERTISEMENT
>             
>       
>       
>
>
> --------------------------------------------------------------------
----------
>   Yahoo! Groups Links
>
>     a.. To visit your group on the web, go to:
>     http://groups.yahoo.com/group/amibroker/
>      
>     b.. To unsubscribe from this group, send an email to:
>     amibroker-unsubscribe@xxxxxxxxxxxxxxx
>      
>     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>
>
>
>
> --------------------------------------------------------------------
----------
>
>
>   No virus found in this incoming message.
>   Checked by AVG Anti-Virus.
>   Version: 7.0.308 / Virus Database: 266.7.4 - Release Date:
3/18/2005
>
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.7.4 - Release Date: 3/18/2005





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





No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.4 - Release Date: 3/18/2005


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




Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.4 - Release Date: 3/18/2005