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

RE: [amibroker] Re: System Performance Indicators [was: Can someone fix this OLE code?]



PureBytes Links

Trading Reference Links

As a followup …

 

If you for example look at the AFL below, what it should produce and what it actually does produce you’ll see that:

 

-          The equity curve that results from running a backtest gets exported as one would think in should.

-          However, the output Trade List which is also a byproduct of running a backtest only exports the column headings when one attempts to do it via what would be OLE/Automation commands that more appropriately belong in something external to AB.

 

This is not a complaint per se, it’s simply what is …

 

Len1 = Optimize("Len1", 13, 1, 100, 1);

Len2 = Optimize("Len2", 23, 1, 100, 1);

 

EMA1 = EMA(C, Len1);

EMA2 = EMA(C, Len2);

 

Buy  = Cross(EMA1, EMA2);

Sell = Cross(EMA2, EMA1);

 

OPEquity = Foreign("~~~Equity", "C");

 

Beg  = LastValue(ValueWhen(Status("FirstBarInRange"), BarIndex()));

End  = LastValue(ValueWhen(Status("LastBarInRange"), BarIndex()));

 

yyyy = Year();

mm   = Month();

dd   = Day();

 

fh   = fopen("C:\\Program Files\\AmiBroker\\Equity.CSV", "w");

 

fputs("Date,Equity,\n", fh);

 

for ( i = Beg; i <= End; i++ )

 

{

    Line = "";

    Line = Line + StrFormat("%02.0f", mm[i]) + "/" + StrFormat("%02.0f", dd[i]) + "/" + StrFormat("%4.0f", yyyy[i]) + ",";

    Line = Line + StrFormat("%.5f", OPEquity[i]) + ",";

    Line = Line + "\n";

    fputs(Line, fh);

}

 

fclose(fh);

 

AB = CreateObject("Broker.Application");

AA = AB.Analysis;

AA.Export("Trades.CSV");

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Fred Tonetti
Sent: Sunday, May 18, 2008 12:23 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Re: System Performance Indicators [was: Can someone fix this OLE code?]

 

I see both sides of the discussion so maybe I can add something to bridge the gap …

 

While I agree with TJ that, as presented in the backtest report or AA in an optimization output line, system performance metrics are scalars i.e. single numbers as of the end of some backtest or some single combination of parameter values from an optimization, one could via the symbol ~~~Equity look at these as an array of values that can be evaluated bar by bar …

 

For example Net Profit has a value all along the array represented by the ~~~Equity symbol.

 

If one also needs to be able to have available Trade based performance metrics then one would also have to have available to them the list of Trades from a backtest so that as of some particular bar one could calculate whatever performance metric(s) one was interested in …

 

There are undoubtedly many uses for this sort of information one of which I touched on briefly the other day i.e. When during the OOS period should we programmatically decide that our system needs to be reoptimized and as result WF our IS to that point and do so …

 

While I have done these sorts of things that are described above in IO and other places, I would add that I have not for the most part done them directly in AFL because as TJ states you may very well not get what you are looking for.

 

If this is the kind of thing you are after it is not that difficult to do …

 

From an external script it is relatively simple to:

 

-          Run a backtest … This yields the Trade List which can be exported from AA to a CSV file.  

-          It also yields the equity curve in the symbol ~~~Equity which can be easily exported via a “manufactured” AFL i.e. have the script create the AFL, load it and run it. 

-          This then provides in two CSV files everything that one needs to calculate any and all performance metrics one is interested in bar by bar.  

-          The results of these calculations can be used to drive indicators in AB or as all or part of a decision making process about what actions to perform in some other type of AFL in AB.

 


From: amibroker@xxxxxxxxxps.com [mailto:amibroker@xxxxxxxxxps.com] On Behalf Of Tomasz Janeczko
Sent: Sunday, May 18, 2008 10:58 AM
To: amibroker@xxxxxxxxxps.com
Subject: Re: [amibroker] Re: System Performance Indicators [was: Can someone fix this OLE code?]

 

You guys don't get it at all.

 

Most metrics are SCALARS (single number) !

Your plots will look like this:

 

Plot( 0.8, "Sharpe Ratio", colorRed );

 

These metrics DO NOT CHANGE over time because they are all calculated ONCE when backtest is complete

and result is single number (scalar), *not* array.

 

Best regards,
Tomasz Janeczko
amibroker.com

----- Original Message -----

From: Phsst

Sent: Sunday, May 18, 2008 3:36 PM

Subject: [amibroker] Re: System Performance Indicators [was: Can someone fix this OLE code?]

 

Herman,

Your case for System Performance Indicators is a good one.

A further idea...  there should be no need for User code to accomplish this. The plots should be a native feature of AB (just like the Equity plot).

Instead of plotting "flat lines" for single numbers, gfx Horizontal plots of each performance metric could be presented against a "good / bad scale" defined in the form of a Param value for each performance metric that the User could alter from a base set of default values. Of course the gradient colors of the plots would go from red (bad) to green (good).

For example, the default Param for Sharpe Ratio could be 1.00, and some Users might want to use  .80 as a Param value where the gradient color starts changing to green.

My two cents worth.




 


I am using the free version of SPAMfighter for private users.
It has removed 455 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!



I am using the free version of SPAMfighter for private users.
It has removed 455 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
__._,_.___

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

__,_._,___