I am creating a custom software applications that uses a library called Ta-Lib. One of the signals that I am using is when a 10 day Moving Average crosses a 50 day Moving Average. if the 10 day crosses positive, it is a buy Signal and when it crosses negative, it is a Sell Signal. Now, I am attempting to match an On Balance Volume (OBV) signals with the Moving Average signals. Ta-Lib uses Close Price and Volume to give an array of doubles ( double precision values) that are either positive or negative. It is my understanding that positive is a bullish signal and negative is a bearish signal. If the positive value is very positive, it is a Buy Signal and if it is very negative, it is a Sell Signal. Now, I am attempting to match the two signals shown above to each other but I don't believe thay happen at the same time. I am not using a chart to match the two signals but am attempting to do this in code. If indeed the OBV signal would happen before the MA signal, my question concerns how to calculate how far ahead the OBV would happen before the MA. Can someone provide me with a formula where I can plug in the 10 and 50 from the MA and get back the number of days to go back +/- x number of days to match the OBV with MA?