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

[amibroker] Re: help with custom metric



PureBytes Links

Trading Reference Links

Thanks for help!

As far as the interpretation of the article is considered I'll study it again to make sure. Nevertheless your code is very helpful since most of all it's the way of summation that has concerned me.

--- In amibroker@xxxxxxxxxxxxxxx, "sfclimbers" <sfclimbers@xxx> wrote:
>
> 
> Hi,
> 
> The following is what you have asked for. But, I don't think that it is
> what the article is suggesting. My interpretation of the article is that
> TRi is the change in equity from each bar to the next. In other words, N
> is supposed to be the number of bars, and TRi is supposed to be the rate
> of change from the previous bar.
> 
> fast = MA( Close, 5 );
> slow = MA( Close, 25 );
> 
> Buy = Cross( fast, slow );
> Sell = Cross( slow, fast );
> 
> SetCustomBacktestProc( "" );
> 
> if ( Status( "action" ) == actionPortfolio )
> {
>      bo = GetBacktesterObject();
>      bo.Backtest();
> 
>      summation = 0;
>      trades = 0;
> 
>      for ( trade = bo.getFirstTrade(); trade; trade = bo.getNextTrade() )
>      {
>          summation += ( ( 1 + trade.getProfit() ) ^ -3 );
>          trades++;
>      }
> 
>      bo.AddCustomMetric( "AIRAP", ( ( summation / trades ) ^ ( -1 / 3 ) )
> - 1 );
> }
> 
> Mike
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "tf28373" <tomfid@> wrote:
> >
> > Hi again!
> >
> > Any ideas about following message?
> >
> > PS I forgot that text editor would not accept greek characters when
> writing first mail. Therefore every "O" symbol in the previous message
> means in fact greek "sigma" - a math symbol for a sum. Sorry for the
> inconvinience.
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "tf28373" tomfid@ wrote:
> > >
> > >
> > > Hi!
> > >
> > > I've been trying to add custom metric to backtester and optimization
> > > funcionalities called AIRAP
> > >
> <http://www.futures.pl/res_tmp/Hedge%20Quest%20-%20Summer%202005.pdf>
> > > (Alternative Investment Risk Adjusted Performance), which is
> composed as
> > > follows:
> > >
> > > AIRAP = [ Ó (( 1 + TRi ) ^ (-3))/N ] ^ ( -1/3 ) -1, where TRi is
> > > i-th trade profit and N is number of trades.
> > >
> > > I've come to following code:
> > >
> > > SetCustomBacktestProc("");//AIRAP
> > >
> > > if(Status("action")==actionPortfolio)
> > >
> > > {bo=GetBacktesterObject();
> > >
> > > bo.Backtest();
> > >
> > > st=bo.GetPerformanceStats(0);
> > >
> > > airap=
> > >
> > > ((1+st.GetValue("NetProfit")^(-3))
> > >
> > > /st.GetValue("AllQty")
> > >
> > > )^(1/(-3))-1;
> > >
> > > bo.AddCustomMetric("AIRAP",airap);}
> > >
> > > However I don't know how to include the sum of this equation part:
> (( 1
> > > + TRi ) ^ (-3))/N , in other word I cannot implement "Ó". I've
> been
> > > trying to achieve that using <sum()> function, without success
> though.
> > >
> > > Can you show me some way to transcript AIRAP equation into AFL?
> Maybe
> > > there is some part of User Guide dealing with this issue which I've
> > > overlooked or some papers on that in Knowledge Base?
> > >
> > > I will be grateful for any advice or trace :)
> > >
> > > Regards
> > >
> > > Tomasz
> > >
> >
>




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

**** 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/