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

Re: [amibroker] Re: IB>QT>AB Pro Real Time Data Feed Problem



PureBytes Links

Trading Reference Links




hi yuki,
 
the easiest way is to use 
setforeign(), like dimitris already said. but you could also write a simple 
#include file that references the 2 tickers you want to compare. under one 
layout i have various indicator windows for the same pair showing me 
correlation, stdev, volatility and a few things more.
the code below shows the standard 
deviation difference for any pair both in relative and absolute terms. just make 
sure to put a file "pairs.afl" in your include directory that defines the two 
tickers of your pair, like pair1="8601.T";pair2=8603.T";
 

// Identifying Pairs: Difference from StDevS //<FONT 
size=2>
#include <pairs.afl>
timeframe=Param<FONT 
size=2>("Timeframe"<FONT 
size=2>,21,<FONT 
color=#ff00ff size=2>2,<FONT color=#ff00ff 
size=2>100,1<FONT 
size=2>);
x=Foreign<FONT 
size=2>(pair1,"C");
y=Foreign<FONT 
size=2>(pair2,"C");
MaxGraph=8;
pr=x/y;
pra=x-y;
movav=MA<FONT 
size=2>(pr,timeframe);
sd=StDev<FONT 
size=2>(pr,timeframe);
movava=MA<FONT 
size=2>(pra,timeframe);
sda=StDev<FONT 
size=2>(pra,timeframe);
Graph0=(pr-movav)/sd;
Graph1=(pra-movava)/sda;
Graph2=2;
Graph3=-2;
Graph2Style=Graph3Style=<FONT color=#ff00ff 
size=2>8;
Plot(0<FONT 
size=2>,"",<FONT 
color=#ff00ff size=2>1,<FONT color=#ff00ff 
size=2>4096);
Title=EncodeColor<FONT 
size=2>(colorBrown)+Date<FONT 
size=2>()+" "+<FONT 
color=#0000ff size=2>EncodeColor<FONT 
size=2>(colorBlue)+" Difference from 
StDev (rel.):"+<FONT color=#0000ff 
size=2>WriteVal(Graph0)+<FONT color=#0000ff 
size=2>EncodeColor(colorRed)+<FONT 
color=#ff00ff size=2>" Difference from StDev (abs.):"<FONT 
size=2>+WriteVal<FONT 
size=2>(Graph1)+EncodeColor<FONT 
size=2>(colorCustom12)+" in last 
"+timeframe+" Days 
"+EncodeColor<FONT 
size=2>(colorBlue)+" \n (3) Identifying 
Pairs [Ratio Difference from 2StDev (short)] "+<FONT 
color=#0000ff size=2>EncodeColor<FONT 
size=2>(colorRed)+pair1+<FONT color=#0000ff 
size=2>EncodeColor(colorBlue)+<FONT 
color=#ff00ff size=2>" & "+<FONT color=#0000ff 
size=2>EncodeColor(colorRed)+pair2;
 
 
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Yuki 
  Taga 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Tuesday, February 10, 2004 2:01 
  AM
  Subject: [amibroker] setting up for pair 
  trading
  I'm getting interested in adding a couple of pairs to the 
  one pairthat I have been trading for years.  The current pair has 
  twoartificial "stocks" in the MS database, which I update by hand 
  eachday.  One artificial stock simply plots the daily raw 
  pricedifference of A versus B, and the other one plots the 
  percentagedifference.It's not too much trouble to update this one 
  pair by hand each day,but if I'm going to add more pairs, I'd like to know 
  if anyone hasany ideas on how this could be done automatically, via AFL, 
  or evenif that is possible.  Particularly, I'd like to setup proxies 
  as Ihave, and actually be able to look at charts with standard 
  deviationlines on them.  Is it possible for AB to fill in the 
  "prices" of anartificial stock each day, using real prices that I would 
  enter forthe underlying pair?YukiSend BUG 
  REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  


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








Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/ 
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.








Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online