Пример #1
0
/* Generated */ TA_RetCode TA_S_EMA( int    startIdx,
/* Generated */                      int    endIdx,
/* Generated */                      const float  inReal[],
/* Generated */                      int           optInTimePeriod, /* From 2 to 100000 */
/* Generated */                      int          *outBegIdx,
/* Generated */                      int          *outNBElement,
/* Generated */                      double        outReal[] )
/* Generated */ #endif
/* Generated */ {
/* Generated */  #ifndef TA_FUNC_NO_RANGE_CHECK
/* Generated */     if( startIdx < 0 )
/* Generated */        return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_START_INDEX,OutOfRangeStartIndex);
/* Generated */     if( (endIdx < 0) || (endIdx < startIdx))
/* Generated */        return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_END_INDEX,OutOfRangeEndIndex);
/* Generated */     #if !defined(_JAVA)
/* Generated */     if( !inReal ) return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
/* Generated */     #endif 
/* Generated */     if( (int)optInTimePeriod == TA_INTEGER_DEFAULT )
/* Generated */        optInTimePeriod = 30;
/* Generated */     else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
/* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
/* Generated */     #if !defined(_JAVA)
/* Generated */     if( !outReal )
/* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
/* Generated */     #endif 
/* Generated */  #endif 
/* Generated */    return FUNCTION_CALL(INT_EMA)( startIdx, endIdx, inReal, 
/* Generated */                                   optInTimePeriod,
/* Generated */                                   PER_TO_K( optInTimePeriod ),
/* Generated */                                   outBegIdx, outNBElement, outReal );
/* Generated */ }
Пример #2
0
     /* Generated */ TA_RetCode TA_S_APO( int    startIdx,
                                          /* Generated */                      int    endIdx,
                                          /* Generated */                      const float  inReal[],
                                          /* Generated */                      int           optInFastPeriod, /* From 2 to 100000 */
                                          /* Generated */                      int           optInSlowPeriod, /* From 2 to 100000 */
                                          /* Generated */                      TA_MAType     optInMAType,
                                          /* Generated */                      int          *outBegIdx,
                                          /* Generated */                      int          *outNbElement,
                                          /* Generated */                      double        outReal[] )
     /* Generated */ #endif
     /* Generated */ {
     /* Generated */    ARRAY_REF(tempBuffer);
     /* Generated */    TA_RetCode retCode;
     /* Generated */  #ifndef TA_FUNC_NO_RANGE_CHECK
     /* Generated */     if( startIdx < 0 )
         /* Generated */        return NAMESPACE(TA_RetCode)TA_OUT_OF_RANGE_START_INDEX;
     /* Generated */     if( (endIdx < 0) || (endIdx < startIdx))
         /* Generated */        return NAMESPACE(TA_RetCode)TA_OUT_OF_RANGE_END_INDEX;
     /* Generated */     #if !defined(_MANAGED) && !defined(_JAVA)
         /* Generated */     if( !inReal ) return NAMESPACE(TA_RetCode)TA_BAD_PARAM;
     /* Generated */     #endif
     /* Generated */     if( (int)optInFastPeriod == TA_INTEGER_DEFAULT )
         /* Generated */        optInFastPeriod = 12;
     /* Generated */     else if( ((int)optInFastPeriod < 2) || ((int)optInFastPeriod > 100000) )
         /* Generated */        return NAMESPACE(TA_RetCode)TA_BAD_PARAM;
     /* Generated */     if( (int)optInSlowPeriod == TA_INTEGER_DEFAULT )
         /* Generated */        optInSlowPeriod = 26;
     /* Generated */     else if( ((int)optInSlowPeriod < 2) || ((int)optInSlowPeriod > 100000) )
         /* Generated */        return NAMESPACE(TA_RetCode)TA_BAD_PARAM;
     /* Generated */     #if !defined(_MANAGED) && !defined(_JAVA)
         /* Generated */     if( (int)optInMAType == TA_INTEGER_DEFAULT )
             /* Generated */        optInMAType = 0;
         /* Generated */     else if( ((int)optInMAType < 0) || ((int)optInMAType > 8) )
             /* Generated */        return NAMESPACE(TA_RetCode)TA_BAD_PARAM;
     /* Generated */     #endif
     /* Generated */     #if !defined(_MANAGED) && !defined(_JAVA)
         /* Generated */     if( !outReal )
             /* Generated */        return NAMESPACE(TA_RetCode)TA_BAD_PARAM;
     /* Generated */     #endif
     /* Generated */  #endif
     /* Generated */    ARRAY_ALLOC(tempBuffer, (endIdx-startIdx+1) );
     /* Generated */    #if !defined(_JAVA)
         /* Generated */       if( !tempBuffer )
             /* Generated */          return NAMESPACE(TA_RetCode)TA_ALLOC_ERR;
     /* Generated */    #endif
     /* Generated */    retCode = FUNCTION_CALL(INT_PO)( startIdx, endIdx,
     /* Generated */                                     inReal,
     /* Generated */                                     optInFastPeriod,
     /* Generated */                                     optInSlowPeriod,
     /* Generated */                                     optInMAType,
     /* Generated */                                     outBegIdx,
     /* Generated */                                     outNbElement,
     /* Generated */                                     outReal,
     /* Generated */                                     tempBuffer,
     /* Generated */                                     0  );
     /* Generated */    ARRAY_FREE( tempBuffer );
     /* Generated */    return retCode;
     /* Generated */
 }
