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

[amibroker] Portfolio Backtest



PureBytes Links

Trading Reference Links




Try 
the code below, note i limited the looping to the last 30 bars, otherwise it 
takes forever on my computer :-) You can uncomment the Trace statements to see 
how it loops through your array - if you have DebugView [ <A 
href="">http://www.sysinternals.com/ntw2k/freeware/debugview.shtml ] 
installed, I highly recommend it.
<SPAN 
class=140011314-24042004> 
<SPAN 
class=140011314-24042004>herman
<SPAN 
class=140011314-24042004> 



Period=Param("Period", 
40,3,200);
 
<FONT face=Arial color=#0000ff 
size=2>Momentum=(C-Ref(C,-period))/(period-1);PCI=0;
 
NumBarsTested = 30;//for 
(i=Period-1;i<BarCount-1;i++)for 
(i=BarCount-1-NumBarsTested;i<BarCount-1;i++){<SPAN 
class=140011314-24042004>// _TRACE("#i="+NumToStr(i,1.0));   
DUP[i]=0;   DDOWN[i]=0;   for 
(j=i;j>i-period;j--)   {<SPAN 
class=140011314-24042004>//  _TRACE("  
#j="+NumToStr(j,1.0));      
T=C[i-period+1]+(j-i+period-1)*Momentum[i];   
      
if(C[j]>T)        
DUP[i]=DUP[i]+C[j]-T;      
if(C[j]<T)        
DDOWN[i]=DDOWN[i]+T-C[j];
 
   }  
PCI[i]=DUP[i]/(DUP[i]+DDOWN[i])*100;}
 
<FONT face=Arial color=#0000ff 
size=2>Plot(C,"C",colorBlack,styleCandle|styleOwnScale);Plot(PCI,"PCI",colorBlue,styleThick);
 




  <FONT face=Tahoma 
  size=2>-----Original Message-----From: jfk_92 
  [mailto:jfk_92@xxxxxxxxx]Sent: Saturday, April 24, 2004 9:48 
  AMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Help 
  on customerized indicator plottingI have a 
  customerized indicator as follows. I have the difficulty to plot the 
  indicator "PCI". Thanks for the 
  suggestion.=============================Period=Param("Period", 
  40,3,200);Momentum=(C-Ref(C,-period))/(period-1);PCI=0;for 
  (i=Period-1;i<=BarCount-1;i++){   
  DUP[i]=0;   DDOWN[i]=0;   for 
  (j=i;j<=i-period+1;j--)   {      
  T=C[i-period+1]+(j-i+period-1)*Momentum[i];   
        
  if(C[j]>T)        
  DUP[i]=DUP[i]+C[j]-T;      
  if(C[j]<T)        
  DDOWN[i]=DDOWN[i]+T-C[j];   }  
  PCI[i]=DUP[i]/(DUP[i]+DDOWN[i])*100;}Plot(C,"C",colorBlack,styleCandle|styleOwnScale);Plot(PCI,"PCI",colorBlue,styleThick);Send 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html








Yahoo! Groups Sponsor


  ADVERTISEMENT 












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 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.