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

[amibroker] Output # Open Positions in Backtest



PureBytes Links

Trading Reference Links

I'm new to AFL and still trying to figure out the ins & outs.  I'm 
trying to get my Backtest report to print a column for each trade 
that gives the number of open positions.

I tried the following, but it only outputs on the "Reports" page 
versus on the "Results" page where I can see for every trade how 
many positions are open at that time:

if( Status("action") == actionPortfolio ) 
{ 
    bo = GetBacktesterObject(); 
	bo.preprocess();
	for( bar = 0; bar < BarCount ; bar++ )
	{
	for( sig = bo.GetFirstSignal(bar) ; sig ; sig 
=bo.GetNextSignal(bar) )
	{
	if( sig.IsEntry() )  CurrentOpenPos = CurrentOpenPos + 1;
	if( sig.IsExit() )  CurrentOpenPos = CurrentOpenPos - 1;
	if( CurrentOpenPos > MaxOpenPos ) MaxOpenPos = 
CurrentOpenPos;
	bo.AddCustomMetric("Open Pos", CurrentOpenPos  );  
			}
		
	}
	bo.PostProcess();






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Everything you need is one click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/AHchtC/4FxNAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

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