PureBytes Links
Trading Reference Links
|
Hello all,
The code posted below is coming up with a variable lookback period,
and plugs the number into the correlation function length.
Unfortunately, that doesn't work beause I believe that the
correlation function needs a scalar for length and I'm supplying a
vector.
I could use lastvalue function, but that wouldn't work from
backtesting perspective as the last value is all that is returned
(in scalar form).
Any help, feedback is greatly appreciated.
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/
|