2

我正在使用 ta-lib 对烛台进行模式识别,但是,根据我使用的模式函数,我得到了不同的数字。这些数字代表什么有参考吗?

4

4 回答 4

3

-200 / -100 / 0 / +100 / +200

+200看涨形态并确认
+100看涨形态(大多数情况)
0
-100看跌形态
-200看跌形态并经过确认

例如
,在 CDLHIKKAKE 模式检测功能的情况下:
正如您在源代码中看到的:

https://sourceforge.net/p/ta-lib/code/HEAD/tree/trunk/ta-lib/c/src/ta_func/ta_CDLHIKKAKE.c#l240

您可以再获得一个 -100 或 +100(即 -200/+200):
如果您的模式有确认
因此,计算将是(模式+确认)

您可能会在某些日子检测到看跌模式,再过一天确认该模式。最后得到-200

于 2020-03-30T09:04:30.543 回答
2

It's TA-Lib's library who returns -100..+100 values. Wrapper changes nothing. The interpretation may vary in different functions but in general: value == 0 is false and value != 0 is true. Sign might represent direction.
As for CDLHANGINGMAN, its C code is here.

According to description:

   /* Proceed with the calculation for the requested range.
* Must have:
* - small real body
* - long lower shadow
* - no, or very short, upper shadow
* - body above or near the highs of the previous candle
* The meaning of "short", "long" and "near the highs" is specified with TA_SetCandleSettings;
* outInteger is negative (-1 to -100): hanging man is always bearish;
* the user should consider that a hanging man must appear in an uptrend, while this function does not consider it
*/

Although I think it's quite incorrect because CDLHANGINGMAN returns only -100 or 0.

        if( TA_REALBODY(i) < TA_CANDLEAVERAGE( BodyShort, BodyPeriodTotal, i ) &&                        // small rb
        TA_LOWERSHADOW(i) > TA_CANDLEAVERAGE( ShadowLong, ShadowLongPeriodTotal, i ) &&              // long lower shadow
        TA_UPPERSHADOW(i) < TA_CANDLEAVERAGE( ShadowVeryShort, ShadowVeryShortPeriodTotal, i ) &&    // very short upper shadow
        min( inClose[i], inOpen[i] ) >= inHigh[i-1] - TA_CANDLEAVERAGE( Near, NearPeriodTotal, i-1 ) // rb near the prior candle's highs
      )
        outInteger[outIdx++] = -100;
    else
        outInteger[outIdx++] = 0;

You can't get +100 from this function at all.

I haven't seen any complete reference. It's better to take a look into TA-func code to be sure. Candle funcs' code is quite simple.

于 2016-04-24T16:10:22.780 回答
0

根据这个讨论

-100 表示看跌的三星模式,其中中间蜡烛主体位于其他两个上方。相反,+100 表示看涨的三星模式,其中中间实体位于相邻实体下方。

该页面显示了一些示例和相关的源代码。

/* Proceed with the calculation for the requested range.
* Must have:
* - 3 consecutive doji days
* - the second doji is a star
* The meaning of "doji" is specified with TA_SetCandleSettings
* outInteger is positive (1 to 100) when bullish or negative (-1 to -100) when bearish
*/
i = startIdx;
outIdx = 0;
do
{
     if( TA_REALBODY(i-2) <= TA_CANDLEAVERAGE( BodyDoji, BodyPeriodTotal, i-2 ) &&    // 1st: doji
         TA_REALBODY(i-1) <= TA_CANDLEAVERAGE( BodyDoji, BodyPeriodTotal, i-2 ) &&    // 2nd: doji
         TA_REALBODY(i) <= TA_CANDLEAVERAGE( BodyDoji, BodyPeriodTotal, i-2 ) ) {     // 3rd: doji
         outInteger[outIdx] = 0;
         if ( TA_REALBODYGAPUP(i-1,i-2)                                                  // 2nd gaps up
              &&
              max(inOpen[i],inClose[i]) < max(inOpen[i-1],inClose[i-1])                  // 3rd is not higher than 2nd
            )
             outInteger[outIdx] = -100;
         if ( TA_REALBODYGAPDOWN(i-1,i-2)                                                // 2nd gaps down
              &&
              min(inOpen[i],inClose[i]) > min(inOpen[i-1],inClose[i-1])                  // 3rd is not lower than 2nd
            )
             outInteger[outIdx] = +100;
         outIdx++;
     }
     else
         outInteger[outIdx++] = 0;
     /* add the current range and subtract the first range: this is done after the pattern recognition 
     * when avgPeriod is not 0, that means "compare with the previous candles" (it excludes the current candle)
     */
     BodyPeriodTotal += TA_CANDLERANGE( BodyDoji, i-2 ) - TA_CANDLERANGE( BodyDoji, BodyTrailingIdx );
     i++;
     BodyTrailingIdx++;
} while( i <= endIdx );
于 2016-04-24T07:27:52.157 回答
-1

参考这个视频。他解释了 -100 和 100。它甚至引用了这一页。

https://youtu.be/lrYu9AnPw7Q?t=120

https://github.com/mrjbq7/ta-lib/issues/74

**-100 表示看跌的三星形态,其中中间蜡烛主体位于其他两个上方。相反,+100 表示看涨的三星模式,其中中间实体位于相邻实体下方。

在 Python 中使用 ta-lib 时,-100、+100、-200、+200 等数字是多少?**

于 2018-11-19T05:43:20.553 回答