Hi,
Your message is a bit confusing since what you are asking for is completely
different from the example graphs that you have provided.
I believe that the example graphs are showing the performance to date of each
symbol on a single chart (i.e. two independent lines), whereas you appear to be
asking for a single line showing performance of one symbol relative to the
other.
That being the case, here's an example:
DIAClose = Foreign("DIA", "Close");
IWMClose = Foreign("IWM", "Close");
Diff = (DIAClose - IWMClose)/IWMClose; // Expressed as a percentage.
Plot(Diff, "Diff", colorRed, styleLine);
Mike
--- In [email protected], "Alexander Shelupinin" <shelupi...@...>
wrote:
>
> Hi !
> I want to explore the opportunitie of pair trading, i.e. to trade 2
> instruments with very high correlation, if , say, the difference in 2
> instruments increased over it's historic value than put a trade with a bet
> that their difference will come to lower value, close to historic value. I
> gonna trade index ETFs.
> Here is an idea what I mean:
> http://finance.yahoo.com/q/bc?t=1d&s=DIA&l=on&z=l&q=l&c=iwm
> http://finance.yahoo.com/q/bc?s=dia&t=1d&l=on&z=l&q=l&p=&a=&c=spy
> http://finance.yahoo.com/q/bc?t=1d&s=QQQQ&l=on&z=l&q=l&c=iwm
> http://finance.yahoo.com/q/bc?t=1d&s=QQQQ&l=on&z=l&q=l&c=dia
>
> So the question: Could someone help and write a simple code that will draw a
> chart of difference between mentioned ETFs: IWM, SPY, QQQQ, DIA. I mean not a
> chart of symbol, but chart of 2 symbol difference, say {DIA} minus {IWM} or
> {QQQQ} minus {DIA}
>
> thanks a lot for any help !!!
>
> Alex
>