PureBytes Links
Trading Reference Links
|
In the prior code, you'll want to remove the quotes around SYM in the
Foreign expressions or you will get a comparison with the ticker SYM
(Syms Corp - not a real standard bearer for tight rising channels)
instead of the variable SYM.
Sorry about that.
--- In amibroker@xxxxxxxxxxxxxxx, "timgadd" <timgadd@xxx> wrote:
>
> Thanks to Johan (johsun) for the meat of this code.
>
> One of the difficult parts, for me, of being a trend follower
> (trading intermediate term trends of weeks to months in duration)
is
> getting a sell signal on an individual holding and then finding new
> buy candidates as the trend in the overall market continues. I have
> found that buying stocks that are making new highs and that have
been
> outperforming the market (and their industry groups) for the
duration
> of the existing intermediate trend is about as good a "continuation
> pattern" as any.
>
> So here's an exploration that finds stocks that are in tight rising
> channels (compared to an index - or any other symbol) and are also
> making new closing highs. With this exploration, I'm trying to
locate
> stocks that are outperforming an index on a volatility-adjusted
basis
> along an existing trend (as measured by the linear regression line
of
> a broad market index starting from a technical low point), and are
> making new highs after some/minor consolidation (by the definition
of
> a tight rising channel, you won't have very much consolidation
along
> the channel/trend). The idea was inspired by Gary Smith's book "How
I
> Trade for a Living".
>
> If anyone wants to embelish this code to enable Periods to be
> determined with the BeginValue and EndValue markers on the chart,
> please post.
>
> ///////////////////////////////////////////////////////////////
> Periods = 125;
> /* i'd actually like to be able to define the Periods of the linear
> regression segment with the BeginValue and EndValue markers on a
> chart if anyone knows how this could be done */
>
> Sym = ParamStr( "Comparison Symbol:", "DWC--X" );
> /* replace DWC--X with your own symbol to serve as a comparison for
> defining your "tight rising channel" */
>
> end = LinearReg( C, periods ); start =
LinRegIntercept( C,
> periods ); slope = LinRegSlope( C, periods );
> endF = LinearReg(Foreign("SYM","Close"), periods);
> startF = LinRegIntercept(Foreign("SYM","Close"), periods);
> slopeF = LinRegSlope(Foreign("SYM","Close"), periods);
>
> for( n = x = 0; n < periods; n++ )
> x = x + abs( Ref( C, - n ) - ( end - n * slope ) );
>
> for( nF = xF = 0; nF < periods; nF++ )
> xF = xF + abs( Ref( Foreign("SYM","Close"), - nF ) - ( endF - nF *
> slopeF ) );
>
> Direction = end - start; Volatility = x; ER =
> (Direction / Volatility)*100;
> DirectionF = endF - startF; VolatilityF = xF;
> ERf = (DirectionF / VolatilityF)*100;
>
> /* ER stands for Efficiency Ratio, the standard version of which
(as
> defined by Perry Kaufman) is (Close - Ref(Close, -periods)) / Sum
(abs
> (ROC(C,1), periods)) */
>
> Filter = EMA(V,252) * EMA(C,107) >= 1800000 AND EMA(V,252) >= 50000
> AND (Direction/start) >= .92 * (DirectionF/startF)
> AND ER >= ERf
> AND C > Ref(HHV(C,36),-1)
> AND Ref(C,-1) < Ref(HHV(H,36),-2)
> AND (L-Ref(H,-1))/Ref(H,-1) < .08;
>
> /* The filter weeds out stocks with low average daily turnover,
those
> whose linear regression rate of change is not within 8% of the
> comparison symbol's, and those with a lower Efficiency Ratio than
the
> comparison symbol's. The filter also selects stocks that are making
> new 36-bar closing highs, but whose previous close was lower than
the
> highest high price of the prior 36 bars. Finally, the final bar's
low
> should not have gapped up more than 8% from the previous bar's
high.*/
>
> AddTextColumn(SectorID( mode = 1 ),"Sector");
> AddTextColumn(IndustryID( mode = 1 ),"Industry");
> ///////////////////////////////////////////////////////////////
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
GFT Forex Trading Accounts As low as $250 with up to 400:1 Leverage. Free Demo.
http://us.click.yahoo.com/lpv1TA/jlQNAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
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 Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|