On Balance Volume, Buy Sell Signal

Discussion in 'Automated Trading' started by nickka, Feb 19, 2011.

  1. nickka


    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?
  2. dtcreate


    I think you should chart it and take a look at what an OBV looks like in relation to your moving averages. I would imagine what TA-Lib is giving back to you is the +/- delta change from the previous period but it could also be giving you the sum value which is the 0 line cross.

    Either way.. I don't believe there is a formula that you can use that will give you a correlation as OBV is related to the volume and only looks at was it an up day or a down day and assigns a +/- where the MA of course is based on real price movement and doesn't look at volume at all.

    Your strategy is going to have to be smarter and look at how long the OBV has been positive (for a long) or is it converging towards the 0 line as the MA turns or something more. If you are looking for them to turn at the same time, don't think that will work the way you want.