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

Re: [amibroker] Re: customization of backtesting results



PureBytes Links

Trading Reference Links



Hi Mike or anybody else,

I know how to add custom metric. I added postionscore and some other column that I calculate by myself. These values are different per ticker I want to add other column but I need to use C, MA(C,5) etc

My question is how I can add metric like

trade.AddCustomMetric("MA", MA(C,5)); or
trade.AddCustomMetric("my own formula", MA(ref(C,-3),5));

I backtest against portfolio.

I have workaround for that. To see the values I want to see from exploration but it is not good at all.

I hope it is more clear now.

Thank you again.

Radek

On Sun, Apr 12, 2009 at 8:09 AM, Mike <sfclimbers@xxxxxxxxx> wrote:


Radek,

Adding a column to the backtest report is described in the user guide:

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/





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

__,_._,___