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

Re: [amibroker] a loop need to count bars



PureBytes Links

Trading Reference Links

hi Ara 
have a look please in the link below to understand what I mean
a help foto was missing but i just add it on this link
http://good-times.webshots.com/photo/2093063700103516331zMsaBf]

> If your swing points are defined, you do not need a loop.
> 
> Try this:
> BarsSincePoint_A = BarsSince(SwingPoint_A);
> etc
> 
> ----- Original Message -----
> From: <panosbouf@xxxxxxxxxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Tuesday, July 01, 2008 3:42 PM
> Subject: [amibroker] a loop need to count bars
> 
> 
> > Hello .. Headache with High and Low Swing Point Triangles
> > I need a help for a loop
> > Every time that we have a Swing Point I would like to draw a line to the
> > left until the line to find a price bar.
> > Then we have to count how many lower low we have on the left side of the
> > triangle and how many higher high of the right side.
> >  And when the left side of the triangle the bars are less than the left
> > side I would like to draw a triangle like this in the picture that I
> > attach
> >
> > Do I need to write a loop to count that bars?
> > If the left bars are less than the right side the triangle is correct
> >
> > Thanks
> > Panos
> >
> > SetChartOptions(0,chartShowArrows|chartShowDates);
> > _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo
> > %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C,
> > 1 ) ) ));
> > Plot( C, "Close", ParamColor("Color", colorBlack ), styleBar |
> > styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
> >
> > x = Cum(1); ReX = LastValue(x)-x;
> >
> > // " High Swing point " ;
> > HSP =H > Ref(H,2) & H > Ref(H,1) & H > Ref(H,-1) & H > Ref(H,-2) &  ReX >2
> > ;
> > HSPHigh = ValueWhen(HSP,H);
> > HSPX = ValueWhen(HSP,X);
> > HSP_lastX = LastValue(ValueWhen(HSP,x,1));
> > PlotShapes(IIf(HSP,shapeSmallCircle,-1e10),colorRed,0,H,13);
> >
> > // " Low Swing point " ;
> > LSP =  L < Ref(L,2) & L <=  Ref(L,1) & L < Ref(L,-1) & L <  Ref(L,-2) &
> > ReX >2;
> >
> > LSPLow = ValueWhen(LSP,L);
> > LSPX = ValueWhen(LSP,X);
> > LSP_LastX = LastValue(ValueWhen(LSP,x,1));
> > PlotShapes(IIf(LSP,shapeSmallCircle,-1e10),colorLime,0,L,-13);
> >
> > // Up base of triangle
> > Basi_H1=  LastValue(ValueWhen(HSP,H,1));    "\n Basi_H1= "+
> > WriteVal(Basi_H1);
> > LeftBarHL= H>Basi_H1 AND L <Basi_H1;
> > LeftBar =LastValue(ValueWhen(LeftBarHL,x,1));     "LeftBar= "+
> > WriteVal(LeftBar);
> >  PlotShapes(IIf(LeftbarHL,shapeDigit0,-1e10),colorRed,0,H,22);
> > base_triangle = x>=LeftBar AND x<=HSP_lastX;   "base_triangle= "+
> > WriteVal(base_triangle);
> >  Plot(IIf( base_triangle
> > ,LastValue(ValueWhen(LeftBarHL,Basi_H1,1)),Null),"",colorBlue,1);
> >
> > "   Right side " ;
> > RightSideBars = EndValue( HSPx) - BeginValue( LastValue(LSPX) );
> > "RightSideBars = "+ WriteVal(RightSideBars );
> >
> > "   Left side" ;
> > LeftSideBars = EndValue( LSPX ) - BeginValue( LeftBar ); "LeftSideBars =
> > "+ WriteVal(LeftSideBars );
> >
> >
> > // Plot Lines if Left bars are less or equally than Rightside
> > LeftLine = LineArray( LeftBar ,LastValue(HSPHigh)  , LastValue(LSPX),
> > LastValue(ValueWhen(LSP,L)), 0 );
> > RightLine = LineArray(  LastValue(LSPX) ,LastValue(ValueWhen(LSP,L))  ,
> > LastValue(HSPX), LastValue(Basi_H1 ), 0 );
> >
> > if(LeftSideBars <=RightSideBars )
> > {
> > Plot( LeftLine  , "LeftLine", colorBlue );
> > Plot( RightLine , "RightLine", colorBlue );
> > PlotOHLC( LeftLine  , LeftLine  ,basi_h1 ,LeftLine   , "",  colorRed,
> > styleCloud );
> > PlotOHLC( RightLine , RightLine ,basi_h1 ,RightLine , "",  colorRed,
> > styleCloud );
> > }
> >
> >
> >
> >
> > ------------------------------------
> >
> > 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > http://www.amibroker.com/devlog/
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> > Yahoo! Groups Links
> >
> >
> >
> >
> 
> 
> ------------------------------------
> 
> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> Yahoo! Groups Links
> 
> 
> 


--
Thanks


------------------------------------

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

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