 |
luxhydrus
Registered: Mar 2011
Posts: 7 |
04-04-12 01:43 PM
hi all, i'm fairly new to trading, and thus i apologize if my question's answer is obvious.
I'm looking for a software in which i can chart relations between stocks, such as
I would to chart the relation
(stock A + Stock B) / (Stock C+ Stock D)
thank you very much!
|
| |
|
Edit/Delete • Quote • Complain |
 
tradelink
Registered: Feb 2008
Posts: 577 |
04-04-12 04:13 PM
you can do this in tradelink, which is free and open source.
code:
public class MyResponse : ResponseTemplate
{
GenericTracker relation = new GenericTracker();
TickTracker kt = new TickTracker();
const string [] sym = new string[] { "a","b","c","d"};
const int a = 0;
const int b = 1;
const in c = 2;
const int d = 3;
string relationid = string.Join(",",syms);
override void GotTick(Tick k)
{
// track last/bid/ask
kt.newTick(k);
// compute relation on every tick
relation[relationid] = (kt.Last(sym[a]) + kt.Last(sym[b])/(kt.Last(sym[c])+kt.Last(sym[d]));
// plot it, trade it, etc
sendchartlablel(k.time,relation[relationid]);
}
override void Reset()
{
// track each relationship
relation.addindex(relationid);
// subscribe to ticks for symbols
sendbasket(sym);
}
}
google tradelink project or tradelink.org for more info
|
| |
|
Edit/Delete • Quote • Complain |

funnyguy
Registered: Feb 2012
Posts: 96 |
04-06-12 01:23 PM
Quote from paranoidone:
I use AmiBroker...
Yeah, two lines of code there. One for calculation and another one for plotting.
code:
relation = ( Foreign("AAPL", "C") + Foreign("HPQ", "C") ) / ( Foreign("DELL", "C") + Foreign("IBM", "C") );
Plot(relation, "Relation of Stocks", ColorRed, styleLine);
|
| |
|
Edit/Delete • Quote • Complain |
| Receive
an email whenever a new post is added to this thread by subscribing
to it. |
|
|
|
|