PureBytes Links
Trading Reference Links
|
hi Suree,
you could indeed use it in a explore. You need to add:
Filter = yon == 1;
Addcolum(yon,"Rectangle detected");
Then the next day (or bar) you either go long or short if it breaks the long breakout level or the short breakout level.
If I scan the Nasdaq 100 stocks for today it finds 3 possible entries. HSIC, JDSU, PAYX. Depending on whether the price breaks the breakout levels they can be entered as a long or short position. But I did not test how good it works in a system. You need to have a plan ready where to get out.
Below I added code that includes Explore functions. Also I put the rectangles inside the chart. Note that multiple adjacent rectangles destort the box like shape.
rgds, Ed
/*
Rectangle System Development
after: "Professional Stock Trading", M. Conway / A. Behle, 2003, pages 106, 107, 108
Edward Pottasch, nov 2004
*/
RectangleLength = 4;
RangeLength = RectangleLength * 3;
RangeFactor = 1.0;
RangeRatioLimit = 0.3;
AtrPeriod = RangeLength;
// rectangle
hg = HHV(H,RectangleLength);
lw = LLV(L,RectangleLength);
HeightRectangle = hg - lw;
// preceding range
hgp = Ref(HHV(H,RangeLength),RectangleLength * -1);
lwp = Ref(LLV(L,RangeLength),RectangleLength * -1);
HeightRangeLength = hgp - lwp;
// aspect ratio
ar = HeightRectangle / HeightRangeLength;
// ATR
at = ATR(AtrPeriod);
// decide if it is a rectangle
yon = IIf(ar < RangeRatioLimit AND HeightRectangle < at * RangeFactor, 1, 0);
// breakout level
long_breakout_level = IIf(yon,yon * hg,Null);
short_breakout_level = IIf(yon,yon * lw,Null);
// decide about direction
Buy = IIf(H > Ref(long_breakout_level,-1),1,0);
BuyPrice = IIf(O > Ref(long_breakout_level,-1), O, Ref(long_breakout_level,-1));
Short = IIf(L < Ref(short_breakout_level,-1),1,0);
ShortPrice = IIf(O < Ref(short_breakout_level,-1), O, Ref(short_breakout_level,-1));
Plot(C,"",colorWhite,64);
PlotShapes(IIf(yon,shapeCircle,0),colorWhite, layer = 0, yposition = O, offset = 0 );
PlotShapes(IIf(Buy,shapeUpArrow,0),colorWhite, layer = 0, yposition = BuyPrice, offset = 0 );
PlotShapes(IIf(Short,shapeHollowDownArrow,0),colorLightBlue, layer = 0, yposition = ShortPrice, offset = 0 );
// visualize the rectangles
rect_top = null;
rect_bot = null;
for (i = 0; i < BarCount; i++) {
if (yon[ i ]) {
for (j = i - RectangleLength + 1; j <= i; j++) {
rect_top[ j ] = hg[ i ];
rect_bot[ j ] = lw[ i ];
}
}
}
Plot(rect_top,"Long breakout level",colorBrightGreen,1);
Plot(rect_bot,"Short breakout level",colorBrightGreen,1);
Filter = yon == 1;
AddColumn(yon,"Rectangle detected");
AddColumn(long_breakout_level,"Long Breakout Level");
AddColumn(short_breakout_level,"Short Breakout Level");
----- Original Message -----
From: suree namsiripongpan
To: amibroker@xxxxxxxxxxxxxxx
Sent: Monday, November 15, 2004 11:21 AM
Subject: Re: [amibroker] Re: visualising rectangles
dear ed,
last night, i found one stock having rectangle pattern
with up arrow. so i enter today. after market close
today, this stock shows a few gain in my port now :))
thanks.
--- ed nl <ed2000nl@xxxxxxx> wrote:
> hi Roger,
>
> what I do is
>
> 1) right-click mouse anywhere in a chart
> 2) choose "Edit Formula"
> 3) Click "Add"
> 4) Click "Rename" and give it some name
> 5) Now Load the formula or cut and paste the formula
> in the Indicator Builder"
> 6) Click "Apply"
>
> Now you see this chart appear below or above the
> other one (you can move these panes around if
> needed).
>
> good luck,
>
> ed
>
> ----- Original Message -----
> From: Roger Breedlove
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Sunday, November 14, 2004 11:26 PM
> Subject: Re: [amibroker] Re: visualising
> rectangles
>
>
> Hi Ed
> Hope you can tolerate a newbie question. Do you
> add the second piece of
> code below the first piece in the same window. I
> don't know how to set it
> up in AB...... as an indicator or in AA?
> help appreciated. thanks
> Roger
>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:
>
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
>
>
> Yahoo! Groups Sponsor
>
> Get unlimited calls to
>
> U.S./Canada
>
>
>
>
>
------------------------------------------------------------------------------
> 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.
>
>
>
> [Non-text portions of this message have been
> removed]
>
>
__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Sponsor
Get unlimited calls to
U.S./Canada
------------------------------------------------------------------------------
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.
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/
|