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

[amibroker] Re: Probability for the Student t-distribution (TDIST Excel function)


  • Date: Fri, 15 Jan 2010 09:45:02 -0000
  • From: "vlanschot" <vlanschot@xxxxxxxxx>
  • Subject: [amibroker] Re: Probability for the Student t-distribution (TDIST Excel function)

PureBytes Links

Trading Reference Links

Indeed, as it is for all non-native AFL stats & math functions.

In this case, the R-function is called t.test.

See http://finance.groups.yahoo.com/group/amibroker/message/129240

PS

--- In amibroker@xxxxxxxxxxxxxxx, James <jamesmemphis@xxx> wrote:
>
> I am late to this thread and have not used it (meaning I should shut up), but wouldn't the R-math plug-in be perfect for this type of stuff?
> 
> 
> 
> 
> ________________________________
> From: Mike <sfclimbers@xxx>
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Thu, January 14, 2010 4:17:18 PM
> Subject: [amibroker] Re: Probability for the Student t-distribution (TDIST Excel function)
> 
>   
> Might be easiest to just read in a table from which to do the lookup. Otherwise the math for the "p-value" can be found here:
> 
> http://www.danielsoper.com/statkb/topic08.aspx
> 
> Mike
> 
> --- In amibroker@xxxxxxxxx ps.com, "Diz" <ground@> wrote:
> >
> > Thank you for your response.
> > 
> > I've already managed to calculate t-test (tstat) in a similar way. What I'm trying to do now is to calculate probability itself.
> > 
> > Denis.
> > 
> > --- In amibroker@xxxxxxxxx ps.com, "mkecera" <mkecera@> wrote:
> > >
> > > Well, 
> > > 
> > > I have a custom backtest code with tstat as performance metric. Maybe you can use that as starting point. But check it carefully as I havent used it for a while and just copy/pasted it.
> > > 
> > > /* First we need to enable custom backtest procedure and 
> > > ** tell AmiBroker to use current formula 
> > > */ 
> > > 
> > > SetCustomBacktestPr oc(""); 
> > > 
> > > if( Status("action" ) == actionPortfolio ) 
> > > { 
> > > 
> > > bo = GetBacktesterObject (); 
> > > bo.Backtest( ); // run default backtest procedure 
> > > st = bo.GetPerformanceSt ats(0); // get stats for all trades 
> > > 
> > > Sumx=0;
> > > smx2=0;
> > > 
> > > for( trade = bo.GetFirstTrade( ); trade; trade = bo.GetNextTrade( ) ) 
> > > { 
> > > x = trade.GetProfit( );
> > > sumx+=x;
> > > smx2+=x*x;
> > > }
> > > 
> > > xpriem=st.GetValue( "AllAvgProfitLos s");
> > > x2priem=smx2/ st.GetValue( "AllQty") ;
> > > xpriem2=st.GetValue ("AllAvgProfitLo ss")^2;
> > > standarddeviation= sqrt(x2priem- xpriem2);
> > > 
> > > tstat = (xpriem/standarddev iation)/sqrt( st.GetValue( "AllQty") )*1000000; //multiplied to be seen in report 
> > > //custom = st.GetValue( "netprofit" )*st.GetValue( "kratio") ;
> > > 
> > > bo.AddCustomMetric( "tstat", tstat );
> > > //bo.AddCustomMetri c( "custom", custom ); 
> > > } 
> > > 
> > > Regards,
> > > 
> > > MK
> > > 
> > > // your trading system here 
> > > 
> > > --- In amibroker@xxxxxxxxx ps.com, "diznyc@" <ground@> wrote:
> > > >
> > > > Hello all,
> > > > 
> > > > What is the best (easiest) way to calculate probability for the Student t-distribution in AFL (analog of TDIST Excel function)?
> > > > 
> > > > Is it possible to call Excel function somehow from AFL or other external statistical library?
> > > > 
> > > > Thank you in advance,
> > > > 
> > > > Denis.
> > > >
> > >
> >
>




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

**** 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:
    amibroker-digest@xxxxxxxxxxxxxxx 
    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/