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

[amibroker] Re: customization of backtesting results



PureBytes Links

Trading Reference Links

Radek,

Adding a column to the backtest report is described in the user guide:
http://www.amibroker.com/guide/a_custommetrics.html

However, it is not clear what you want the value to be. Your calculation applies to a single symbol. What do you want to display when you are backtesting a portfolio of multiple symbols?

If you only plan to backtest against a single symbol at a time, then you have 2 choices:

1. Use AddToComposite in your system.afl to save your calculation to an artificial symbol, then use Foreign from your custom_backtesting.afl to read the values from that artificial symbol.

http://www.amibroker.com/guide/afl/afl_view.php?name=addtocomposite
http://www.amibroker.com/guide/afl/afl_view.php?id=54

2. Use SetForeign/RestorePriceArrays in your custom_backtesting.afl to perform the calculation on the actual symbol.

http://www.amibroker.com/guide/afl/afl_view.php?id=247
http://www.amibroker.com/guide/afl/afl_view.php?id=248

I believe that you can only control the column order of custom metrics relative to each other. All custom columns still must come after the default columns. I haven't played with that yet, but Tomasz mentioned it in a post on this forum a little while ago.

Mike

--- In amibroker@xxxxxxxxxxxxxxx, Radek Simcik <radek.simcik@xxx> wrote:
>
> Hi Mike,
> 
> below is what I wanted to do. It is working fine. Thank you.
> 
> Could you help me to code this:
> 
> Have new column in backtesting result window that would be my own variable.
> And it would look like MA(ROC(Ref(C,-1),1),5)
> 
> Is there any easy way? Could it be let's say the fourth column?
> 
> Thank you,
> 
> Radek
> 
> >
> > If you are planning on having many custom backtest implementations, but few
> > systems, then you can update System.afl to #include whichever custom
> > backtest you want to test, then run the Ssytem.afl script. Any variables
> > required by the custom backtester would be expected to be passed as
> > procedure parameters.
> >
> > System.afl
> >
> > *#include* <CustomBacktest.afl>
> >
> > *Buy* = DayOfWeek() == 1;
> > *Sell* = DayOfWeek() == 5;
> > MyBackTestVar = *true*;
> >
> > SetCustomBacktestProc("");
> >
> > *if* (Status("action") == *actionPortfolio*) {
> >    RunCustomBackTest(MyBackTestVar);
> > }
> >
> > Custom_Backtesting.afl
> >
> > *procedure* RunCustomBackTest(Var) {
> >    *if* (Var) {
> >       _TRACE("Var was true.");
> >    } *else* {
> >       _TRACE("Var was false.");
> >    }
> >
> >    bo = GetBacktesterObject();
> >    bo.Backtest();
> >
> >    // Add custom metrics here...
> > }
> >
> > Mike
> >
> >
> >
>




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

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

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/