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/
> 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/
>
__._,_.___
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
SPONSORED LINKS
__,_._,___
|