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