示例#1
0
/**** Local functions definitions.     ****/
static TA_RetCode rangeTestFunction( TA_Libc *libHandle, 
                              TA_Integer startIdx,
                              TA_Integer endIdx,
                              TA_Real *outputBuffer,
                              TA_Integer *outBegIdx,
                              TA_Integer *outNbElement,
                              TA_Integer *lookback,
                              void *opaqueData,
                              unsigned int outputNb )
{
  TA_RetCode retCode;
  TA_RangeTestParam *testParam;
  TA_Real *dummyOutput;
  
  testParam = (TA_RangeTestParam *)opaqueData;   


  dummyOutput = TA_Malloc( libHandle, (endIdx-startIdx+1) * sizeof(TA_Real) );

  if( outputNb == 0 )
  {
     retCode = TA_STOCH( libHandle,
                         startIdx,
                         endIdx,
                         testParam->high,
                         testParam->low,
                         testParam->close,
                         testParam->test->optInKPeriod_0,
                         testParam->test->optInKSlowPeriod_1,
                         testParam->test->optInDPeriod_2,
                         testParam->test->optInMethod_3,                       
                         outBegIdx, outNbElement,
                         outputBuffer,
                         dummyOutput );

   }
   else
   {
     retCode = TA_STOCH( libHandle,
                         startIdx,
                         endIdx,
                         testParam->high,
                         testParam->low,
                         testParam->close,
                         testParam->test->optInKPeriod_0,
                         testParam->test->optInKSlowPeriod_1,
                         testParam->test->optInDPeriod_2,
                         testParam->test->optInMethod_3,                                                
                         outBegIdx, outNbElement,
                         dummyOutput, 
                         outputBuffer );
   }

   TA_Free( libHandle, dummyOutput );

   *lookback = TA_STOCH_Lookback( testParam->test->optInKPeriod_0,
                         testParam->test->optInKSlowPeriod_1,
                         testParam->test->optInDPeriod_2,
                         testParam->test->optInMethod_3 );

   return retCode;
}
示例#2
0
/**** Local functions definitions.     ****/
static TA_RetCode rangeTestFunction( 
                              TA_Integer startIdx,
                              TA_Integer endIdx,
                              TA_Real *outputBuffer,
                              TA_Integer *outBegIdx,
                              TA_Integer *outNbElement,
                              TA_Integer *lookback,
                              void *opaqueData,
                              unsigned int outputNb )
{
  TA_RetCode retCode;
  TA_RangeTestParam *testParam;
  TA_Real *dummyOutput;
  
  testParam = (TA_RangeTestParam *)opaqueData;   


  dummyOutput = TA_Malloc( (endIdx-startIdx+1) * sizeof(TA_Real) );
                     
  if( outputNb == 0 )
  {
     retCode = TA_STOCH(
                         startIdx,
                         endIdx,
                         testParam->high,
                         testParam->low,
                         testParam->close,
                         testParam->test->optInFastK_Period_0,
                         testParam->test->optInSlowK_Period_1,
                         testParam->test->optInSlowK_MAType_2,
                         testParam->test->optInSlowD_Period_3,
                         testParam->test->optInSlowD_MAType_4,
                         outBegIdx, outNbElement,
                         outputBuffer,
                         dummyOutput );

   }
   else
   {
     retCode = TA_STOCH(
                         startIdx,
                         endIdx,
                         testParam->high,
                         testParam->low,
                         testParam->close,
                         testParam->test->optInFastK_Period_0,
                         testParam->test->optInSlowK_Period_1,
                         testParam->test->optInSlowK_MAType_2,
                         testParam->test->optInSlowD_Period_3,
                         testParam->test->optInSlowD_MAType_4,
                         outBegIdx, outNbElement,
                         dummyOutput, 
                         outputBuffer );
   }

   TA_Free(  dummyOutput );

   *lookback = TA_STOCH_Lookback( testParam->test->optInFastK_Period_0,
                         testParam->test->optInSlowK_Period_1,
                         testParam->test->optInSlowK_MAType_2,
                         testParam->test->optInSlowD_Period_3,
                         testParam->test->optInSlowD_MAType_4 );

   return retCode;
}