| 
 PureBytes Links 
Trading Reference Links 
 | 
 I suggest you try the following 
SetCustomBacktestProc("");  /* Now custom-backtest procedure follows 
*/  if( Status("action") == actionPortfolio )  {      bo 
= GetBacktesterObject();      bo.Backtest(1); // run default 
backtest procedure     for(trade=bo.GetFirstTrade(); trade; 
trade=bo.GetNextTrade())     {        
sym = trade.Symbol();       myC = Foreign(sym, 
"C" );       HVtrade = 100* 
StDev(log(myC/Ref(myC,-1)),100)*sqrt(252);       trade.AddCustomMetric("HV", 
HVtrade );    }      bo.ListTrades();  } 
  
  
Paul 
Ho 
   
The HV column has all blanks in it.
  Thanks for the help. 
Here is the 
formula.
  Cey
  ////////////////////////////////////////////////////
  SetCustomBacktestProc(""); 
 /* Now custom-backtest procedure follows */  if( Status("action") == 
actionPortfolio )  {      bo = GetBacktesterObject(); 
     bo.Backtest(1); // run default backtest procedure 
    for(trade=bo.GetFirstTrade(); trade; trade=bo.GetNextTrade()) 
    {        sym = 
trade.Symbol();       SetForeign(sym 
);       HVtrade = 100* 
StDev(log(C/Ref(C,-1)),100)*sqrt(252);       
RestorePriceArrays();       
trade.AddCustomMetric("HV", HVtrade );    }      
bo.ListTrades();  }  // trading system here  Buy = MA(C,50) > 
MA(C,200) AND C >MA(C,200); Sell = C < MA(C,200);
  Buy = 
ExRem(Buy,Sell); Sell = ExRem(Sell, Buy);
  --- In 
amibroker@xxxxxxxxxxxxxxx, "Paul Ho" <paultsho@xxxx> wrote: > Can 
you post your formula and results? >   > Paul Ho > 
 >   >  >   _____   >  > From: 
amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]  On 
Behalf > Of C Alvarez > Sent: Saturday, 18 June 2005 1:17 PM > 
To: amibroker@xxxxxxxxxxxxxxx > Subject: [amibroker] Re: Custom Trade 
Metrics >  >  > I added the SetForeign call and the HV formula 
still does not  work.  > Is this something that I need to calculate 
manually?  > Any more help? >  > Thanks, > Cey > 
 > --- In amibroker@xxxxxxxxxxxxxxx, "Paul Ho" <paultsho@xxxx> 
wrote: > > 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 > 
>  > >  > >  > >  > >  > 
>   _____   > >  > > Yahoo! Groups 
Links > >  > >  > > *      
To visit your group on the web, go to: > > http://groups.yahoo.com/group/amibroker/ > 
>    > >  > > *      To 
unsubscribe from this group, send an email to: > > 
amibroker-unsubscribe@xxxxxxxxxxxxxxx > > 
<mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx? subject=Unsubscribe> 
 > >    > >  > > 
*      Your use of Yahoo! Groups is subject to the 
Yahoo! Terms  of  > Service > > <http://docs.yahoo.com/info/terms/> 
. >  >  >  >  > 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 >  >  > 
*      To visit your group on the web, go to: > 
http://groups.yahoo.com/group/amibroker/ >   
 >  > *      To unsubscribe from this 
group, send an email to: > amibroker-unsubscribe@xxxxxxxxxxxxxxx > 
<mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe> 
 >    >  > *      Your use 
of Yahoo! Groups is subject to the Yahoo! Terms of  Service > <http://docs.yahoo.com/info/terms/> 
.
 
 
 
  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 
 |