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

RE: [amibroker] Custom Trade Metrics



PureBytes Links

Trading Reference Links

the problem is with this line "HVtrade = 100* StDev(log(C/Ref(C,-1)),100)*sqrt(250);
you need to get the trade symbol and then use foreign to get the price array before doing your calculaltion
 

Paul Ho

 



From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of C Alvarez
Sent: Saturday, 18 June 2005 4:21 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Custom Trade Metrics

I am trying to add the custom metric of what the Historical
Volatility was when the trade was entered.

I tried the following code, but all I get are blanks. Do we not have
access to the price arrays? Or what am I doing wrong?

Thank you,
Cey

Here is the code:
SetCustomBacktestProc("");
if( Status("action") == actionPortfolio )
{
   bo = GetBacktesterObject();
   bo.Backtest(1);
   for(trade=bo.GetFirstTrade(); trade; trade=bo.GetNextTrade())
   {
           HVtrade = 100* StDev(log(C/Ref(C,-1)),100)*sqrt(250);
         trade.AddCustomMetric("HV", HVtrade);
   }
    bo.ListTrades();
}





Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





Yahoo! Groups Links