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

RE: [amibroker] Need code help



PureBytes Links

Trading Reference Links

The VLB needs to be a value, not an array. So use Lastvalue
CORR = Correlation(ROC(FUND,1),ROC(INDEX,1),LastValue(VLB));

Cheers,
Graham
http://groups.msn.com/ASXShareTrading
http://groups.msn.com/FMSAustralia


-----Original Message-----
From: Gary Serkhoshian [mailto:serkhoshian777@xxxxxxxxx] 
Sent: Friday, 29 August 2003 7:37 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Need code help


I'm reposting because I think  I confused everyone with my 
terminology.

How can I get the following code to work.  The correlation function 
at the bottom of the code is giving a syntax error when I use a 
variable in the length.


SIG = Foreign("~SIGNAL","C");
FUND = C;
INDEX = Foreign("$RUT","C");

BARSTART = ValueWhen(SIG == 1 AND Ref(SIG != 1,-1),BarIndex(),3); VLBRAW =
BarIndex() - BARSTART;


/* FIND THE CLOSEST LOOKBACK PERIOD TO VBL1 LENGTH. WE WILL USE 
INCREMENTS OF 126 (1/2 OF 252 DAY YEAR) TO DO THIS.
VLBRAW = GET RAW VLB NUMBER AS VECTOR
VLB = USING IIF, FIND CLOSEST FIT.
*/

VLBRAWFACTOR = Max(round(VLBRAW / 126),1); //WHICH MULTIPLE OF 126 
IS BEST FIT?

VLB = IIf(VLBRAWFACTOR == 1, 126, IIf(VLBRAWFACTOR == 2, 252, IIf
(VLBRAWFACTOR == 3, 378, IIf(VLBRAWFACTOR == 4, 504, IIf (VLBRAWFACTOR == 5,
630, 756))))); 

//CORR CHECKS
CORR = Correlation(ROC(FUND,1),ROC(INDEX,1),VLB);



------------------------ Yahoo! Groups Sponsor ---------------------~--> Buy
Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark Printer
at Myinks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/