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

[amibroker] Custom Backtest used to Determine Expectancy - Help Please - Item [#25350]



PureBytes Links

Trading Reference Links

On December 3, 1005, I asked AmiBroker Support for help with the 
following.  Since then, I have received 3 emails from Marvin stating 
that he needs help from Tomasz.  The first of these emails, dated 
December 9, 2005, is below along with my original request for help.  
So far, AmiBroker Support has not been able to help. I even wrote 
Tomasz directly on two occasions and can only assume that they are 
overbooked.  In any case, I would appreciate help/direction on how to 
modify the following Custom BackTest for Expectancy so that the 
formula adjusts Expectancy to recognize each trade's leverage level.  
My thinking is that if one can get at the PositionSize for each 
trade, then one can simply divide this by 100 to get the leverage.  
Please help if you can and thanks!!

Bert

// -------------------------------------------------------------------
//  Custom Backtest for Expectancy
// -------------------------------------------------------------------
SetCustomBacktestProc(""); 

/* Now custom-backtest procedure follows */ 

if( Status("action") == actionPortfolio ) 
{ 
    bo = GetBacktesterObject(); 

    bo.Backtest(); // run default backtest procedure 

    st = bo.GetPerformanceStats(0); // get stats for all trades 

    expectancy = st.GetValue("WinnersAvgProfitPercent") * st.GetValue
("WinnersPercent")/100 + 
                st.GetValue("LosersAvgLossPercent") * st.GetValue
("LosersPercent")/100; 

    // Here we add custom metric to backtest report 
    bo.AddCustomMetric( "Expectancy (%)", expectancy ); 
}

************************************************************
Reply from Marvin on December 9, 2005

Hello,

I am sorry for the delay - we are a bit loaded with the support (and 
I was off for one day).
I'll try to analyse and answer the question till the end of the 
weekend - I may need to consult it with Tomasz to make sure that the 
answer is 100% correct, since the question you rised concerns 
advanced backtester interface. Thank you for your patience.

Best regards

Marcin Gorzynski
Amibroker.com Technical Support


----- Original Message ----- 
From: "Bert Steele" <bisteele@xxxxxxxxxxxxx>
To: "AMIBROKER SUPPORT" <SUPPORT@xxxxxxxxxxxxx>
Sent: Thursday, December 08, 2005 7:44 PM
Subject: FW: Custom Backtest used to Determine Expectancy - Help 
Please - 
Item [#25350]


> Hello,
>
> I would appreciate help with #25350 sent on 12/03/05.
>
> Thank you.
>
> Bert Steele
>
> -----Original Message-----
> From: Bert Steele [mailto:bisteele@xxxxxxxxxxxxx]
> Sent: Saturday, December 03, 2005 5:25 PM
> To: AMIBROKER SUPPORT
> Subject: Custom Backtest used to Determine Expectancy - Help Please
>
>
> Hello,
>
> I would like to use Custom Backtest to calculate Expectancy using
> the following with ONE difference.
>
> SumProfitPer100Inv = SumProfitPer100Inv + trade.GetPercentProfit();
>       NumTrades++
>
> That is, I would like to multiply the PercentProfit by the leverage
> WHICH RANGES FROM 1.00 TO 2.00 depending on the Ticker used.  So,
> something like the following.
>
> SumProfitPer100Inv = SumProfitPer100Inv + trade.GetPercentProfit() *
> Leverage;
>       NumTrades++
>
> How do I do this in Custom Backtest?  Is there a 
trade.GetPositionSize as I could use it to get leverage?  I can not 
find anything that allows me to adjust for leverage REALIZING that 
leverage ranges from 1.0 to 2.0 depending on the ticker selected from 
the Watchlist or more accurately depending on the PositionSize that
> the afl uses which ranges from -100 to -200 in the afl.
>
> Help please.
>
> Bert





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/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/