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

[amibroker] Please Help with CustomBacktest!



PureBytes Links

Trading Reference Links

Hi,

I am Steve from Austria. I have written a small system and I want to
implement moneymanagment. The idea is:
1) set amount to risk to 1% of actual equity (if there was a losing
trade before) or 2% of actual equity (if there was a winning trade before)
2) buy amount to risk/ATR(14)*buyprice (how can I do this in
CustomBacktest?)
3) set trailing stopp to 2*ATR(14) for the first three days of trade
and from fourth day on trail with ATR(14)

All I got running in CustomBacktest was the example system which
allows to decrease percent positionsize if actuql equity is smaller
than max equity):

// small system

PositionScore = ROC(14);

Buy = C>=MA(C,60);
Sell = C<MA(C,60) OR Cross(MA(C,30),MA(C,5));


SetOption("UseCustomBacktestProc",True);
SetCustomBacktestProc("");
if( Status("action") == actionPortfolio )
{
bo = GetBacktesterObject();
bo.PreProcess();
	 MaxEquity = 0;
    for(bar = 0; bar < BarCount; bar++ )
	{
		CurrentPortfolioEquity = bo.Equity;
		MaxEquity = IIf(CurrentPortfolioEquity > MaxEquity,
CurrentPortfolioEquity, MaxEquity);

	   for( sig = bo.GetFirstSignal(bar); sig; sig = bo.GetNextSignal(bar) ) 
    	{ 
        sig.PosSize = IIf(CurrentPortfolioEquity>=MaxEquity,-50,-25);
		 
		}
		bo.ProcessTradeSignals( bar );
	}
	bo.PostProcess();


I would be nice if someone could give me a little help. I have really
no idea what to do in CustomBacktest.

Thanks.

Greetings fro Austria
Steve
 



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/