Skip to content

Volume Indicators ADA / OBV - extra inconsistent with slightly different time window #513

Open

Description

@MichalRIcar

Hi,

I am checking the consistency of results with slightly different time windows and especially ADA/OBV volume indicators are providing extremely different results.

E.g. Data set → Having a time window of 5000 observations where t0 is the present moment and t4999 is a 5000th-time unit in the past.
Result1: checking the very last calculation of AD/OBV (i.e. in t0).
Result2: checking the very last calculation of AD/OBV, (i.e. in t0), however, this time we deleted the very first obs 5000 (t4999).

In the financial dynamics and indicator sense, the observation from the very beginning of the time series at t4999 shouldn't have any impact on the present value in t0, but that is not the case in the indicators AD/OBV.

I have checked the illustration calculation in excel and it seems that the algo is using the fixed value from the very beginning of the data regardless of the length or is there any other reason for the incosistency?

I am curious if you consider a dynamic "beginning" for the indicator calculation rather than keep it at the one fixed point forever.

The implications for real-world calculations are quite huge and in our case indicators with fixed beginning can't be used.

Thank you for Your ideas, and opinion.

Best,
Michal

Activity

  1. mrjbq7 commented on Apr 14, 2022

    @mrjbq7
    Member

    I think that's how those indicators are defined.

    For example, in OBV:

    https://github.com/TA-Lib/ta-lib/blob/master/src/ta_func/ta_OBV.c#L267

    /* Generated */    prevOBV  = inVolume[startIdx];
    /* Generated */    prevReal = inReal[startIdx];
    /* Generated */    outIdx = 0;
    /* Generated */    for(i=startIdx; i <= endIdx; i++ )
    /* Generated */    {
    /* Generated */       tempReal = inReal[i];
    /* Generated */       if( tempReal > prevReal )
    /* Generated */          prevOBV += inVolume[i];
    /* Generated */       else if( tempReal < prevReal )
    /* Generated */          prevOBV -= inVolume[i];
    /* Generated */       outReal[outIdx++] = prevOBV;
    /* Generated */       prevReal = tempReal;
    /* Generated */    }
  2. MichalRIcar commented on Apr 14, 2022

    @MichalRIcar
    Author

    I see, thank you. Then it behaves a little bit randomly when plugged into dynamic computation with moving (time dynamic) underlying data. Good to know!

  3. mrjbq7 commented on Oct 11, 2022

    @mrjbq7
    Member
  4. MichalRIcar commented on Oct 12, 2022

    @MichalRIcar
    Author

    Thx for the hint! In the end, I solved it by removing all TA indicators conditioned by time window length. Luckily the impact to the overall ML performance is negligible as an algo substituted kicked predictors by different sets with the overall same performance..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions