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

Re: [amibroker] Plotting historical portfolio backtest metrics in INDICATOR



PureBytes Links

Trading Reference Links

Hello,

As far as concatenated OOS is considered, things depend on which metrics
do you really want.
That is so because some metrics accumulate nicely so
you can simply add them up (either using AddToComposite or
just adding multiple Foreign() calls).

Some metrics are derived directly from equity (Drawdown, sharpe ratio, UlcerIndex)
and can be calculated directly using plain AFL formula working on
IS or OOS equity.

For example CAR/MDD for out-of-sample test OOS:

Symbol = "~~~OSEQUITY"; // change the ticker to your preference

eq =
Foreign( Symbol, "C"
);

if( Name() != Symbol ) Title = "You should change symbol to "
+ Symbol;

function
TotalDays()
{
 yy =
Year
();
 dy =
DayOfYear
();
 LastLeapYear = (yy %
4) == 1 && yy != 2001
;
 YearChg = yy !=
Ref(yy, -1
);
 YearChg =
IIf(IsNull(YearChg), False
, YearChg);
 YearLen =
IIf(YearChg, IIf(LastLeapYear, 366, 365), 0
);
 return Cum(YearLen) + dy - dy[0
];
}

dr =
100 * ( eq/Highest(eq) - 1
);
profit =
100 * ( eq/eq[0] - 1
);

td = TotalDays();
Days = td[
BarCount - 1 ] - td[ 0
];

Car =
100 * ( ( eq / eq[ 0 ] ) ^ ( 365 / Days ) - 1
);

//Plot( dr, "DD%", colorRed );

//Plot( Lowest(dr), "Max DD%", colorBlue );

//Plot( profit, "Profit %", colorGreen );

//Plot( Car, "CAR", colorDarkGreen );


Plot( Car/Highest( -dr ), "CAR/MDD", colorOrange );

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "Thomas Ludwig" <Thomas.Ludwig@xxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, May 19, 2008 12:02 PM
Subject: Re: [amibroker] Plotting historical portfolio backtest metrics in INDICATOR


> TJ,
>
> thanks a lot - very helpful!
>
> However, I'd be happy if you could also present a solution how do do
> something similar for the concatenated IS and OOS equity curves in a WF
> test - see my posts #123921 and 123945. I don't think this can be done
> with the custom backtester.
>
> Best regards,
>
> Thomas
>
>
>> Hello,
>>
>> To show you how easy it is to actually PLOT ANY portfolio backtest
>> metric as a historical series in INDICATOR, without using script, OLE
>> - just PURE AFL I prepared this:
>>
>> http://www.amibroker.com/kb/2008/05/19/historical-portfolio-backtest-
>>metrics/
>>
>> This addresses the following goals:
>> a) having ANY portfolio backtest metric available as historical
>> series for use ANYWHERE (in indicator or wherever) b) plotting
>> backtest metrics in INDICATORS and doing this FAST (without constant
>> recalculation) c) using only pure AFL for that
>>
>> Best regards,
>> Tomasz Janeczko
>> amibroker.com
>>
>> ------------------------------------
>>
>> 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
>>
>>
>>
>
>
> ------------------------------------
>
> 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/
>
__._,_.___

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




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___