PureBytes Links
Trading Reference Links
|
Foreign() will return the entire array, just call it once, assign to a
variable and then reference the variable. Your 2nd call has the correct
format so you can just do this
y = Foreign("QQQQ", "Close"); // current price for QQQQ
x = ref( y, -260 );
----- Original Message -----
From: "Alan" <alan@xxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, November 28, 2009 11:39 AM
Subject: [amibroker] Comparing Two Symbols Error Problem
> To group:
>
> I am trying to compare AAPL to QQQQ over the last 260 trading days.
> Everything works except that I get an error with variable 'x' when
> trying to return the closing price for QQQQ 260 days ago. Can someone
> correct the coding for variable 'x'?
>
> // CURRENT SYMBOL
> a = Ref(Close, -260); // closing price one year ago
> b = Close; // current price
> perf = b / a; // Performance = current price divided by the current
> price one year ago
>
> // FOREIGN SYMBOL
> x = Foreign("QQQQ", Ref(Close, -260)); // closing price of QQQQ one year
> ago
> y = Foreign("QQQQ", "Close"); // current price for QQQQ
> perf_foreign = y / x ; // Performance = current price of QQQQ divided by
> price of QQQQ one year ago
>
> // RELATIVE PRICE COMPARATIVE
> rpc = perf / perf_foreign ; // compares the current symbol to the QQQQ's
>
> // PLOT RESULTS
> Plot(perf, "ticker", colorDarkGreen, 1); // plot current symbol
> performance
> Plot(perf_foreign, "QQQQ", colorRed, 1); // plot performance of QQQQ
> Plot(rpc, "Rel_Price_Comp", colorBlack, 32); // plot Relative Price
> Comparative
>
> Alan-
> <http://www.eset.com>
>
>
> ------------------------------------
>
> **** IMPORTANT PLEASE READ ****
> This group is for the discussion between users only.
> This is *NOT* technical support channel.
>
> TO GET TECHNICAL SUPPORT send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
> http://www.amibroker.com/feedback/
> (submissions sent via other channels won't be considered)
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> Yahoo! Groups Links
>
>
>
>
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
amibroker-digest@xxxxxxxxxxxxxxx
amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|