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 [email protected], "sfclimbers" <sfclimb...@...> 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 [email protected], "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 [email protected], "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
> > >
> >
>


Reply via email to