⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_per_ohlc.c

📁 股票主要技术指标源码
💻 C
📖 第 1 页 / 共 2 页
字号:
                          &outNbElement,                          gBuffer[0].out0 );      break;   default:      retCode = TA_INTERNAL_ERROR(172);   }   /* Check that the input were preserved. */   errNb = checkDataSame( gBuffer[0].in, history->open,history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   errNb = checkDataSame( gBuffer[1].in, history->high, history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   errNb = checkDataSame( gBuffer[2].in, history->low,history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   errNb = checkDataSame( gBuffer[3].in, history->close,history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   CHECK_EXPECTED_VALUE( gBuffer[0].out0, 0 );   outBegIdx = outNbElement = 0;   /* Make another call where the input and the output are the    * same buffer.    */   switch( test->theFunction )   {   case TA_BOP_TEST:      retCode = TA_BOP( test->startIdx,                        test->endIdx,                        gBuffer[0].in,                        gBuffer[1].in,                        gBuffer[2].in,                        gBuffer[3].in,                        &outBegIdx,                        &outNbElement,                        gBuffer[0].in );      break;   case TA_AVGPRICE_TEST:      retCode = TA_AVGPRICE( test->startIdx,                          test->endIdx,                          gBuffer[0].in,                          gBuffer[1].in,                          gBuffer[2].in,                          gBuffer[3].in,                          &outBegIdx,                          &outNbElement,                          gBuffer[0].in );      break;   default:      retCode = TA_INTERNAL_ERROR(173);   }   /* Check that the input were preserved. */   errNb = checkDataSame( gBuffer[1].in, history->high, history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   errNb = checkDataSame( gBuffer[2].in, history->low,history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   errNb = checkDataSame( gBuffer[3].in, history->close,history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   /* The previous call should have the same output as this call.    *    * checkSameContent verify that all value different than NAN in    * the first parameter is identical in the second parameter.    */   errNb = checkSameContent( gBuffer[0].out0, gBuffer[0].in );   if( errNb != TA_TEST_PASS )      return errNb;   CHECK_EXPECTED_VALUE( gBuffer[0].in, 0 );   setInputBuffer( 0, history->open,  history->nbBars );   /* Make another call where the input and the output are the    * same buffer.    */   switch( test->theFunction )   {   case TA_BOP_TEST:      retCode = TA_BOP( test->startIdx,                        test->endIdx,                        gBuffer[0].in,                        gBuffer[1].in,                        gBuffer[2].in,                        gBuffer[3].in,                        &outBegIdx,                        &outNbElement,                        gBuffer[1].in );      break;   case TA_AVGPRICE_TEST:      retCode = TA_AVGPRICE( test->startIdx,                          test->endIdx,                          gBuffer[0].in,                          gBuffer[1].in,                          gBuffer[2].in,                          gBuffer[3].in,                          &outBegIdx,                          &outNbElement,                          gBuffer[1].in );      break;   default:      retCode = TA_INTERNAL_ERROR(174);   }   /* Check that the input were preserved. */   errNb = checkDataSame( gBuffer[0].in, history->open,history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   errNb = checkDataSame( gBuffer[2].in, history->low,history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   errNb = checkDataSame( gBuffer[3].in, history->close,history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   /* The previous call should have the same output as this call.    *    * checkSameContent verify that all value different than NAN in    * the first parameter is identical in the second parameter.    */   errNb = checkSameContent( gBuffer[0].out0, gBuffer[1].in );   if( errNb != TA_TEST_PASS )      return errNb;   CHECK_EXPECTED_VALUE( gBuffer[1].in, 0 );   setInputBuffer( 1, history->high,   history->nbBars );   /* Make another call where the input and the output are the    * same buffer.    */   switch( test->theFunction )   {   case TA_BOP_TEST:      retCode = TA_BOP( test->startIdx,                        test->endIdx,                        gBuffer[0].in,                        gBuffer[1].in,                        gBuffer[2].in,                        gBuffer[3].in,                        &outBegIdx,                        &outNbElement,                        gBuffer[2].in );      break;   case TA_AVGPRICE_TEST:      retCode = TA_AVGPRICE( test->startIdx,                          test->endIdx,                          gBuffer[0].in,                          gBuffer[1].in,                          gBuffer[2].in,                          gBuffer[3].in,                          &outBegIdx,                          &outNbElement,                          gBuffer[2].in );      break;   default:      retCode = TA_INTERNAL_ERROR(175);   }   /* Check that the input were preserved. */   errNb = checkDataSame( gBuffer[0].in, history->open,history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   errNb = checkDataSame( gBuffer[1].in, history->high, history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   errNb = checkDataSame( gBuffer[3].in, history->close, history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   /* The previous call should have the same output as this call.    *    * checkSameContent verify that all value different than NAN in    * the first parameter is identical in the second parameter.    */   errNb = checkSameContent( gBuffer[0].out0, gBuffer[2].in );   if( errNb != TA_TEST_PASS )      return errNb;   CHECK_EXPECTED_VALUE( gBuffer[2].in, 0 );   setInputBuffer( 2, history->low, history->nbBars );   /* Make another call where the input and the output are the    * same buffer.    */   switch( test->theFunction )   {   case TA_BOP_TEST:      retCode = TA_BOP( test->startIdx,                        test->endIdx,                        gBuffer[0].in,                        gBuffer[1].in,                        gBuffer[2].in,                        gBuffer[3].in,                        &outBegIdx,                        &outNbElement,                        gBuffer[3].in );      break;   case TA_AVGPRICE_TEST:      retCode = TA_AVGPRICE( test->startIdx,                          test->endIdx,                          gBuffer[0].in,                          gBuffer[1].in,                          gBuffer[2].in,                          gBuffer[3].in,                          &outBegIdx,                          &outNbElement,                          gBuffer[3].in );      break;   default:      retCode = TA_INTERNAL_ERROR(176);   }   /* Check that the input were preserved. */   errNb = checkDataSame( gBuffer[0].in, history->open,history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   errNb = checkDataSame( gBuffer[1].in, history->high, history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   errNb = checkDataSame( gBuffer[2].in, history->low, history->nbBars );   if( errNb != TA_TEST_PASS )      return errNb;   /* The previous call should have the same output as this call.    *    * checkSameContent verify that all value different than NAN in    * the first parameter is identical in the second parameter.    */   errNb = checkSameContent( gBuffer[0].out0, gBuffer[3].in );   if( errNb != TA_TEST_PASS )      return errNb;   CHECK_EXPECTED_VALUE( gBuffer[3].in, 0 );   setInputBuffer( 3, history->close, history->nbBars );   /* Do a systematic test of most of the    * possible startIdx/endIdx range.    */   testParam.test  = test;   testParam.open  = history->open;   testParam.high  = history->high;   testParam.low   = history->low;   testParam.close = history->close;   if( test->doRangeTestFlag )   {      errNb = doRangeTest( rangeTestFunction,                            TA_FUNC_UNST_NONE,                           (void *)&testParam, 1, 0 );      if( errNb != TA_TEST_PASS )         return errNb;   }   return TA_TEST_PASS;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -