Stock analysis software using algebra

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!
 
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)
  {
      // 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
 
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);
 
Quote from 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);

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);
 
Back
Top