July 19th, 2013, 7:00 am
Hello expert programmers,I am trying my hand at writing a code to implement a trading formula. But I am not sure about how the returns and their arithmetic is implemented. The formula I am trying to implement is something like Z = Return (stock) - beta1*Return (market) - beta2 * Return (sector). Assuming stock is APPL, market is SPY and sector is IYT and beta values are known constants, if I need to calculate the value of Z intraday based on the close price on T-1, can you please suggest me how to go about the calculations.Would it be simply: Z (at any given instant) = log( real time price of AAPL at that time/ Prev. close price of AAPL) - beta1 * log(real time price of SPY/Prev close price of SPY) - beta2*(real time price of IYT/ prev close price of IYT)I doubt that this is the way it is implemented by professional quant. programmers, but if it is right it will be very noisy and a resource hog, given how this calc will change with every tick and how active these (AAPL, SPY, IYT) equities are. I woutd appreciate any suggestions on implementing it in the right way and to get a stable and meaningful signal (Z).THANK YOU.