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

[amibroker] pair trading chart ratio question



PureBytes Links

Trading Reference Links

I've been looking into pair trading and am trying to create a chart of 
the ratio between two stocks for pair trading.

I have been able to create the chart by using parameters to set the 
two stock tickers but I'd like to save a list of these and be able to 
call them up one and a time like regular stocks.

What I have done is create symbols which contain both tickers 
separated by a character.   In other words, if I want to plot the 
ratio of POT to MOS I have created a symbol called POT^MOS.

Then I have put the following code into an indicator where i pull up 
the ticker, split into two symbols and try to plot the ratio.

Ticker=Name();
Ticklen= strlen(ticker);
Spot = strfind(ticker,"^");
Tick1 = strleft(ticker,spot-1);
Tick2 = strright(ticker,ticklen-spot);
C1 = foreign(tick1,"C");
C2 = foreign(tick2,"C");
Ratio = c1/c2;
Plot(ratio,"ratio",colorgreen,styleline);

When I move to this special ticker the normal price chart is blank 
(because there is no real ticker called POT^MOS) so the normal price 
is empty because close is empty.   But, I can not get anything to 
display in this indicator box either.

Should I be able to do this?   Does my code look ok for this?





------------------------------------

**** 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:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto: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/