General Topics
Technical Topics
Brokerage Firms
Community Lounge
Site Support

# Stock analysis software using algebra

Discussion in 'Trading Software' started by luxhydrus, Apr 4, 2012.

1. ### luxhydrus

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!

2. ### Lornz

If you're looking a cheap alternative, check out Investor/RT.

you can do this in tradelink, which is free and open source.

Code:
```public class MyResponse : ResponseTemplate
{

GenericTracker<decimal> relation = new GenericTracker<decimal>();

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)
{
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
// subscribe to ticks for symbols
}
}
```

4. ### goodgoing

Excel - trivial

5. ### paranoidone

I use AmiBroker...

6. ### funnyguy

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);```

7. ### funnyguy

Or

Code:
```stock1 = ParamStr("Stock 1", "input here");
stock2 = ParamStr("Stock 2", "input here");
stock3 = ParamStr("Stock 3", "input here");
stock4 = ParamStr("Stock 4", "input here");
relation = ( Foreign(stock1, "C")  + Foreign(stock2, "C") ) / ( Foreign(stock3, "C")  + Foreign(stock4, "C") );
Plot(relation, "Relation of Stocks", ColorRed, styleLine);```

ET IS FREE BECAUSE OF THE FINANCIAL SUPPORT FROM THESE COMPANIES: