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

Re: [amibroker] Re: visualising rectangles



PureBytes Links

Trading Reference Links

iascool,

in the Conway book they explain how to use rectangles in a trading system. Rectangles precede a breakout either on the long or on the short side. Their system goes either long or short at the bar following a rectangle if the price goes above / below a certain value.

This code is only to play around and see what happens in the chart. If you want to use the concept in a system you'll have to do some additional programming,

rgds, Ed

  ----- Original Message ----- 
  From: iascool 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Sunday, November 14, 2004 12:53 PM
  Subject: [amibroker] Re: visualising rectangles



  If you dont mind can u also share its significance and application

  Regards
  --- In amibroker@xxxxxxxxxxxxxxx, "ed nl" <ed2000nl@xxxx> wrote:
  > /*
  > 
  > Rectangle Development
  > 
  > after: "Professional Stock Trading", M. Conway / A. Behle, 2003, 
  pages 106, 107, 108
  > 
  > Edward Pottasch, nov 2004
  > 
  > */
  > 
  > RectangleLength = 8;
  > RangeLength = RectangleLength * 3;
  > RangeFactor = 1.5;
  > RangeRatioLimit = 0.3;
  > AtrPeriod = RangeLength;
  > 
  > // rectangle
  > hg = SelectedValue(HHV(H,RectangleLength));
  > lw = SelectedValue(LLV(L,RectangleLength));
  > HeightRectangle = hg - lw;
  > 
  > // preceding range
  > hgp = SelectedValue(Ref(HHV(H,RangeLength),RectangleLength * -1));
  > lwp = SelectedValue(Ref(LLV(L,RangeLength),RectangleLength * -1));
  > HeightRangeLength = hgp - lwp;
  > 
  > // aspect ratio
  > ar = HeightRectangle / HeightRangeLength;
  > 
  > // ATR
  > at = SelectedValue(ATR(AtrPeriod));
  > 
  > // decide if it is a rectangle
  > yon = IIF(ar < RangeRatioLimit AND HeightRectangle < at * 
  RangeFactor, 1, 0);
  > 
  > // visualize the rectangle
  > x = Cum(1);
  > lastx = LastValue(x); 
  > selv = SelectedValue(x);
  > 
  > // the rectangle
  > xx = IIF(x > selv - RectangleLength AND x <= selv, x - (selv - 
  RectangleLength),null);
  > yy_l = lw + 0.0 * xx;
  > yy_h = hg + 0.0 * xx;
  > Plot(yy_l, "", IIF(yon,colorBrightGreen,colorRed), IIF(yon,4,1));
  > Plot(yy_h, "", IIF(yon,colorBrightGreen,colorRed), IIF(yon,4,1));
  > 
  > // preceding range
  > xx = IIF(x > selv - RectangleLength - RangeLength AND x <= selv - 
  RectangleLength, x - (selv - RectangleLength - RangeLength),null);
  > yy_l = lwp + 0.0 * xx;
  > yy_h = hgp + 0.0 * xx;
  > Plot(yy_l, "", colorWhite, 1);
  > Plot(yy_h, "", colorWhite, 1);
  > 
  > Plot(C,"",colorwhite,64);
  > 
  > "Aspect Ratio: " + writeval(ar);
  > "Height rectangle: " + writeval(HeightRectangle);
  > "ATR * Rangefactor: " + writeval(at * RangeFactor);
  > "Rectangle detected: " + writeif(yon," TRUE"," FALSE");
  > 
  > [Non-text portions of this message have been removed]





  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 
              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. 



[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/