Hi Joe
I also struggled with this, however I eventually found there is a
very simple solution where you create a composite symbol. See my
example below for a Dow-Gold ratio:
OpenDowGLD = Foreign("^DJI","Open") / Foreign("GLD","Open");
HighDowGLD = Foreign("^DJI","High") / Foreign("GLD","High");
LowDowGLD = Foreign("^DJI","Low") / Foreign("GLD","Low");
CloseDowGLD = Foreign("^DJI","Close") / Foreign("GLD","Close");
AddToComposite( OpenDowGLD, "~Dow-GLD", "O", 1 + 2 + 8 + 16 );
AddToComposite( HighDowGLD, "~Dow-GLD", "H", 1 + 2 + 8 + 16 );
AddToComposite( LowDowGLD, "~Dow-GLD", "L", 1 + 2 + 8 + 16 );
AddToComposite( CloseDowGLD, "~Dow-GLD", "C", 1 + 2 + 8 + 16 );
Buy=Sell=Short=Cover=0;
Filter=1;
The tickers are based from Yahoo data - you simply view the symbol
~Dow-GLD
An alternative if you want to create a chart that displays alongside
your current symbol is to create an andicator like this:
ticker = ParamStr( "Ticker", "GLD" );
OpenSpread = Open / Foreign(ticker,"Open");
HighSpread = High / Foreign(ticker,"High");
LowSpread = Low / Foreign(ticker,"Low");
CloseSpread = Close / Foreign(ticker,"Close");
PlotOHLC( OpenSpread, HighSpread, LowSpread, CloseSpread, FullName()
+"-"+ticker+" Spread", colorBlack, styleCandle );
Hope that helps
--- In [email protected], "venturerider2" <[EMAIL PROTECTED]>
wrote:
>
> I'm new using AB. I'd like to be able to chart a spread of two
stock
> symbols and I'd like the chart to be a candlestick price chart
just
> as if I was looking at the price chart of a single security. So,
for
> example, if I were plotting a capital balanced equity spread in
Coke
> and Pepsi, I need to be able to plot it on a capital balanced ratio
> (120 shares of Coke minus 100 shares of Pepsi). In Esignal this is
> accomplished by creating a custom spread symbol, which in this case
> would be "1.2KO PEP".
>
> I plotted a spread in AB using the Foreign function: spread =
Foreign
> ( "ticker1", "C") - Foreign( "ticker2", "C");
> Plot( spread, "spread", colorRed);
>
> However, this does not give me a true price plot with OHLC
> candlesticks. It plots it like an indicator as a line. Ideally,
I
> do not want to create an indicator. Ideally, like in eSignal, I
want
> to create a custom symbol, which corresponds to a custom price
plot
> this price plot being the ratio adjusted difference between two
> stocks, as described above. Then I would like to be able to apply
> all of the various indicators (MA's, RSI, CCI, MACD, etc.) to that
> custom price plot.
>
> I covered the AFL Library, UKB, Yahoo Users Group and AB manuals.
I
> cannot find any information on this. If you can point me in the
> right direction I would greatly appreciate it. Thanks.
>
> -Joe
>