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

[amibroker] Re: AFL looping question!



PureBytes Links

Trading Reference Links

Thanks guys for the feedback, I have worked it out, mistake on my 
part (and not the first one) From here I can continue!

Buy = Cross( MACD(), Signal() );
Sell = 0;
SellPrice = Close;

profitline = Null;
priceatbuy = 0;

for( i = 0; i < BarCount; i++ )
{
	if( priceatbuy == 0 AND Buy[ i ] )
	{
		priceatbuy = BuyPrice[ i ];
	}
	else  Buy[ i ] = 0;

	if( priceatbuy > 0 AND SellPrice[ i ] > 1.2 * priceatbuy )
	{
		Sell[ i ] = 1;
		SellPrice[ i ] = 1.2 * priceatbuy;
		priceatbuy = 0;
	}
	else Sell[ i ] = 0;

	if( priceatbuy > 0 )
        {   
		profitline[ i ] =  1.2 * priceatbuy;
        }
 
}

Plot(C,"Close", colorBlack, styleBar );
Plot(profitline,"Target",colorBlue);

PlotShapes(Buy*shapeUpArrow,colorBrightGreen,0,Low);
PlotShapes(Sell*shapeDownArrow,colorRed,0,High);



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

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/