Hermans works but ... barcount check ? End of chart to the right ...
Regards, Ton.
----- Original Message -----
From: Herman
To: Waleed Khalil
Sent: Friday, April 20, 2007 12:07 PM
Subject: Re[2]: [amibroker] Continues line plotting help
This is exactly what it does:
Friday, April 20, 2007, 6:02:56 AM, you wrote:
> Thanks Herman
> But the code is not working, and what i need is to draw a Continues line
> like the ZIGZAG for every buy and sell signal to see it more like a ZIGZAG
> thanks in advance
> Herman wrote:
>> Not entirely sure what you need, but this example may help you get
>> started:
>> Buy = Cross( MACD(), Signal() );
>> Sell = Cross( Signal(), MACD() );
>> PlotShapes(IIf(Buy,
>> shapeHollowUpTriangle, shapeNone),5,0,BuyPrice,0);
>> PlotShapes(IIf(Sell,
>> shapeHollowDownTriangle, shapeNone),4,0,SellPrice,0);
>> Plot(C,"",1,128);
>> Sig =Buy OR Sell;
>> y0 = 0; y1 = C[0];TPrice = C;
>> BI = BarIndex();
>> start = Status("firstvisiblebarindex") - BI[0];
>> end = Status("lastvisiblebarindex") - BI[0] - 1;
>> for(b=start ;b < end ;b++)
>> {
>> if( Buy[b] ) Co = colorRed;
>> if( Sell[b] ) Co = colorBrightGreen;
>> if(Sig[b])
>> {
>> x0 = y0;
>> x1 = y1;
>> y0 = b;
>> y1 = TPrice[b];
>> Plot(LineArray(x0,x1,y0, y1),"",Co,1);
>> }
>> }
>> Friday, April 20, 2007, 5:32:49 AM, you wrote:
>> > Hi All
>> > Please can any one help with the foloowing code , i need to draw
>> > Continues line from every buy and sell signal, but i get too many lines
>> > start and end point are mostly ok, but there is no Continues line !
>> > thanks in advance
>> > _SECTION_BEGIN("cycle 4");
>> > 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", colorWhite ), styleNoTitle |
>> > ParamStyle("Style") | styleBar );
>> > Condi1= Cross( Close, EMA(Close,9) ) ;
>> > Condi2= Cross( EMA(Close,9),Close ) ;
>> > Buy=Condi1 ;
>> > Sell=Condi2 ;
>> > x1=0;
>> > y1=0;
>> > x2=0;
>> > y2=0;
>> > for( i = 0; i < BarCount; i++ )
>> > {
>> > if (Buy[i])
>> > x1=i;
>> > y1=L[i];
>> > if (Sell[i])
>> > x2=i;
>> > y2=H[i];
>> > Line = LineArray( x1, y1, x2, y2, 0,0);
>> > Plot( Line, "Continues ", colorYellow,1 );
>> > if (Buy[i])
>> > x1=i;
>> > y1=L[i];
>> > Line = LineArray( x2, y2, x1, y1, 0,0);
>> > Plot( Line, "Continues ", colorYellow,1 );
>> > }
>> > PlotShapes( IIf(Buy,shapeDigit1,0) ,5, 0, L,-10);
>> > PlotShapes( IIf(Sell,shapeDigit2,0) ,4, 0, H,10);
>> > _SECTION_END();
>> > 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/ <http://www.amibroker.com/devlog/>
>> > For other support material please check also:
>> > http://www.amibroker.com/support.html
>> <http://www.amibroker.com/support.html>
>> >
>> > Yahoo! Groups Links
>> > http://groups.yahoo.com/group/amibroker/
>> <http://groups.yahoo.com/group/amibroker/>
>> > Individual Email | Traditional
>> > http://groups.yahoo.com/group/amibroker/join
>> <http://groups.yahoo.com/group/amibroker/join>
>> > (Yahoo! ID required)
>> > mailto:amibroker-digest@xxxxxxxxxps.com
>> <mailto:amibroker-digest@xxxxxxxxxps.com>
>> > mailto:amibroker-fullfeatured@yahoogroups.com
>> <mailto:amibroker-fullfeatured@yahoogroups.com>
>> > amibroker-unsubscribe@xxxxxxxxxxxxcom
>> <mailto:amibroker-unsubscribe@yahoogroups.com>
>> > http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/>
>> >
>>
> 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@xxxxxxxxxps.com
> mailto:amibroker-fullfeatured@yahoogroups.com
> <*> To unsubscribe from this group, send an email to:
> amibroker-unsubscribe@xxxxxxxxxxxxcom
> <*> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
|