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

[amibroker] How to Get() Custom Indicator name for Title statement



PureBytes Links

Trading Reference Links

TIA
Sid

PS: As you might have guessed, I am looking for some code to run 
autocorrelation tests on the market.


/* AUTOCORRELATION FUNCTION */

// Logarithmic return
  X = log(C/Ref(C,-1));

  // Mean
  MX = LastValue(Cum(X)/Cum(1));

// Variance
  ACF0 = LastValue(Cum((X-MX)*(X-MX))/Cum(1));

  // Autocorrelation from lag 1 to 40, normalised to variance
  ACF1 = LastValue(Cum((X-MX)*(Ref(X,-1)-MX))/(ACF0*Cum(1)));
  ACF2 = LastValue(Cum((X-MX)*(Ref(X,-2)-MX))/(ACF0*Cum(1)));
  ACF3 = LastValue(Cum((X-MX)*(Ref(X,-3)-MX))/(ACF0*Cum(1)));
.
.
.
ACF38 = LastValue(Cum((X-MX)*(Ref(X,-38)-MX))/(ACF0*Cum(1)));
  ACF39 = LastValue(Cum((X-MX)*(Ref(X,-39)-MX))/(ACF0*Cum(1)));
  ACF40 = LastValue(Cum((X-MX)*(Ref(X,-40)-MX))/(ACF0*Cum(1)));

  // Store autocorrelation function in the last 40 bars
  ACF = 0;
  ACF = IIf(Cum(1)==LastValue(Cum(1)),ACF1,ACF);
  ACF = IIf(Cum(1)==LastValue(Cum(1))-1,ACF2,ACF);
.
.

  ACF = IIf(Cum(1)==LastValue(Cum(1))-37,ACF38,ACF);
  ACF = IIf(Cum(1)==LastValue(Cum(1))-38,ACF39,ACF);
  ACF = IIf(Cum(1)==LastValue(Cum(1))-39,ACF40,ACF);
  ACF = 100*ACF;

  // Significance bands
  Sigma = 100*LastValue(Cum(1))^(-0.5);

  GraphXSpace=5;
  Graph0=ACF;Graph0Style=2+4;Graph0Color=3;
  Graph1=2*Sigma; Graph1Style=1; Graph1Color=2;
  Graph2=-2*Sigma; Graph2Style=1; Graph2Color=2;


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 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:
     http://docs.yahoo.com/info/terms/
 


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.551 / Virus Database: 343 - Release Date: 12/11/2003