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  *  022005 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 )
CdlMatHoldLookback(double optInPenetration)81 /* Generated */ int Core::CdlMatHoldLookback( double        optInPenetration )  /* From 0 to TA_REAL_MAX */
82 /* Generated */
83 /* Generated */ #elif defined( _JAVA )
84 /* Generated */ public int cdlMatHoldLookback( double        optInPenetration )  /* From 0 to TA_REAL_MAX */
85 /* Generated */
86 /* Generated */ #else
87 /* Generated */ int TA_CDLMATHOLD_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 = 5.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    return max( TA_CANDLEAVGPERIOD(BodyShort), TA_CANDLEAVGPERIOD(BodyLong) ) + 4;
107 }
108 
109 /**** START GENCODE SECTION 3 - DO NOT DELETE THIS LINE ****/
110 /*
111  * TA_CDLMATHOLD - Mat Hold
112  *
113  * Input  = Open, High, Low, Close
114  * Output = int
115  *
116  * Optional Parameters
117  * -------------------
118  * optInPenetration:(From 0 to TA_REAL_MAX)
119  *    Percentage of penetration of a candle within another candle
120  *
121  *
122  */
123 /* Generated */
124 /* Generated */ #if defined( _MANAGED ) && defined( USE_SUBARRAY )
125 /* Generated */ enum class Core::RetCode Core::CdlMatHold( int    startIdx,
126 /* Generated */                                            int    endIdx,
127 /* Generated */                                            SubArray^    inOpen,
128 /* Generated */                                            SubArray^    inHigh,
129 /* Generated */                                            SubArray^    inLow,
130 /* Generated */                                            SubArray^    inClose,
131 /* Generated */                                            double        optInPenetration, /* From 0 to TA_REAL_MAX */
132 /* Generated */                                            [Out]int%    outBegIdx,
133 /* Generated */                                            [Out]int%    outNBElement,
134 /* Generated */                                            cli::array<int>^  outInteger )
135 /* Generated */ #elif defined( _MANAGED )
136 /* Generated */ enum class Core::RetCode Core::CdlMatHold( int    startIdx,
137 /* Generated */                                            int    endIdx,
138 /* Generated */                                            cli::array<double>^ inOpen,
139 /* Generated */                                            cli::array<double>^ inHigh,
140 /* Generated */                                            cli::array<double>^ inLow,
141 /* Generated */                                            cli::array<double>^ inClose,
142 /* Generated */                                            double        optInPenetration, /* From 0 to TA_REAL_MAX */
143 /* Generated */                                            [Out]int%    outBegIdx,
144 /* Generated */                                            [Out]int%    outNBElement,
145 /* Generated */                                            cli::array<int>^  outInteger )
146 /* Generated */ #elif defined( _JAVA )
147 /* Generated */ public RetCode cdlMatHold( int    startIdx,
148 /* Generated */                            int    endIdx,
149 /* Generated */                            double       inOpen[],
150 /* Generated */                            double       inHigh[],
151 /* Generated */                            double       inLow[],
152 /* Generated */                            double       inClose[],
153 /* Generated */                            double        optInPenetration, /* From 0 to TA_REAL_MAX */
154 /* Generated */                            MInteger     outBegIdx,
155 /* Generated */                            MInteger     outNBElement,
156 /* Generated */                            int           outInteger[] )
157 /* Generated */ #else
158 /* Generated */ TA_RetCode TA_CDLMATHOLD( int    startIdx,
159 /* Generated */                           int    endIdx,
160 /* Generated */                           const double inOpen[],
161 /* Generated */                           const double inHigh[],
162 /* Generated */                           const double inLow[],
163 /* Generated */                           const double inClose[],
164 /* Generated */                           double        optInPenetration, /* From 0 to TA_REAL_MAX */
165 /* Generated */                           int          *outBegIdx,
166 /* Generated */                           int          *outNBElement,
167 /* Generated */                           int           outInteger[] )
168 /* Generated */ #endif
169 /**** END GENCODE SECTION 3 - DO NOT DELETE THIS LINE ****/
170 {
171    /* Insert local variables here. */
172     ARRAY_LOCAL(BodyPeriodTotal,5);
173     int i, outIdx, totIdx, BodyShortTrailingIdx, BodyLongTrailingIdx, lookbackTotal;
174 
175 /**** START GENCODE SECTION 4 - DO NOT DELETE THIS LINE ****/
176 /* Generated */
177 /* Generated */ #ifndef TA_FUNC_NO_RANGE_CHECK
178 /* Generated */
179 /* Generated */    /* Validate the requested output range. */
180 /* Generated */    if( startIdx < 0 )
181 /* Generated */       return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_START_INDEX,OutOfRangeStartIndex);
182 /* Generated */    if( (endIdx < 0) || (endIdx < startIdx))
183 /* Generated */       return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_END_INDEX,OutOfRangeEndIndex);
184 /* Generated */
185 /* Generated */    #if !defined(_JAVA)
186 /* Generated */    /* Verify required price component. */
187 /* Generated */    if(!inOpen||!inHigh||!inLow||!inClose)
188 /* Generated */       return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
189 /* Generated */
190 /* Generated */    #endif /* !defined(_JAVA)*/
191 /* Generated */    if( optInPenetration == TA_REAL_DEFAULT )
192 /* Generated */       optInPenetration = 5.000000e-1;
193 /* Generated */    else if( (optInPenetration < 0.000000e+0) ||/* Generated */  (optInPenetration > 3.000000e+37) )
194 /* Generated */       return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
195 /* Generated */
196 /* Generated */    #if !defined(_JAVA)
197 /* Generated */    if( !outInteger )
198 /* Generated */       return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
199 /* Generated */
200 /* Generated */    #endif /* !defined(_JAVA) */
201 /* Generated */ #endif /* TA_FUNC_NO_RANGE_CHECK */
202 /* Generated */
203 /**** END GENCODE SECTION 4 - DO NOT DELETE THIS LINE ****/
204 
205    /* Identify the minimum number of price bar needed
206     * to calculate at least one output.
207     */
208 
209    lookbackTotal = LOOKBACK_CALL(CDLMATHOLD)(optInPenetration);
210 
211    /* Move up the start index if there is not
212     * enough initial data.
213     */
214    if( startIdx < lookbackTotal )
215       startIdx = lookbackTotal;
216 
217    /* Make sure there is still something to evaluate. */
218    if( startIdx > endIdx )
219    {
220       VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx);
221       VALUE_HANDLE_DEREF_TO_ZERO(outNBElement);
222       return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
223    }
224 
225    /* Do the calculation using tight loops. */
226    /* Add-up the initial period, except for the last value. */
227    BodyPeriodTotal[4] = 0;
228    BodyPeriodTotal[3] = 0;
229    BodyPeriodTotal[2] = 0;
230    BodyPeriodTotal[1] = 0;
231    BodyPeriodTotal[0] = 0;
232    BodyShortTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(BodyShort);
233    BodyLongTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(BodyLong);
234 
235    i = BodyShortTrailingIdx;
236    while( i < startIdx ) {
237         BodyPeriodTotal[3] += TA_CANDLERANGE( BodyShort, i-3 );
238         BodyPeriodTotal[2] += TA_CANDLERANGE( BodyShort, i-2 );
239         BodyPeriodTotal[1] += TA_CANDLERANGE( BodyShort, i-1 );
240         i++;
241    }
242    i = BodyLongTrailingIdx;
243    while( i < startIdx ) {
244         BodyPeriodTotal[4] += TA_CANDLERANGE( BodyLong, i-4 );
245         i++;
246    }
247    i = startIdx;
248 
249    /* Proceed with the calculation for the requested range.
250     * Must have:
251     * - first candle: long white candle
252     * - upside gap between the first and the second bodies
253     * - second candle: small black candle
254     * - third and fourth candles: falling small real body candlesticks (commonly black) that hold within the long
255     *   white candle's body and are higher than the reaction days of the rising three methods
256     * - fifth candle: white candle that opens above the previous small candle's close and closes higher than the
257     *   high of the highest reaction day
258     * The meaning of "short" and "long" is specified with TA_SetCandleSettings;
259     * "hold within" means "a part of the real body must be within";
260     * optInPenetration is the maximum percentage of the first white body the reaction days can penetrate (it is
261     * to specify how much the reaction days should be "higher than the reaction days of the rising three methods")
262     * outInteger is positive (1 to 100): mat hold is always bullish
263     */
264    outIdx = 0;
265    do
266    {
267         if( // 1st long, then 3 small
268             TA_REALBODY(i-4) > TA_CANDLEAVERAGE( BodyLong, BodyPeriodTotal[4], i-4 ) &&
269             TA_REALBODY(i-3) < TA_CANDLEAVERAGE( BodyShort, BodyPeriodTotal[3], i-3 ) &&
270             TA_REALBODY(i-2) < TA_CANDLEAVERAGE( BodyShort, BodyPeriodTotal[2], i-2 ) &&
271             TA_REALBODY(i-1) < TA_CANDLEAVERAGE( BodyShort, BodyPeriodTotal[1], i-1 ) &&
272             // white, black, 2 black or white, white
273             TA_CANDLECOLOR(i-4) == 1 &&
274             TA_CANDLECOLOR(i-3) == -1 &&
275             TA_CANDLECOLOR(i) == 1 &&
276             // upside gap 1st to 2nd
277             TA_REALBODYGAPUP(i-3,i-4) &&
278             // 3rd to 4th hold within 1st: a part of the real body must be within 1st real body
279             min(inOpen[i-2], inClose[i-2]) < inClose[i-4] &&
280             min(inOpen[i-1], inClose[i-1]) < inClose[i-4] &&
281             // reaction days penetrate first body less than optInPenetration percent
282             min(inOpen[i-2], inClose[i-2]) > inClose[i-4] - TA_REALBODY(i-4) * optInPenetration &&
283             min(inOpen[i-1], inClose[i-1]) > inClose[i-4] - TA_REALBODY(i-4) * optInPenetration &&
284             // 2nd to 4th are falling
285             max(inClose[i-2], inOpen[i-2]) < inOpen[i-3] &&
286             max(inClose[i-1], inOpen[i-1]) < max(inClose[i-2], inOpen[i-2]) &&
287             // 5th opens above the prior close
288             inOpen[i] > inClose[i-1] &&
289             // 5th closes above the highest high of the reaction days
290             inClose[i] > max(max(inHigh[i-3], inHigh[i-2]), inHigh[i-1])
291           )
292             outInteger[outIdx++] = 100;
293         else
294             outInteger[outIdx++] = 0;
295         /* add the current range and subtract the first range: this is done after the pattern recognition
296          * when avgPeriod is not 0, that means "compare with the previous candles" (it excludes the current candle)
297          */
298         BodyPeriodTotal[4] += TA_CANDLERANGE( BodyLong, i-4 ) - TA_CANDLERANGE( BodyLong, BodyLongTrailingIdx-4 );
299         for (totIdx = 3; totIdx >= 1; --totIdx)
300             BodyPeriodTotal[totIdx] += TA_CANDLERANGE( BodyShort, i-totIdx )
301                                      - TA_CANDLERANGE( BodyShort, BodyShortTrailingIdx-totIdx );
302         i++;
303         BodyShortTrailingIdx++;
304         BodyLongTrailingIdx++;
305    } while( i <= endIdx );
306 
307    /* All done. Indicate the output limits and return. */
308    VALUE_HANDLE_DEREF(outNBElement) = outIdx;
309    VALUE_HANDLE_DEREF(outBegIdx)    = startIdx;
310 
311    return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
312 }
313 
314 /**** START GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
315 /* Generated */
316 /* Generated */ #define  USE_SINGLE_PRECISION_INPUT
317 /* Generated */ #if !defined( _MANAGED ) && !defined( _JAVA )
318 /* Generated */    #undef   TA_PREFIX
319 /* Generated */    #define  TA_PREFIX(x) TA_S_##x
320 /* Generated */ #endif
321 /* Generated */ #undef   INPUT_TYPE
322 /* Generated */ #define  INPUT_TYPE float
323 /* Generated */ #if defined( _MANAGED )
324 /* Generated */ enum class Core::RetCode Core::CdlMatHold( int    startIdx,
325 /* Generated */                                            int    endIdx,
326 /* Generated */                                            cli::array<float>^ inOpen,
327 /* Generated */                                            cli::array<float>^ inHigh,
328 /* Generated */                                            cli::array<float>^ inLow,
329 /* Generated */                                            cli::array<float>^ inClose,
330 /* Generated */                                            double        optInPenetration, /* From 0 to TA_REAL_MAX */
331 /* Generated */                                            [Out]int%    outBegIdx,
332 /* Generated */                                            [Out]int%    outNBElement,
333 /* Generated */                                            cli::array<int>^  outInteger )
334 /* Generated */ #elif defined( _JAVA )
335 /* Generated */ public RetCode cdlMatHold( int    startIdx,
336 /* Generated */                            int    endIdx,
337 /* Generated */                            float        inOpen[],
338 /* Generated */                            float        inHigh[],
339 /* Generated */                            float        inLow[],
340 /* Generated */                            float        inClose[],
341 /* Generated */                            double        optInPenetration, /* From 0 to TA_REAL_MAX */
342 /* Generated */                            MInteger     outBegIdx,
343 /* Generated */                            MInteger     outNBElement,
344 /* Generated */                            int           outInteger[] )
345 /* Generated */ #else
346 /* Generated */ TA_RetCode TA_S_CDLMATHOLD( int    startIdx,
347 /* Generated */                             int    endIdx,
348 /* Generated */                             const float  inOpen[],
349 /* Generated */                             const float  inHigh[],
350 /* Generated */                             const float  inLow[],
351 /* Generated */                             const float  inClose[],
352 /* Generated */                             double        optInPenetration, /* From 0 to TA_REAL_MAX */
353 /* Generated */                             int          *outBegIdx,
354 /* Generated */                             int          *outNBElement,
355 /* Generated */                             int           outInteger[] )
356 /* Generated */ #endif
357 /* Generated */ {
358 /* Generated */     ARRAY_LOCAL(BodyPeriodTotal,5);
359 /* Generated */     int i, outIdx, totIdx, BodyShortTrailingIdx, BodyLongTrailingIdx, lookbackTotal;
360 /* Generated */  #ifndef TA_FUNC_NO_RANGE_CHECK
361 /* Generated */     if( startIdx < 0 )
362 /* Generated */        return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_START_INDEX,OutOfRangeStartIndex);
363 /* Generated */     if( (endIdx < 0) || (endIdx < startIdx))
364 /* Generated */        return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_END_INDEX,OutOfRangeEndIndex);
365 /* Generated */     #if !defined(_JAVA)
366 /* Generated */     if(!inOpen||!inHigh||!inLow||!inClose)
367 /* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
368 /* Generated */     #endif
369 /* Generated */     if( optInPenetration == TA_REAL_DEFAULT )
370 /* Generated */        optInPenetration = 5.000000e-1;
371 /* Generated */     else if( (optInPenetration < 0.000000e+0) ||  (optInPenetration > 3.000000e+37) )
372 /* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
373 /* Generated */     #if !defined(_JAVA)
374 /* Generated */     if( !outInteger )
375 /* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
376 /* Generated */     #endif
377 /* Generated */  #endif
378 /* Generated */    lookbackTotal = LOOKBACK_CALL(CDLMATHOLD)(optInPenetration);
379 /* Generated */    if( startIdx < lookbackTotal )
380 /* Generated */       startIdx = lookbackTotal;
381 /* Generated */    if( startIdx > endIdx )
382 /* Generated */    {
383 /* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx);
384 /* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outNBElement);
385 /* Generated */       return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
386 /* Generated */    }
387 /* Generated */    BodyPeriodTotal[4] = 0;
388 /* Generated */    BodyPeriodTotal[3] = 0;
389 /* Generated */    BodyPeriodTotal[2] = 0;
390 /* Generated */    BodyPeriodTotal[1] = 0;
391 /* Generated */    BodyPeriodTotal[0] = 0;
392 /* Generated */    BodyShortTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(BodyShort);
393 /* Generated */    BodyLongTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(BodyLong);
394 /* Generated */    i = BodyShortTrailingIdx;
395 /* Generated */    while( i < startIdx ) {
396 /* Generated */         BodyPeriodTotal[3] += TA_CANDLERANGE( BodyShort, i-3 );
397 /* Generated */         BodyPeriodTotal[2] += TA_CANDLERANGE( BodyShort, i-2 );
398 /* Generated */         BodyPeriodTotal[1] += TA_CANDLERANGE( BodyShort, i-1 );
399 /* Generated */         i++;
400 /* Generated */    }
401 /* Generated */    i = BodyLongTrailingIdx;
402 /* Generated */    while( i < startIdx ) {
403 /* Generated */         BodyPeriodTotal[4] += TA_CANDLERANGE( BodyLong, i-4 );
404 /* Generated */         i++;
405 /* Generated */    }
406 /* Generated */    i = startIdx;
407 /* Generated */    outIdx = 0;
408 /* Generated */    do
409 /* Generated */    {
410 /* Generated */         if( // 1st long, then 3 small
411 /* Generated */             TA_REALBODY(i-4) > TA_CANDLEAVERAGE( BodyLong, BodyPeriodTotal[4], i-4 ) &&
412 /* Generated */             TA_REALBODY(i-3) < TA_CANDLEAVERAGE( BodyShort, BodyPeriodTotal[3], i-3 ) &&
413 /* Generated */             TA_REALBODY(i-2) < TA_CANDLEAVERAGE( BodyShort, BodyPeriodTotal[2], i-2 ) &&
414 /* Generated */             TA_REALBODY(i-1) < TA_CANDLEAVERAGE( BodyShort, BodyPeriodTotal[1], i-1 ) &&
415 /* Generated */             // white, black, 2 black or white, white
416 /* Generated */             TA_CANDLECOLOR(i-4) == 1 &&
417 /* Generated */             TA_CANDLECOLOR(i-3) == -1 &&
418 /* Generated */             TA_CANDLECOLOR(i) == 1 &&
419 /* Generated */             // upside gap 1st to 2nd
420 /* Generated */             TA_REALBODYGAPUP(i-3,i-4) &&
421 /* Generated */             // 3rd to 4th hold within 1st: a part of the real body must be within 1st real body
422 /* Generated */             min(inOpen[i-2], inClose[i-2]) < inClose[i-4] &&
423 /* Generated */             min(inOpen[i-1], inClose[i-1]) < inClose[i-4] &&
424 /* Generated */             // reaction days penetrate first body less than optInPenetration percent
425 /* Generated */             min(inOpen[i-2], inClose[i-2]) > inClose[i-4] - TA_REALBODY(i-4) * optInPenetration &&
426 /* Generated */             min(inOpen[i-1], inClose[i-1]) > inClose[i-4] - TA_REALBODY(i-4) * optInPenetration &&
427 /* Generated */             // 2nd to 4th are falling
428 /* Generated */             max(inClose[i-2], inOpen[i-2]) < inOpen[i-3] &&
429 /* Generated */             max(inClose[i-1], inOpen[i-1]) < max(inClose[i-2], inOpen[i-2]) &&
430 /* Generated */             // 5th opens above the prior close
431 /* Generated */             inOpen[i] > inClose[i-1] &&
432 /* Generated */             // 5th closes above the highest high of the reaction days
433 /* Generated */             inClose[i] > max(max(inHigh[i-3], inHigh[i-2]), inHigh[i-1])
434 /* Generated */           )
435 /* Generated */             outInteger[outIdx++] = 100;
436 /* Generated */         else
437 /* Generated */             outInteger[outIdx++] = 0;
438 /* Generated */         BodyPeriodTotal[4] += TA_CANDLERANGE( BodyLong, i-4 ) - TA_CANDLERANGE( BodyLong, BodyLongTrailingIdx-4 );
439 /* Generated */         for (totIdx = 3; totIdx >= 1; --totIdx)
440 /* Generated */             BodyPeriodTotal[totIdx] += TA_CANDLERANGE( BodyShort, i-totIdx )
441 /* Generated */                                      - TA_CANDLERANGE( BodyShort, BodyShortTrailingIdx-totIdx );
442 /* Generated */         i++;
443 /* Generated */         BodyShortTrailingIdx++;
444 /* Generated */         BodyLongTrailingIdx++;
445 /* Generated */    } while( i <= endIdx );
446 /* Generated */    VALUE_HANDLE_DEREF(outNBElement) = outIdx;
447 /* Generated */    VALUE_HANDLE_DEREF(outBegIdx)    = startIdx;
448 /* Generated */    return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
449 /* Generated */ }
450 /* Generated */
451 /* Generated */ #if defined( _MANAGED )
452 /* Generated */ }}} // Close namespace TicTacTec.TA.Lib
453 /* Generated */ #endif
454 /**** END GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
455 
456