Пример #3
0
/* Generated */ TA_RetCode TA_PREFIX(INT_PO)( int    startIdx,
/* Generated */                               int    endIdx,
/* Generated */                               const INPUT_TYPE *inReal,
/* Generated */                               int    optInFastPeriod, 
/* Generated */                               int    optInSlowPeriod, 
/* Generated */                               TA_MAType optInMethod_2,
/* Generated */                               int   *outBegIdx,
/* Generated */                               int   *outNBElement,
/* Generated */                               double      *outReal,
/* Generated */                               double      *tempBuffer,
/* Generated */                               int  doPercentageOutput )
/* Generated */ #endif
/* Generated */ {
/* Generated */    ENUM_DECLARATION(RetCode) retCode;
/* Generated */    double tempReal;
/* Generated */    int tempInteger;
/* Generated */    VALUE_HANDLE_INT(outBegIdx1);
/* Generated */    VALUE_HANDLE_INT(outNbElement1);
/* Generated */    VALUE_HANDLE_INT(outBegIdx2);
/* Generated */    VALUE_HANDLE_INT(outNbElement2);
/* Generated */    int i, j;
/* Generated */    if( optInSlowPeriod < optInFastPeriod )
/* Generated */    {
/* Generated */        tempInteger     = optInSlowPeriod;
/* Generated */        optInSlowPeriod = optInFastPeriod;
/* Generated */        optInFastPeriod = tempInteger;
/* Generated */    }
/* Generated */    retCode = FUNCTION_CALL(MA)( startIdx, endIdx,
/* Generated */                                 inReal,
/* Generated */                                 optInFastPeriod, 
/* Generated */                                 optInMethod_2,                    
/* Generated */                                 VALUE_HANDLE_OUT(outBegIdx2), VALUE_HANDLE_OUT(outNbElement2),
/* Generated */ 							    tempBuffer );
/* Generated */    if( retCode == ENUM_VALUE(RetCode,TA_SUCCESS,Success) )
/* Generated */    {
/* Generated */       retCode = FUNCTION_CALL(MA)( startIdx, endIdx,                       
/* Generated */                                    inReal,
/* Generated */                                    optInSlowPeriod, 
/* Generated */                                    optInMethod_2,
/* Generated */                                    VALUE_HANDLE_OUT(outBegIdx1), VALUE_HANDLE_OUT(outNbElement1),
/* Generated */ 							       outReal );
/* Generated */       if( retCode == ENUM_VALUE(RetCode,TA_SUCCESS,Success) )
/* Generated */       {
/* Generated */          tempInteger = VALUE_HANDLE_GET(outBegIdx1) - VALUE_HANDLE_GET(outBegIdx2);
/* Generated */          if( doPercentageOutput != 0 )
/* Generated */          {
/* Generated */             for( i=0,j=tempInteger; i < VALUE_HANDLE_GET(outNbElement1); i++, j++ )
/* Generated */             {
/* Generated */                tempReal = outReal[i];
/* Generated */                if( !TA_IS_ZERO(tempReal) )
/* Generated */                   outReal[i] = ((tempBuffer[j]-tempReal)/tempReal)*100.0;
/* Generated */                else
/* Generated */                   outReal[i] = 0.0;
/* Generated */             }
/* Generated */          }
/* Generated */          else
/* Generated */          {
/* Generated */             for( i=0,j=tempInteger; i < VALUE_HANDLE_GET(outNbElement1); i++, j++ )
/* Generated */                outReal[i] = tempBuffer[j]-outReal[i];
/* Generated */          }
/* Generated */          VALUE_HANDLE_DEREF(outBegIdx)     = VALUE_HANDLE_GET(outBegIdx1);
/* Generated */          VALUE_HANDLE_DEREF(outNBElement)  = VALUE_HANDLE_GET(outNbElement1);
/* Generated */       }
/* Generated */    }
/* Generated */    if( retCode != ENUM_VALUE(RetCode,TA_SUCCESS,Success) )
/* Generated */    {
/* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx);
/* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outNBElement);
/* Generated */    }
/* Generated */    return retCode;
/* Generated */ }
Пример #4
0
/* Generated */ TA_RetCode TA_S_ACCBANDS( int    startIdx,
/* Generated */                           int    endIdx,
/* Generated */                           const float  inHigh[],
/* Generated */                           const float  inLow[],
/* Generated */                           const float  inClose[],
/* Generated */                           int           optInTimePeriod, /* From 2 to 100000 */
/* Generated */                           int          *outBegIdx,
/* Generated */                           int          *outNBElement,
/* Generated */                           double        outRealUpperBand[],
/* Generated */                           double        outRealMiddleBand[],
/* Generated */                           double        outRealLowerBand[] )
/* Generated */ #endif
/* Generated */ {
/* Generated */    ENUM_DECLARATION(RetCode) retCode;
/* Generated */    ARRAY_REF( tempBuffer1 );
/* Generated */    ARRAY_REF( tempBuffer2 );
/* Generated */    VALUE_HANDLE_INT(outBegIdxDummy);
/* Generated */    VALUE_HANDLE_INT(outNbElementDummy);
/* Generated */    int i, j, outputSize, bufferSize, lookbackTotal;
/* Generated */    double tempReal;
/* Generated */  #ifndef TA_FUNC_NO_RANGE_CHECK
/* Generated */     if( startIdx < 0 )
/* Generated */        return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_START_INDEX,OutOfRangeStartIndex);
/* Generated */     if( (endIdx < 0) || (endIdx < startIdx))
/* Generated */        return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_END_INDEX,OutOfRangeEndIndex);
/* Generated */     #if !defined(_JAVA)
/* Generated */     if(!inHigh||!inLow||!inClose)
/* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
/* Generated */     #endif 
/* Generated */     if( (int)optInTimePeriod == TA_INTEGER_DEFAULT )
/* Generated */        optInTimePeriod = 20;
/* Generated */     else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
/* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
/* Generated */     #if !defined(_JAVA)
/* Generated */     if( !outRealUpperBand )
/* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
/* Generated */     if( !outRealMiddleBand )
/* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
/* Generated */     if( !outRealLowerBand )
/* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
/* Generated */     #endif 
/* Generated */  #endif 
/* Generated */    lookbackTotal = LOOKBACK_CALL(SMA)( optInTimePeriod );
/* Generated */    if( startIdx < lookbackTotal )
/* Generated */       startIdx = lookbackTotal;
/* Generated */    if( startIdx > endIdx )
/* Generated */    {
/* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx);
/* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outNBElement);
/* Generated */       return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
/* Generated */    }
/* Generated */    outputSize = endIdx-startIdx+1;
/* Generated */    bufferSize = outputSize+lookbackTotal;
/* Generated */    ARRAY_ALLOC(tempBuffer1, bufferSize );
/* Generated */    #if !defined(_JAVA)      
/* Generated */       if( !tempBuffer1 )
/* Generated */ 	  {
/* Generated */          VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx);
/* Generated */          VALUE_HANDLE_DEREF_TO_ZERO(outNBElement);
/* Generated */          return ENUM_VALUE(RetCode,TA_ALLOC_ERR,AllocErr);
/* Generated */ 	  }
/* Generated */    #endif
/* Generated */    ARRAY_ALLOC(tempBuffer2, bufferSize );
/* Generated */    #if !defined(_JAVA)      
/* Generated */       if( !tempBuffer2 )
/* Generated */ 	  {
/* Generated */ 		 ARRAY_FREE(tempBuffer1);
/* Generated */          VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx);
/* Generated */          VALUE_HANDLE_DEREF_TO_ZERO(outNBElement);
/* Generated */          return ENUM_VALUE(RetCode,TA_ALLOC_ERR,AllocErr);
/* Generated */ 	  }
/* Generated */    #endif
/* Generated */    for(j=0, i=startIdx-lookbackTotal; i<=endIdx; i++, j++)
/* Generated */    {
/* Generated */ 	    tempReal = inHigh[i]+inLow[i];
/* Generated */ 	    if( !TA_IS_ZERO(tempReal) )
/* Generated */ 		{
/* Generated */ 		   tempReal = 4*(inHigh[i]-inLow[i])/tempReal;
/* Generated */ 		   tempBuffer1[j] = inHigh[i]*(1+tempReal);
/* Generated */ 		   tempBuffer2[j] = inLow[i]*(1-tempReal);
/* Generated */ 		}
/* Generated */ 		else
/* Generated */ 		{
/* Generated */ 		   tempBuffer1[j] = inHigh[i];
/* Generated */ 		   tempBuffer2[j] = inLow[i];
/* Generated */ 		}
/* Generated */    }
/* Generated */    retCode = FUNCTION_CALL(SMA)( startIdx, endIdx, inClose,
/* Generated */                                 optInTimePeriod, 
/* Generated */                                 VALUE_HANDLE_OUT(outBegIdxDummy), VALUE_HANDLE_OUT(outNbElementDummy), outRealMiddleBand );
/* Generated */    if( (retCode != ENUM_VALUE(RetCode,TA_SUCCESS,Success) ) || ((int)VALUE_HANDLE_GET(outNbElementDummy) != outputSize) )
/* Generated */    {
/* Generated */       ARRAY_FREE( tempBuffer1 ); 
/* Generated */       ARRAY_FREE( tempBuffer2 );
/* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx);
/* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outNBElement);
/* Generated */       return retCode;
/* Generated */    }
/* Generated */    retCode = FUNCTION_CALL_DOUBLE(SMA)( 0, bufferSize-1, tempBuffer1,
/* Generated */                                 optInTimePeriod,
/* Generated */                                 VALUE_HANDLE_OUT(outBegIdxDummy), VALUE_HANDLE_OUT(outNbElementDummy), 
/* Generated */ 								outRealUpperBand );
/* Generated */    if( (retCode != ENUM_VALUE(RetCode,TA_SUCCESS,Success) ) || ((int)VALUE_HANDLE_GET(outNbElementDummy) != outputSize) )
/* Generated */    {
/* Generated */       ARRAY_FREE( tempBuffer1 ); 
/* Generated */       ARRAY_FREE( tempBuffer2 ); 
/* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx);
/* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outNBElement);
/* Generated */       return retCode;
/* Generated */    }
/* Generated */    retCode = FUNCTION_CALL_DOUBLE(SMA)( 0, bufferSize-1, tempBuffer2,
/* Generated */                                 optInTimePeriod,
/* Generated */                                 VALUE_HANDLE_OUT(outBegIdxDummy), VALUE_HANDLE_OUT(outNbElementDummy), 
/* Generated */ 								outRealLowerBand );
/* Generated */    ARRAY_FREE( tempBuffer1 ); 
/* Generated */    ARRAY_FREE( tempBuffer2 ); 
/* Generated */    if( (retCode != ENUM_VALUE(RetCode,TA_SUCCESS,Success) ) || ((int)VALUE_HANDLE_GET(outNbElementDummy) != outputSize) )
/* Generated */    {
/* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx);
/* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outNBElement);
/* Generated */       return retCode;
/* Generated */    }
/* Generated */    VALUE_HANDLE_DEREF(outBegIdx)    = startIdx;
/* Generated */    VALUE_HANDLE_DEREF(outNBElement) = outputSize;
/* Generated */    return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
/* Generated */ }
Пример #5
0
     /* Generated */ TA_RetCode TA_S_STDDEV( int    startIdx,
                                             /* Generated */                         int    endIdx,
                                             /* Generated */                         const float  inReal[],
                                             /* Generated */                         int           optInTimePeriod, /* From 2 to 100000 */
                                             /* Generated */                         double        optInNbDev, /* From TA_REAL_MIN to TA_REAL_MAX */
                                             /* Generated */                         int          *outBegIdx,
                                             /* Generated */                         int          *outNbElement,
                                             /* Generated */                         double        outReal[] )
     /* Generated */ #endif
     /* Generated */ {
     /* Generated */    int i;
     /* Generated */    TA_RetCode retCode;
     /* Generated */    double tempReal;
     /* Generated */  #ifndef TA_FUNC_NO_RANGE_CHECK
     /* Generated */     if( startIdx < 0 )
         /* Generated */        return NAMESPACE(TA_RetCode)TA_OUT_OF_RANGE_START_INDEX;
     /* Generated */     if( (endIdx < 0) || (endIdx < startIdx))
         /* Generated */        return NAMESPACE(TA_RetCode)TA_OUT_OF_RANGE_END_INDEX;
     /* Generated */     #if !defined(_MANAGED) && !defined(_JAVA)
         /* Generated */     if( !inReal ) return NAMESPACE(TA_RetCode)TA_BAD_PARAM;
     /* Generated */     #endif
     /* Generated */     if( (int)optInTimePeriod == TA_INTEGER_DEFAULT )
         /* Generated */        optInTimePeriod = 5;
     /* Generated */     else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
         /* Generated */        return NAMESPACE(TA_RetCode)TA_BAD_PARAM;
     /* Generated */     if( optInNbDev == TA_REAL_DEFAULT )
         /* Generated */        optInNbDev = 1.000000e+0;
     /* Generated */     else if( (optInNbDev < -3.000000e+37) ||  (optInNbDev > 3.000000e+37) )
         /* Generated */        return NAMESPACE(TA_RetCode)TA_BAD_PARAM;
     /* Generated */     #if !defined(_MANAGED) && !defined(_JAVA)
         /* Generated */     if( !outReal )
             /* Generated */        return NAMESPACE(TA_RetCode)TA_BAD_PARAM;
     /* Generated */     #endif
     /* Generated */  #endif
     /* Generated */    retCode = FUNCTION_CALL(INT_VAR)( startIdx, endIdx,
     /* Generated */                                      inReal, optInTimePeriod,
     /* Generated */                                      outBegIdx, outNbElement, outReal );
     /* Generated */    if( retCode != NAMESPACE(TA_RetCode)TA_SUCCESS )
         /* Generated */       return retCode;
     /* Generated */    if( optInNbDev != 1.0 )
         /* Generated */    {
         /* Generated */       for( i=0; i < (int)VALUE_HANDLE_DEREF(outNbElement); i++ )
             /* Generated */       {
             /* Generated */          tempReal = outReal[i];
             /* Generated */          if( !TA_IS_ZERO_OR_NEG(tempReal) )
                 /* Generated */             outReal[i] = sqrt(tempReal) * optInNbDev;
             /* Generated */          else
                 /* Generated */             outReal[i] = (double)0.0;
             /* Generated */
         }
         /* Generated */
     }
     /* Generated */    else
         /* Generated */    {
         /* Generated */       for( i=0; i < (int)VALUE_HANDLE_DEREF(outNbElement); i++ )
             /* Generated */       {
             /* Generated */          tempReal = outReal[i];
             /* Generated */          if( !TA_IS_ZERO_OR_NEG(tempReal) )
                 /* Generated */             outReal[i] = sqrt(tempReal);
             /* Generated */          else
                 /* Generated */             outReal[i] = (double)0.0;
             /* Generated */
         }
         /* Generated */
     }
     /* Generated */    return NAMESPACE(TA_RetCode)TA_SUCCESS;
     /* Generated */
 }
