title: How to use ta-lib library for technical analysis with C++
body: <p>I am trying to do some technical analysis of <a href="https://ethercalc.org/fo128cmznr" rel="nofollow">this data</a> using <a href="http://ta-lib.org/d_api/d_api.html" rel="nofollow">ta-lib</a> library in C++. The problem with <code>ta-lib</code> is that there is very few(most probably none except documentation) tutorials regarding their usage in C++. I converted the <code>open</code> values (third/C-th column) in the spreadsheet to a vector double <code>vec</code> of size 124. I want to use this vector for the calculation of EMA and RSI of 10 day period. This is </p>
  
  <pre><code>    //headers used
      #include &lt;vector&gt;
      #include &lt;ta-lib/ta_libc.h&gt;
      std::vector &lt;double&gt; vec;
  
      //Technical analysis part of the code
      int n=vec.size();  //size of the vector
      std::cout &lt;&lt;"size "&lt;&lt; n  &lt;&lt; ' ';
      TA_RetCode retCode;
      retCode = TA_Initialize( );
      if( retCode != TA_SUCCESS )
          std::cout&lt;&lt;"Cannot initialize TA-Lib !\n"&lt;&lt; retCode &lt;"\n";
      else
      {
          std::cout&lt;&lt;"TA-Lib correctly initialized.\n" ;
  
          /* ... other TA-Lib functions can be used here. */
          double ma=TA_MA(0,n,vec,10,TA_MAType_EMA);
          double rsi=TA_RSI(0,n,vec,10);
          std::cout &lt;&lt;"EMA "&lt;&lt; ma &lt;&lt;"\n";
          std::cout &lt;&lt;"RSI "&lt;&lt; rsi &lt;&lt;"\n";
          TA_Shutdown();
      }
  </code></pre>
  
  <p>The error is</p>
  
  <blockquote>
    <p>error: cannot convert ‘std::vector’ to ‘const double*’ for
    argument ‘3’ to ‘TA_RetCode TA_MA(int, int, const double*, int,
    TA_MAType, int*, int*, double*)</p>
  </blockquote>