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

[amibroker] Re: How to avoid MaxOpenPosition using custom backtest procedure



PureBytes Links

Trading Reference Links

Well, I thought it was a rather simple question..
The problem is that the Custom Backtest Interface is a hard matter to 
learn.
Does anybody know any paper or document where I could find code 
axamples made in the Custom Backtest Interface?, in order to 
understand it and programm my own code...

any answer will be appreciated..

greetings

--- In amibroker@xxxxxxxxxxxxxxx, "gonzagags" <gonzagags@xxx> wrote:
>
> Hello
> I have a system that buy shares in portfolio mode, 3 shares 
> maxpositions, in EOD signals
> But if the stoploss sell a share within a day, the system in 
backtest 
> show that would have bought another share in open time, which is not 
> possible cause it don't know that one share is going to be sold 
within 
> that day
> 
> To prevent it, I have tried the custom backtest procedure, but it 
> doesn't work. Someone know how to make this possible?
> 
> This is the code I have tried and that don't change any trade in my 
> backtest results..:
> SetOption("UseCustomBacktestProc", True );
> 
> if( Status("action") == actionPortfolio )//phase Custom Backtest 
> Interface
> {
> 	bo = GetBacktesterObject();
> 	bo.PreProcess();
> 	Cnt = 0;
> 	for( openpos = bo.GetFirstOpenPos(); openpos; openpos = 
> bo.GetNextOpenPos() )
> 	{
> 		Cnt++;
> 	}
> 	for( bar = 0; bar < BarCount; bar++ )
> 	{
> 		for( sig = bo.GetFirstSignal( bar ); sig; sig = 
> bo.GetNextSignal( bar ) )
> 		{
> 			if( Cnt >=3 ) sig.Price = -1; // exclude	
> 		}
> 		bo.ProcessTradeSignals( bar );
> 	}
> 	bo.PostProcess();
> }
> 
> Any suggestions?
>




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

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL 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/