Пример #6
0
/* Generated */ TA_RetCode TA_S_TEMA( int    startIdx,
/* Generated */                       int    endIdx,
/* Generated */                       const float  inReal[],
/* Generated */                       int           optInTimePeriod, /* From 2 to 100000 */
/* Generated */                       int          *outBegIdx,
/* Generated */                       int          *outNbElement,
/* Generated */                       double        outReal[] )
/* Generated */ #endif
/* Generated */ {
/* Generated */    ARRAY_REF(firstEMA);
/* Generated */    ARRAY_REF(secondEMA);
/* Generated */    double k;
/* Generated */    VALUE_HANDLE_INT(firstEMABegIdx);
/* Generated */    VALUE_HANDLE_INT(firstEMANbElement);
/* Generated */    VALUE_HANDLE_INT(secondEMABegIdx);
/* Generated */    VALUE_HANDLE_INT(secondEMANbElement);
/* Generated */    VALUE_HANDLE_INT(thirdEMABegIdx);
/* Generated */    VALUE_HANDLE_INT(thirdEMANbElement);
/* Generated */    int tempInt, outIdx, lookbackTotal, lookbackEMA;
/* Generated */    int firstEMAIdx, secondEMAIdx;
/* Generated */    TA_RetCode retCode;
/* Generated */  #ifndef TA_FUNC_NO_RANGE_CHECK
/* Generated */     if( startIdx < 0 )
/* Generated */        return NAMESPACE(TA_RetCode)TA_OUT_OF_RANGE_START_INDEX;
/* Generated */     if( (endIdx < 0) || (endIdx < startIdx))
/* Generated */        return NAMESPACE(TA_RetCode)TA_OUT_OF_RANGE_END_INDEX;
/* Generated */     #if !defined(_MANAGED) && !defined(_JAVA)
/* Generated */     if( !inReal ) return NAMESPACE(TA_RetCode)TA_BAD_PARAM;
/* Generated */     #endif 
/* Generated */     if( (int)optInTimePeriod == TA_INTEGER_DEFAULT )
/* Generated */        optInTimePeriod = 30;
/* Generated */     else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
/* Generated */        return NAMESPACE(TA_RetCode)TA_BAD_PARAM;
/* Generated */     #if !defined(_MANAGED) && !defined(_JAVA)
/* Generated */     if( !outReal )
/* Generated */        return NAMESPACE(TA_RetCode)TA_BAD_PARAM;
/* Generated */     #endif 
/* Generated */  #endif 
/* Generated */    VALUE_HANDLE_DEREF_TO_ZERO(outNbElement);
/* Generated */    VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx);
/* Generated */    lookbackEMA = LOOKBACK_CALL(EMA)( optInTimePeriod );
/* Generated */    lookbackTotal = lookbackEMA * 3;
/* Generated */    if( startIdx < lookbackTotal )
/* Generated */       startIdx = lookbackTotal;
/* Generated */    if( startIdx > endIdx )
/* Generated */       return NAMESPACE(TA_RetCode)TA_SUCCESS; 
/* Generated */    tempInt = lookbackTotal+(endIdx-startIdx)+1;
/* Generated */    ARRAY_ALLOC(firstEMA,tempInt);
/* Generated */    #if !defined( _JAVA )
/* Generated */       if( !firstEMA )
/* Generated */          return NAMESPACE(TA_RetCode)TA_ALLOC_ERR;
/* Generated */    #endif
/* Generated */    k = PER_TO_K(optInTimePeriod);
/* Generated */    retCode = FUNCTION_CALL(INT_EMA)( startIdx-(lookbackEMA*2), endIdx, inReal,
/* Generated */                                      optInTimePeriod, k,
/* Generated */                                      VALUE_HANDLE_OUT(firstEMABegIdx), VALUE_HANDLE_OUT(firstEMANbElement),
/* Generated */ 								     firstEMA );
/* Generated */    if( (retCode != NAMESPACE(TA_RetCode)TA_SUCCESS ) || (VALUE_HANDLE_GET(firstEMANbElement) == 0) )
/* Generated */    {
/* Generated */       ARRAY_FREE( firstEMA );
/* Generated */       return retCode;
/* Generated */    }
/* Generated */    ARRAY_ALLOC(secondEMA,VALUE_HANDLE_GET(firstEMANbElement));
/* Generated */    #if !defined( _JAVA )
/* Generated */       if( !secondEMA )
/* Generated */       {
/* Generated */          ARRAY_FREE( firstEMA );
/* Generated */          return NAMESPACE(TA_RetCode)TA_ALLOC_ERR;
/* Generated */       }   
/* Generated */    #endif
/* Generated */    retCode = FUNCTION_CALL_DOUBLE(INT_EMA)( 0, VALUE_HANDLE_GET(firstEMANbElement)-1, firstEMA,
/* Generated */                                             optInTimePeriod, k,
/* Generated */                                             VALUE_HANDLE_OUT(secondEMABegIdx), VALUE_HANDLE_OUT(secondEMANbElement), 
/* Generated */ 						                    secondEMA );
/* Generated */    if( (retCode != NAMESPACE(TA_RetCode)TA_SUCCESS ) || (VALUE_HANDLE_GET(secondEMANbElement) == 0) )      
/* Generated */    {
/* Generated */       ARRAY_FREE( firstEMA );
/* Generated */       ARRAY_FREE( secondEMA );
/* Generated */       return retCode;
/* Generated */    }
/* Generated */    retCode = FUNCTION_CALL_DOUBLE(INT_EMA)( 0, VALUE_HANDLE_GET(secondEMANbElement)-1, secondEMA,
/* Generated */                                             optInTimePeriod, k,
/* Generated */                                             VALUE_HANDLE_OUT(thirdEMABegIdx), VALUE_HANDLE_OUT(thirdEMANbElement),
/* Generated */                                             outReal );
/* Generated */    if( (retCode != NAMESPACE(TA_RetCode)TA_SUCCESS ) || (VALUE_HANDLE_GET(thirdEMANbElement) == 0) )
/* Generated */    {
/* Generated */       ARRAY_FREE( firstEMA );
/* Generated */       ARRAY_FREE( secondEMA );
/* Generated */       return retCode;
/* Generated */    }
/* Generated */    firstEMAIdx  = VALUE_HANDLE_GET(thirdEMABegIdx) + VALUE_HANDLE_GET(secondEMABegIdx);
/* Generated */    secondEMAIdx = VALUE_HANDLE_GET(thirdEMABegIdx);
/* Generated */    VALUE_HANDLE_DEREF(outBegIdx) = firstEMAIdx + VALUE_HANDLE_GET(firstEMABegIdx);
/* Generated */    outIdx = 0;
/* Generated */    while( outIdx < VALUE_HANDLE_GET(thirdEMANbElement) ) 
/* Generated */    {
/* Generated */       outReal[outIdx] += (3.0*firstEMA[firstEMAIdx++]) - (3.0*secondEMA[secondEMAIdx++]);
/* Generated */       outIdx++;
/* Generated */    }
/* Generated */    ARRAY_FREE( firstEMA );
/* Generated */    ARRAY_FREE( secondEMA );
/* Generated */    VALUE_HANDLE_DEREF(outNbElement) = outIdx;
/* Generated */    return NAMESPACE(TA_RetCode)TA_SUCCESS;
/* Generated */ }