1 /* TA-LIB Copyright (c) 1999-2007, Mario Fortier
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or
5  * without modification, are permitted provided that the following
6  * conditions are met:
7  *
8  * - Redistributions of source code must retain the above copyright
9  *   notice, this list of conditions and the following disclaimer.
10  *
11  * - Redistributions in binary form must reproduce the above copyright
12  *   notice, this list of conditions and the following disclaimer in
13  *   the documentation and/or other materials provided with the
14  *   distribution.
15  *
16  * - Neither name of author nor the names of its contributors
17  *   may be used to endorse or promote products derived from this
18  *   software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 /* List of contributors:
35  *
36  *  Initial  Name/description
37  *  -------------------------------------------------------------------
38  *  AC       Angelo Ciceri
39  *
40  *
41  * Change history:
42  *
43  *  MMDDYY BY   Description
44  *  -------------------------------------------------------------------
45  *  102304 AC   Creation
46  *
47  */
48 
49 /**** START GENCODE SECTION 1 - DO NOT DELETE THIS LINE ****/
50 /* All code within this section is automatically
51  * generated by gen_code. Any modification will be lost
52  * next time gen_code is run.
53  */
54 /* Generated */
55 /* Generated */ #if defined( _MANAGED )
56 /* Generated */    #include "TA-Lib-Core.h"
57 /* Generated */    #define TA_INTERNAL_ERROR(Id) (RetCode::InternalError)
58 /* Generated */    namespace TicTacTec { namespace TA { namespace Library {
59 /* Generated */ #elif defined( _JAVA )
60 /* Generated */    #include "ta_defs.h"
61 /* Generated */    #include "ta_java_defs.h"
62 /* Generated */    #define TA_INTERNAL_ERROR(Id) (RetCode.InternalError)
63 /* Generated */ #else
64 /* Generated */    #include <string.h>
65 /* Generated */    #include <math.h>
66 /* Generated */    #include "ta_func.h"
67 /* Generated */ #endif
68 /* Generated */
69 /* Generated */ #ifndef TA_UTILITY_H
70 /* Generated */    #include "ta_utility.h"
71 /* Generated */ #endif
72 /* Generated */
73 /* Generated */ #ifndef TA_MEMORY_H
74 /* Generated */    #include "ta_memory.h"
75 /* Generated */ #endif
76 /* Generated */
77 /* Generated */ #define TA_PREFIX(x) TA_##x
78 /* Generated */ #define INPUT_TYPE   double
79 /* Generated */
80 /* Generated */ #if defined( _MANAGED )
CdlAbandonedBabyLookback(double optInPenetration)81 /* Generated */ int Core::CdlAbandonedBabyLookback( double        optInPenetration )  /* From 0 to TA_REAL_MAX */
82 /* Generated */
83 /* Generated */ #elif defined( _JAVA )
84 /* Generated */ public int cdlAbandonedBabyLookback( double        optInPenetration )  /* From 0 to TA_REAL_MAX */
85 /* Generated */
86 /* Generated */ #else
87 /* Generated */ int TA_CDLABANDONEDBABY_Lookback( double        optInPenetration )  /* From 0 to TA_REAL_MAX */
88 /* Generated */
89 /* Generated */ #endif
90 /**** END GENCODE SECTION 1 - DO NOT DELETE THIS LINE ****/
91 {
92    /* insert local variable here */
93 
94 /**** START GENCODE SECTION 2 - DO NOT DELETE THIS LINE ****/
95 /* Generated */ #ifndef TA_FUNC_NO_RANGE_CHECK
96 /* Generated */    if( optInPenetration == TA_REAL_DEFAULT )
97 /* Generated */       optInPenetration = 3.000000e-1;
98 /* Generated */    else if( (optInPenetration < 0.000000e+0) ||/* Generated */  (optInPenetration > 3.000000e+37) )
99 /* Generated */       return -1;
100 /* Generated */
101 /* Generated */ #endif /* TA_FUNC_NO_RANGE_CHECK */
102 /**** END GENCODE SECTION 2 - DO NOT DELETE THIS LINE ****/
103 
104    /* insert lookback code here. */
105     UNUSED_VARIABLE(optInPenetration);
106 
107     return max( max( TA_CANDLEAVGPERIOD(BodyDoji), TA_CANDLEAVGPERIOD(BodyLong) ),
108                 TA_CANDLEAVGPERIOD(BodyShort)
109             ) + 2;
110 }
111 
112 /**** START GENCODE SECTION 3 - DO NOT DELETE THIS LINE ****/
113 /*
114  * TA_CDLABANDONEDBABY - Abandoned Baby
115  *
116  * Input  = Open, High, Low, Close
117  * Output = int
118  *
119  * Optional Parameters
120  * -------------------
121  * optInPenetration:(From 0 to TA_REAL_MAX)
122  *    Percentage of penetration of a candle within another candle
123  *
124  *
125  */
126 /* Generated */
127 /* Generated */ #if defined( _MANAGED ) && defined( USE_SUBARRAY )
128 /* Generated */ enum class Core::RetCode Core::CdlAbandonedBaby( int    startIdx,
129 /* Generated */                                                  int    endIdx,
130 /* Generated */                                                  SubArray^    inOpen,
131 /* Generated */                                                  SubArray^    inHigh,
132 /* Generated */                                                  SubArray^    inLow,
133 /* Generated */                                                  SubArray^    inClose,
134 /* Generated */                                                  double        optInPenetration, /* From 0 to TA_REAL_MAX */
135 /* Generated */                                                  [Out]int%    outBegIdx,
136 /* Generated */                                                  [Out]int%    outNBElement,
137 /* Generated */                                                  cli::array<int>^  outInteger )
138 /* Generated */ #elif defined( _MANAGED )
139 /* Generated */ enum class Core::RetCode Core::CdlAbandonedBaby( int    startIdx,
140 /* Generated */                                                  int    endIdx,
141 /* Generated */                                                  cli::array<double>^ inOpen,
142 /* Generated */                                                  cli::array<double>^ inHigh,
143 /* Generated */                                                  cli::array<double>^ inLow,
144 /* Generated */                                                  cli::array<double>^ inClose,
145 /* Generated */                                                  double        optInPenetration, /* From 0 to TA_REAL_MAX */
146 /* Generated */                                                  [Out]int%    outBegIdx,
147 /* Generated */                                                  [Out]int%    outNBElement,
148 /* Generated */                                                  cli::array<int>^  outInteger )
149 /* Generated */ #elif defined( _JAVA )
150 /* Generated */ public RetCode cdlAbandonedBaby( int    startIdx,
151 /* Generated */                                  int    endIdx,
152 /* Generated */                                  double       inOpen[],
153 /* Generated */                                  double       inHigh[],
154 /* Generated */                                  double       inLow[],
155 /* Generated */                                  double       inClose[],
156 /* Generated */                                  double        optInPenetration, /* From 0 to TA_REAL_MAX */
157 /* Generated */                                  MInteger     outBegIdx,
158 /* Generated */                                  MInteger     outNBElement,
159 /* Generated */                                  int           outInteger[] )
160 /* Generated */ #else
161 /* Generated */ TA_RetCode TA_CDLABANDONEDBABY( int    startIdx,
162 /* Generated */                                 int    endIdx,
163 /* Generated */                                 const double inOpen[],
164 /* Generated */                                 const double inHigh[],
165 /* Generated */                                 const double inLow[],
166 /* Generated */                                 const double inClose[],
167 /* Generated */                                 double        optInPenetration, /* From 0 to TA_REAL_MAX */
168 /* Generated */                                 int          *outBegIdx,
169 /* Generated */                                 int          *outNBElement,
170 /* Generated */                                 int           outInteger[] )
171 /* Generated */ #endif
172 /**** END GENCODE SECTION 3 - DO NOT DELETE THIS LINE ****/
173 {
174    /* Insert local variables here. */
175     double BodyDojiPeriodTotal, BodyLongPeriodTotal, BodyShortPeriodTotal;
176     int i, outIdx, BodyDojiTrailingIdx, BodyLongTrailingIdx, BodyShortTrailingIdx, lookbackTotal;
177 
178 /**** START GENCODE SECTION 4 - DO NOT DELETE THIS LINE ****/
179 /* Generated */
180 /* Generated */ #ifndef TA_FUNC_NO_RANGE_CHECK
181 /* Generated */
182 /* Generated */    /* Validate the requested output range. */
183 /* Generated */    if( startIdx < 0 )
184 /* Generated */       return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_START_INDEX,OutOfRangeStartIndex);
185 /* Generated */    if( (endIdx < 0) || (endIdx < startIdx))
186 /* Generated */       return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_END_INDEX,OutOfRangeEndIndex);
187 /* Generated */
188 /* Generated */    #if !defined(_JAVA)
189 /* Generated */    /* Verify required price component. */
190 /* Generated */    if(!inOpen||!inHigh||!inLow||!inClose)
191 /* Generated */       return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
192 /* Generated */
193 /* Generated */    #endif /* !defined(_JAVA)*/
194 /* Generated */    if( optInPenetration == TA_REAL_DEFAULT )
195 /* Generated */       optInPenetration = 3.000000e-1;
196 /* Generated */    else if( (optInPenetration < 0.000000e+0) ||/* Generated */  (optInPenetration > 3.000000e+37) )
197 /* Generated */       return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
198 /* Generated */
199 /* Generated */    #if !defined(_JAVA)
200 /* Generated */    if( !outInteger )
201 /* Generated */       return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
202 /* Generated */
203 /* Generated */    #endif /* !defined(_JAVA) */
204 /* Generated */ #endif /* TA_FUNC_NO_RANGE_CHECK */
205 /* Generated */
206 /**** END GENCODE SECTION 4 - DO NOT DELETE THIS LINE ****/
207 
208    /* Identify the minimum number of price bar needed
209     * to calculate at least one output.
210     */
211 
212    lookbackTotal = LOOKBACK_CALL(CDLABANDONEDBABY)(optInPenetration);
213 
214    /* Move up the start index if there is not
215     * enough initial data.
216     */
217    if( startIdx < lookbackTotal )
218       startIdx = lookbackTotal;
219 
220    /* Make sure there is still something to evaluate. */
221    if( startIdx > endIdx )
222    {
223       VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx);
224       VALUE_HANDLE_DEREF_TO_ZERO(outNBElement);
225       return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
226    }
227 
228    /* Do the calculation using tight loops. */
229    /* Add-up the initial period, except for the last value. */
230    BodyLongPeriodTotal = 0;
231    BodyDojiPeriodTotal = 0;
232    BodyShortPeriodTotal = 0;
233    BodyLongTrailingIdx = startIdx -2 - TA_CANDLEAVGPERIOD(BodyLong);
234    BodyDojiTrailingIdx = startIdx -1 - TA_CANDLEAVGPERIOD(BodyDoji);
235    BodyShortTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(BodyShort);
236 
237    i = BodyLongTrailingIdx;
238    while( i < startIdx-2 ) {
239         BodyLongPeriodTotal += TA_CANDLERANGE( BodyLong, i );
240         i++;
241    }
242    i = BodyDojiTrailingIdx;
243    while( i < startIdx-1 ) {
244         BodyDojiPeriodTotal += TA_CANDLERANGE( BodyDoji, i );
245         i++;
246    }
247    i = BodyShortTrailingIdx;
248    while( i < startIdx ) {
249         BodyShortPeriodTotal += TA_CANDLERANGE( BodyShort, i );
250         i++;
251    }
252    i = startIdx;
253 
254    /* Proceed with the calculation for the requested range.
255     * Must have:
256     * - first candle: long white (black) real body
257     * - second candle: doji
258     * - third candle: black (white) real body that moves well within the first candle's real body
259     * - upside (downside) gap between the first candle and the doji (the shadows of the two candles don't touch)
260     * - downside (upside) gap between the doji and the third candle (the shadows of the two candles don't touch)
261     * The meaning of "doji" and "long" is specified with TA_SetCandleSettings
262     * The meaning of "moves well within" is specified with optInPenetration and "moves" should mean the real body should
263     * not be short ("short" is specified with TA_SetCandleSettings) - Greg Morris wants it to be long, someone else want
264     * it to be relatively long
265     * outInteger is positive (1 to 100) when it's an abandoned baby bottom or negative (-1 to -100) when it's
266     * an abandoned baby top; the user should consider that an abandoned baby is significant when it appears in
267     * an uptrend or downtrend, while this function does not consider the trend
268     */
269    outIdx = 0;
270    do
271    {
272         if( TA_REALBODY(i-2) > TA_CANDLEAVERAGE( BodyLong, BodyLongPeriodTotal, i-2 ) &&         // 1st: long
273             TA_REALBODY(i-1) <= TA_CANDLEAVERAGE( BodyDoji, BodyDojiPeriodTotal, i-1 ) &&        // 2nd: doji
274             TA_REALBODY(i) > TA_CANDLEAVERAGE( BodyShort, BodyShortPeriodTotal, i ) &&           // 3rd: longer than short
275             ( ( TA_CANDLECOLOR(i-2) == 1 &&                                                         // 1st white
276                 TA_CANDLECOLOR(i) == -1 &&                                                          // 3rd black
277                 inClose[i] < inClose[i-2] - TA_REALBODY(i-2) * optInPenetration &&                  // 3rd closes well within 1st rb
278                 TA_CANDLEGAPUP(i-1,i-2) &&                                                          // upside gap between 1st and 2nd
279                 TA_CANDLEGAPDOWN(i,i-1)                                                             // downside gap between 2nd and 3rd
280               )
281               ||
282               (
283                 TA_CANDLECOLOR(i-2) == -1 &&                                                        // 1st black
284                 TA_CANDLECOLOR(i) == 1 &&                                                           // 3rd white
285                 inClose[i] > inClose[i-2] + TA_REALBODY(i-2) * optInPenetration &&                  // 3rd closes well within 1st rb
286                 TA_CANDLEGAPDOWN(i-1,i-2) &&                                                        // downside gap between 1st and 2nd
287                 TA_CANDLEGAPUP(i,i-1)                                                               // upside gap between 2nd and 3rd
288               )
289             )
290           )
291             outInteger[outIdx++] = TA_CANDLECOLOR(i) * 100;
292         else
293             outInteger[outIdx++] = 0;
294         /* add the current range and subtract the first range: this is done after the pattern recognition
295          * when avgPeriod is not 0, that means "compare with the previous candles" (it excludes the current candle)
296          */
297         BodyLongPeriodTotal += TA_CANDLERANGE( BodyLong, i-2 ) - TA_CANDLERANGE( BodyLong, BodyLongTrailingIdx );
298         BodyDojiPeriodTotal += TA_CANDLERANGE( BodyDoji, i-1 ) - TA_CANDLERANGE( BodyDoji, BodyDojiTrailingIdx );
299         BodyShortPeriodTotal += TA_CANDLERANGE( BodyShort, i ) - TA_CANDLERANGE( BodyShort, BodyShortTrailingIdx );
300         i++;
301         BodyLongTrailingIdx++;
302         BodyDojiTrailingIdx++;
303         BodyShortTrailingIdx++;
304    } while( i <= endIdx );
305 
306    /* All done. Indicate the output limits and return. */
307    VALUE_HANDLE_DEREF(outNBElement) = outIdx;
308    VALUE_HANDLE_DEREF(outBegIdx)    = startIdx;
309 
310    return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
311 }
312 
313 /**** START GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
314 /* Generated */
315 /* Generated */ #define  USE_SINGLE_PRECISION_INPUT
316 /* Generated */ #if !defined( _MANAGED ) && !defined( _JAVA )
317 /* Generated */    #undef   TA_PREFIX
318 /* Generated */    #define  TA_PREFIX(x) TA_S_##x
319 /* Generated */ #endif
320 /* Generated */ #undef   INPUT_TYPE
321 /* Generated */ #define  INPUT_TYPE float
322 /* Generated */ #if defined( _MANAGED )
323 /* Generated */ enum class Core::RetCode Core::CdlAbandonedBaby( int    startIdx,
324 /* Generated */                                                  int    endIdx,
325 /* Generated */                                                  cli::array<float>^ inOpen,
326 /* Generated */                                                  cli::array<float>^ inHigh,
327 /* Generated */                                                  cli::array<float>^ inLow,
328 /* Generated */                                                  cli::array<float>^ inClose,
329 /* Generated */                                                  double        optInPenetration, /* From 0 to TA_REAL_MAX */
330 /* Generated */                                                  [Out]int%    outBegIdx,
331 /* Generated */                                                  [Out]int%    outNBElement,
332 /* Generated */                                                  cli::array<int>^  outInteger )
333 /* Generated */ #elif defined( _JAVA )
334 /* Generated */ public RetCode cdlAbandonedBaby( int    startIdx,
335 /* Generated */                                  int    endIdx,
336 /* Generated */                                  float        inOpen[],
337 /* Generated */                                  float        inHigh[],
338 /* Generated */                                  float        inLow[],
339 /* Generated */                                  float        inClose[],
340 /* Generated */                                  double        optInPenetration, /* From 0 to TA_REAL_MAX */
341 /* Generated */                                  MInteger     outBegIdx,
342 /* Generated */                                  MInteger     outNBElement,
343 /* Generated */                                  int           outInteger[] )
344 /* Generated */ #else
345 /* Generated */ TA_RetCode TA_S_CDLABANDONEDBABY( int    startIdx,
346 /* Generated */                                   int    endIdx,
347 /* Generated */                                   const float  inOpen[],
348 /* Generated */                                   const float  inHigh[],
349 /* Generated */                                   const float  inLow[],
350 /* Generated */                                   const float  inClose[],
351 /* Generated */                                   double        optInPenetration, /* From 0 to TA_REAL_MAX */
352 /* Generated */                                   int          *outBegIdx,
353 /* Generated */                                   int          *outNBElement,
354 /* Generated */                                   int           outInteger[] )
355 /* Generated */ #endif
356 /* Generated */ {
357 /* Generated */     double BodyDojiPeriodTotal, BodyLongPeriodTotal, BodyShortPeriodTotal;
358 /* Generated */     int i, outIdx, BodyDojiTrailingIdx, BodyLongTrailingIdx, BodyShortTrailingIdx, lookbackTotal;
359 /* Generated */  #ifndef TA_FUNC_NO_RANGE_CHECK
360 /* Generated */     if( startIdx < 0 )
361 /* Generated */        return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_START_INDEX,OutOfRangeStartIndex);
362 /* Generated */     if( (endIdx < 0) || (endIdx < startIdx))
363 /* Generated */        return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_END_INDEX,OutOfRangeEndIndex);
364 /* Generated */     #if !defined(_JAVA)
365 /* Generated */     if(!inOpen||!inHigh||!inLow||!inClose)
366 /* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
367 /* Generated */     #endif
368 /* Generated */     if( optInPenetration == TA_REAL_DEFAULT )
369 /* Generated */        optInPenetration = 3.000000e-1;
370 /* Generated */     else if( (optInPenetration < 0.000000e+0) ||  (optInPenetration > 3.000000e+37) )
371 /* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
372 /* Generated */     #if !defined(_JAVA)
373 /* Generated */     if( !outInteger )
374 /* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
375 /* Generated */     #endif
376 /* Generated */  #endif
377 /* Generated */    lookbackTotal = LOOKBACK_CALL(CDLABANDONEDBABY)(optInPenetration);
378 /* Generated */    if( startIdx < lookbackTotal )
379 /* Generated */       startIdx = lookbackTotal;
380 /* Generated */    if( startIdx > endIdx )
381 /* Generated */    {
382 /* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx);
383 /* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outNBElement);
384 /* Generated */       return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
385 /* Generated */    }
386 /* Generated */    BodyLongPeriodTotal = 0;
387 /* Generated */    BodyDojiPeriodTotal = 0;
388 /* Generated */    BodyShortPeriodTotal = 0;
389 /* Generated */    BodyLongTrailingIdx = startIdx -2 - TA_CANDLEAVGPERIOD(BodyLong);
390 /* Generated */    BodyDojiTrailingIdx = startIdx -1 - TA_CANDLEAVGPERIOD(BodyDoji);
391 /* Generated */    BodyShortTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(BodyShort);
392 /* Generated */    i = BodyLongTrailingIdx;
393 /* Generated */    while( i < startIdx-2 ) {
394 /* Generated */         BodyLongPeriodTotal += TA_CANDLERANGE( BodyLong, i );
395 /* Generated */         i++;
396 /* Generated */    }
397 /* Generated */    i = BodyDojiTrailingIdx;
398 /* Generated */    while( i < startIdx-1 ) {
399 /* Generated */         BodyDojiPeriodTotal += TA_CANDLERANGE( BodyDoji, i );
400 /* Generated */         i++;
401 /* Generated */    }
402 /* Generated */    i = BodyShortTrailingIdx;
403 /* Generated */    while( i < startIdx ) {
404 /* Generated */         BodyShortPeriodTotal += TA_CANDLERANGE( BodyShort, i );
405 /* Generated */         i++;
406 /* Generated */    }
407 /* Generated */    i = startIdx;
408 /* Generated */    outIdx = 0;
409 /* Generated */    do
410 /* Generated */    {
411 /* Generated */         if( TA_REALBODY(i-2) > TA_CANDLEAVERAGE( BodyLong, BodyLongPeriodTotal, i-2 ) &&         // 1st: long
412 /* Generated */             TA_REALBODY(i-1) <= TA_CANDLEAVERAGE( BodyDoji, BodyDojiPeriodTotal, i-1 ) &&        // 2nd: doji
413 /* Generated */             TA_REALBODY(i) > TA_CANDLEAVERAGE( BodyShort, BodyShortPeriodTotal, i ) &&           // 3rd: longer than short
414 /* Generated */             ( ( TA_CANDLECOLOR(i-2) == 1 &&                                                         // 1st white
415 /* Generated */                 TA_CANDLECOLOR(i) == -1 &&                                                          // 3rd black
416 /* Generated */                 inClose[i] < inClose[i-2] - TA_REALBODY(i-2) * optInPenetration &&                  // 3rd closes well within 1st rb
417 /* Generated */                 TA_CANDLEGAPUP(i-1,i-2) &&                                                          // upside gap between 1st and 2nd
418 /* Generated */                 TA_CANDLEGAPDOWN(i,i-1)                                                             // downside gap between 2nd and 3rd
419 /* Generated */               )
420 /* Generated */               ||
421 /* Generated */               (
422 /* Generated */                 TA_CANDLECOLOR(i-2) == -1 &&                                                        // 1st black
423 /* Generated */                 TA_CANDLECOLOR(i) == 1 &&                                                           // 3rd white
424 /* Generated */                 inClose[i] > inClose[i-2] + TA_REALBODY(i-2) * optInPenetration &&                  // 3rd closes well within 1st rb
425 /* Generated */                 TA_CANDLEGAPDOWN(i-1,i-2) &&                                                        // downside gap between 1st and 2nd
426 /* Generated */                 TA_CANDLEGAPUP(i,i-1)                                                               // upside gap between 2nd and 3rd
427 /* Generated */               )
428 /* Generated */             )
429 /* Generated */           )
430 /* Generated */             outInteger[outIdx++] = TA_CANDLECOLOR(i) * 100;
431 /* Generated */         else
432 /* Generated */             outInteger[outIdx++] = 0;
433 /* Generated */         BodyLongPeriodTotal += TA_CANDLERANGE( BodyLong, i-2 ) - TA_CANDLERANGE( BodyLong, BodyLongTrailingIdx );
434 /* Generated */         BodyDojiPeriodTotal += TA_CANDLERANGE( BodyDoji, i-1 ) - TA_CANDLERANGE( BodyDoji, BodyDojiTrailingIdx );
435 /* Generated */         BodyShortPeriodTotal += TA_CANDLERANGE( BodyShort, i ) - TA_CANDLERANGE( BodyShort, BodyShortTrailingIdx );
436 /* Generated */         i++;
437 /* Generated */         BodyLongTrailingIdx++;
438 /* Generated */         BodyDojiTrailingIdx++;
439 /* Generated */         BodyShortTrailingIdx++;
440 /* Generated */    } while( i <= endIdx );
441 /* Generated */    VALUE_HANDLE_DEREF(outNBElement) = outIdx;
442 /* Generated */    VALUE_HANDLE_DEREF(outBegIdx)    = startIdx;
443 /* Generated */    return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
444 /* Generated */ }
445 /* Generated */
446 /* Generated */ #if defined( _MANAGED )
447 /* Generated */ }}} // Close namespace TicTacTec.TA.Lib
448 /* Generated */ #endif
449 /**** END GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
450 
451