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  *  022705 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 )
Cdl3StarsInSouthLookback(void)81 /* Generated */ int Core::Cdl3StarsInSouthLookback( void )
82 /* Generated */
83 /* Generated */ #elif defined( _JAVA )
84 /* Generated */ public int cdl3StarsInSouthLookback(  )
85 /* Generated */
86 /* Generated */ #else
87 /* Generated */ int TA_CDL3STARSINSOUTH_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(ShadowVeryShort), TA_CANDLEAVGPERIOD(ShadowLong) ),
100                 max( TA_CANDLEAVGPERIOD(BodyLong), TA_CANDLEAVGPERIOD(BodyShort) )
101             ) + 2;
102 }
103 
104 /**** START GENCODE SECTION 3 - DO NOT DELETE THIS LINE ****/
105 /*
106  * TA_CDL3STARSINSOUTH - Three Stars In The South
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::Cdl3StarsInSouth( 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::Cdl3StarsInSouth( 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 cdl3StarsInSouth( 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_CDL3STARSINSOUTH( 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     double BodyLongPeriodTotal, BodyShortPeriodTotal, ShadowLongPeriodTotal;
158 	ARRAY_LOCAL(ShadowVeryShortPeriodTotal,2);
159     int i, outIdx, totIdx, BodyLongTrailingIdx, BodyShortTrailingIdx, ShadowLongTrailingIdx, ShadowVeryShortTrailingIdx,
160         lookbackTotal;
161 
162 /**** START GENCODE SECTION 4 - DO NOT DELETE THIS LINE ****/
163 /* Generated */
164 /* Generated */ #ifndef TA_FUNC_NO_RANGE_CHECK
165 /* Generated */
166 /* Generated */    /* Validate the requested output range. */
167 /* Generated */    if( startIdx < 0 )
168 /* Generated */       return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_START_INDEX,OutOfRangeStartIndex);
169 /* Generated */    if( (endIdx < 0) || (endIdx < startIdx))
170 /* Generated */       return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_END_INDEX,OutOfRangeEndIndex);
171 /* Generated */
172 /* Generated */    #if !defined(_JAVA)
173 /* Generated */    /* Verify required price component. */
174 /* Generated */    if(!inOpen||!inHigh||!inLow||!inClose)
175 /* Generated */       return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
176 /* Generated */
177 /* Generated */    #endif /* !defined(_JAVA)*/
178 /* Generated */    #if !defined(_JAVA)
179 /* Generated */    if( !outInteger )
180 /* Generated */       return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
181 /* Generated */
182 /* Generated */    #endif /* !defined(_JAVA) */
183 /* Generated */ #endif /* TA_FUNC_NO_RANGE_CHECK */
184 /* Generated */
185 /**** END GENCODE SECTION 4 - DO NOT DELETE THIS LINE ****/
186 
187    /* Identify the minimum number of price bar needed
188     * to calculate at least one output.
189     */
190 
191    lookbackTotal = LOOKBACK_CALL(CDL3STARSINSOUTH)();
192 
193    /* Move up the start index if there is not
194     * enough initial data.
195     */
196    if( startIdx < lookbackTotal )
197       startIdx = lookbackTotal;
198 
199    /* Make sure there is still something to evaluate. */
200    if( startIdx > endIdx )
201    {
202       VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx);
203       VALUE_HANDLE_DEREF_TO_ZERO(outNBElement);
204       return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
205    }
206 
207    /* Do the calculation using tight loops. */
208    /* Add-up the initial period, except for the last value. */
209    BodyLongPeriodTotal = 0;
210    BodyLongTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(BodyLong);
211    ShadowLongPeriodTotal = 0;
212    ShadowLongTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(ShadowLong);
213    ShadowVeryShortPeriodTotal[1] = 0;
214    ShadowVeryShortPeriodTotal[0] = 0;
215    ShadowVeryShortTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(ShadowVeryShort);
216    BodyShortPeriodTotal = 0;
217    BodyShortTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(BodyShort);
218 
219    i = BodyLongTrailingIdx;
220    while( i < startIdx ) {
221         BodyLongPeriodTotal += TA_CANDLERANGE( BodyLong, i-2 );
222         i++;
223    }
224    i = ShadowLongTrailingIdx;
225    while( i < startIdx ) {
226         ShadowLongPeriodTotal += TA_CANDLERANGE( ShadowLong, i-2 );
227         i++;
228    }
229    i = ShadowVeryShortTrailingIdx;
230    while( i < startIdx ) {
231         ShadowVeryShortPeriodTotal[1] += TA_CANDLERANGE( ShadowVeryShort, i-1 );
232         ShadowVeryShortPeriodTotal[0] += TA_CANDLERANGE( ShadowVeryShort, i );
233         i++;
234    }
235    i = BodyShortTrailingIdx;
236    while( i < startIdx ) {
237         BodyShortPeriodTotal += TA_CANDLERANGE( BodyShort, i );
238         i++;
239    }
240    i = startIdx;
241 
242    /* Proceed with the calculation for the requested range.
243     * Must have:
244     * - first candle: long black candle with long lower shadow
245     * - second candle: smaller black candle that opens higher than prior close but within prior candle's range
246     *   and trades lower than prior close but not lower than prior low and closes off of its low (it has a shadow)
247     * - third candle: small black marubozu (or candle with very short shadows) engulfed by prior candle's range
248     * The meanings of "long body", "short body", "very short shadow" are specified with TA_SetCandleSettings;
249     * outInteger is positive (1 to 100): 3 stars in the south is always bullish;
250     * the user should consider that 3 stars in the south is significant when it appears in downtrend, while this function
251     * does not consider it
252     */
253    outIdx = 0;
254    do
255    {
256         if( TA_CANDLECOLOR(i-2) == -1 &&                                    // 1st black
257             TA_CANDLECOLOR(i-1) == -1 &&                                    // 2nd black
258             TA_CANDLECOLOR(i) == -1 &&                                      // 3rd black
259                                                                             // 1st: long
260             TA_REALBODY(i-2) > TA_CANDLEAVERAGE( BodyLong, BodyLongPeriodTotal, i-2 ) &&
261                                                                             //      with long lower shadow
262             TA_LOWERSHADOW(i-2) > TA_CANDLEAVERAGE( ShadowLong, ShadowLongPeriodTotal, i-2 ) &&
263             TA_REALBODY(i-1) < TA_REALBODY(i-2) &&                          // 2nd: smaller candle
264             inOpen[i-1] > inClose[i-2] && inOpen[i-1] <= inHigh[i-2] &&     //      that opens higher but within 1st range
265             inLow[i-1] < inClose[i-2] &&                                    //      and trades lower than 1st close
266             inLow[i-1] >= inLow[i-2] &&                                     //      but not lower than 1st low
267                                                                             //      and has a lower shadow
268             TA_LOWERSHADOW(i-1) > TA_CANDLEAVERAGE( ShadowVeryShort, ShadowVeryShortPeriodTotal[1], i-1 ) &&
269                                                                             // 3rd: small marubozu
270             TA_REALBODY(i) < TA_CANDLEAVERAGE( BodyShort, BodyShortPeriodTotal, i ) &&
271             TA_LOWERSHADOW(i) < TA_CANDLEAVERAGE( ShadowVeryShort, ShadowVeryShortPeriodTotal[0], i ) &&
272             TA_UPPERSHADOW(i) < TA_CANDLEAVERAGE( ShadowVeryShort, ShadowVeryShortPeriodTotal[0], i ) &&
273             inLow[i] > inLow[i-1] && inHigh[i] < inHigh[i-1]                //      engulfed by prior candle's range
274           )
275             outInteger[outIdx++] = 100;
276         else
277             outInteger[outIdx++] = 0;
278         /* add the current range and subtract the first range: this is done after the pattern recognition
279          * when avgPeriod is not 0, that means "compare with the previous candles" (it excludes the current candle)
280          */
281         BodyLongPeriodTotal += TA_CANDLERANGE( BodyLong, i-2 )
282                              - TA_CANDLERANGE( BodyLong, BodyLongTrailingIdx-2 );
283         ShadowLongPeriodTotal += TA_CANDLERANGE( ShadowLong, i-2 )
284                                - TA_CANDLERANGE( ShadowLong, ShadowLongTrailingIdx-2 );
285         for (totIdx = 1; totIdx >= 0; --totIdx)
286             ShadowVeryShortPeriodTotal[totIdx] += TA_CANDLERANGE( ShadowVeryShort, i-totIdx )
287                                                 - TA_CANDLERANGE( ShadowVeryShort, ShadowVeryShortTrailingIdx-totIdx );
288         BodyShortPeriodTotal += TA_CANDLERANGE( BodyShort, i )
289                               - TA_CANDLERANGE( BodyShort, BodyShortTrailingIdx );
290         i++;
291         BodyLongTrailingIdx++;
292         ShadowLongTrailingIdx++;
293         ShadowVeryShortTrailingIdx++;
294         BodyShortTrailingIdx++;
295    } while( i <= endIdx );
296 
297    /* All done. Indicate the output limits and return. */
298    VALUE_HANDLE_DEREF(outNBElement) = outIdx;
299    VALUE_HANDLE_DEREF(outBegIdx)    = startIdx;
300 
301    return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
302 }
303 
304 /**** START GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
305 /* Generated */
306 /* Generated */ #define  USE_SINGLE_PRECISION_INPUT
307 /* Generated */ #if !defined( _MANAGED ) && !defined( _JAVA )
308 /* Generated */    #undef   TA_PREFIX
309 /* Generated */    #define  TA_PREFIX(x) TA_S_##x
310 /* Generated */ #endif
311 /* Generated */ #undef   INPUT_TYPE
312 /* Generated */ #define  INPUT_TYPE float
313 /* Generated */ #if defined( _MANAGED )
314 /* Generated */ enum class Core::RetCode Core::Cdl3StarsInSouth( int    startIdx,
315 /* Generated */                                                  int    endIdx,
316 /* Generated */                                                  cli::array<float>^ inOpen,
317 /* Generated */                                                  cli::array<float>^ inHigh,
318 /* Generated */                                                  cli::array<float>^ inLow,
319 /* Generated */                                                  cli::array<float>^ inClose,
320 /* Generated */                                                  [Out]int%    outBegIdx,
321 /* Generated */                                                  [Out]int%    outNBElement,
322 /* Generated */                                                  cli::array<int>^  outInteger )
323 /* Generated */ #elif defined( _JAVA )
324 /* Generated */ public RetCode cdl3StarsInSouth( int    startIdx,
325 /* Generated */                                  int    endIdx,
326 /* Generated */                                  float        inOpen[],
327 /* Generated */                                  float        inHigh[],
328 /* Generated */                                  float        inLow[],
329 /* Generated */                                  float        inClose[],
330 /* Generated */                                  MInteger     outBegIdx,
331 /* Generated */                                  MInteger     outNBElement,
332 /* Generated */                                  int           outInteger[] )
333 /* Generated */ #else
334 /* Generated */ TA_RetCode TA_S_CDL3STARSINSOUTH( int    startIdx,
335 /* Generated */                                   int    endIdx,
336 /* Generated */                                   const float  inOpen[],
337 /* Generated */                                   const float  inHigh[],
338 /* Generated */                                   const float  inLow[],
339 /* Generated */                                   const float  inClose[],
340 /* Generated */                                   int          *outBegIdx,
341 /* Generated */                                   int          *outNBElement,
342 /* Generated */                                   int           outInteger[] )
343 /* Generated */ #endif
344 /* Generated */ {
345 /* Generated */     double BodyLongPeriodTotal, BodyShortPeriodTotal, ShadowLongPeriodTotal;
346 /* Generated */ 	ARRAY_LOCAL(ShadowVeryShortPeriodTotal,2);
347 /* Generated */     int i, outIdx, totIdx, BodyLongTrailingIdx, BodyShortTrailingIdx, ShadowLongTrailingIdx, ShadowVeryShortTrailingIdx,
348 /* Generated */         lookbackTotal;
349 /* Generated */  #ifndef TA_FUNC_NO_RANGE_CHECK
350 /* Generated */     if( startIdx < 0 )
351 /* Generated */        return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_START_INDEX,OutOfRangeStartIndex);
352 /* Generated */     if( (endIdx < 0) || (endIdx < startIdx))
353 /* Generated */        return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_END_INDEX,OutOfRangeEndIndex);
354 /* Generated */     #if !defined(_JAVA)
355 /* Generated */     if(!inOpen||!inHigh||!inLow||!inClose)
356 /* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
357 /* Generated */     #endif
358 /* Generated */     #if !defined(_JAVA)
359 /* Generated */     if( !outInteger )
360 /* Generated */        return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam);
361 /* Generated */     #endif
362 /* Generated */  #endif
363 /* Generated */    lookbackTotal = LOOKBACK_CALL(CDL3STARSINSOUTH)();
364 /* Generated */    if( startIdx < lookbackTotal )
365 /* Generated */       startIdx = lookbackTotal;
366 /* Generated */    if( startIdx > endIdx )
367 /* Generated */    {
368 /* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx);
369 /* Generated */       VALUE_HANDLE_DEREF_TO_ZERO(outNBElement);
370 /* Generated */       return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
371 /* Generated */    }
372 /* Generated */    BodyLongPeriodTotal = 0;
373 /* Generated */    BodyLongTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(BodyLong);
374 /* Generated */    ShadowLongPeriodTotal = 0;
375 /* Generated */    ShadowLongTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(ShadowLong);
376 /* Generated */    ShadowVeryShortPeriodTotal[1] = 0;
377 /* Generated */    ShadowVeryShortPeriodTotal[0] = 0;
378 /* Generated */    ShadowVeryShortTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(ShadowVeryShort);
379 /* Generated */    BodyShortPeriodTotal = 0;
380 /* Generated */    BodyShortTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(BodyShort);
381 /* Generated */    i = BodyLongTrailingIdx;
382 /* Generated */    while( i < startIdx ) {
383 /* Generated */         BodyLongPeriodTotal += TA_CANDLERANGE( BodyLong, i-2 );
384 /* Generated */         i++;
385 /* Generated */    }
386 /* Generated */    i = ShadowLongTrailingIdx;
387 /* Generated */    while( i < startIdx ) {
388 /* Generated */         ShadowLongPeriodTotal += TA_CANDLERANGE( ShadowLong, i-2 );
389 /* Generated */         i++;
390 /* Generated */    }
391 /* Generated */    i = ShadowVeryShortTrailingIdx;
392 /* Generated */    while( i < startIdx ) {
393 /* Generated */         ShadowVeryShortPeriodTotal[1] += TA_CANDLERANGE( ShadowVeryShort, i-1 );
394 /* Generated */         ShadowVeryShortPeriodTotal[0] += TA_CANDLERANGE( ShadowVeryShort, i );
395 /* Generated */         i++;
396 /* Generated */    }
397 /* Generated */    i = BodyShortTrailingIdx;
398 /* Generated */    while( i < startIdx ) {
399 /* Generated */         BodyShortPeriodTotal += TA_CANDLERANGE( BodyShort, i );
400 /* Generated */         i++;
401 /* Generated */    }
402 /* Generated */    i = startIdx;
403 /* Generated */    outIdx = 0;
404 /* Generated */    do
405 /* Generated */    {
406 /* Generated */         if( TA_CANDLECOLOR(i-2) == -1 &&                                    // 1st black
407 /* Generated */             TA_CANDLECOLOR(i-1) == -1 &&                                    // 2nd black
408 /* Generated */             TA_CANDLECOLOR(i) == -1 &&                                      // 3rd black
409 /* Generated */                                                                             // 1st: long
410 /* Generated */             TA_REALBODY(i-2) > TA_CANDLEAVERAGE( BodyLong, BodyLongPeriodTotal, i-2 ) &&
411 /* Generated */                                                                             //      with long lower shadow
412 /* Generated */             TA_LOWERSHADOW(i-2) > TA_CANDLEAVERAGE( ShadowLong, ShadowLongPeriodTotal, i-2 ) &&
413 /* Generated */             TA_REALBODY(i-1) < TA_REALBODY(i-2) &&                          // 2nd: smaller candle
414 /* Generated */             inOpen[i-1] > inClose[i-2] && inOpen[i-1] <= inHigh[i-2] &&     //      that opens higher but within 1st range
415 /* Generated */             inLow[i-1] < inClose[i-2] &&                                    //      and trades lower than 1st close
416 /* Generated */             inLow[i-1] >= inLow[i-2] &&                                     //      but not lower than 1st low
417 /* Generated */                                                                             //      and has a lower shadow
418 /* Generated */             TA_LOWERSHADOW(i-1) > TA_CANDLEAVERAGE( ShadowVeryShort, ShadowVeryShortPeriodTotal[1], i-1 ) &&
419 /* Generated */                                                                             // 3rd: small marubozu
420 /* Generated */             TA_REALBODY(i) < TA_CANDLEAVERAGE( BodyShort, BodyShortPeriodTotal, i ) &&
421 /* Generated */             TA_LOWERSHADOW(i) < TA_CANDLEAVERAGE( ShadowVeryShort, ShadowVeryShortPeriodTotal[0], i ) &&
422 /* Generated */             TA_UPPERSHADOW(i) < TA_CANDLEAVERAGE( ShadowVeryShort, ShadowVeryShortPeriodTotal[0], i ) &&
423 /* Generated */             inLow[i] > inLow[i-1] && inHigh[i] < inHigh[i-1]                //      engulfed by prior candle's range
424 /* Generated */           )
425 /* Generated */             outInteger[outIdx++] = 100;
426 /* Generated */         else
427 /* Generated */             outInteger[outIdx++] = 0;
428 /* Generated */         BodyLongPeriodTotal += TA_CANDLERANGE( BodyLong, i-2 )
429 /* Generated */                              - TA_CANDLERANGE( BodyLong, BodyLongTrailingIdx-2 );
430 /* Generated */         ShadowLongPeriodTotal += TA_CANDLERANGE( ShadowLong, i-2 )
431 /* Generated */                                - TA_CANDLERANGE( ShadowLong, ShadowLongTrailingIdx-2 );
432 /* Generated */         for (totIdx = 1; totIdx >= 0; --totIdx)
433 /* Generated */             ShadowVeryShortPeriodTotal[totIdx] += TA_CANDLERANGE( ShadowVeryShort, i-totIdx )
434 /* Generated */                                                 - TA_CANDLERANGE( ShadowVeryShort, ShadowVeryShortTrailingIdx-totIdx );
435 /* Generated */         BodyShortPeriodTotal += TA_CANDLERANGE( BodyShort, i )
436 /* Generated */                               - TA_CANDLERANGE( BodyShort, BodyShortTrailingIdx );
437 /* Generated */         i++;
438 /* Generated */         BodyLongTrailingIdx++;
439 /* Generated */         ShadowLongTrailingIdx++;
440 /* Generated */         ShadowVeryShortTrailingIdx++;
441 /* Generated */         BodyShortTrailingIdx++;
442 /* Generated */    } while( i <= endIdx );
443 /* Generated */    VALUE_HANDLE_DEREF(outNBElement) = outIdx;
444 /* Generated */    VALUE_HANDLE_DEREF(outBegIdx)    = startIdx;
445 /* Generated */    return ENUM_VALUE(RetCode,TA_SUCCESS,Success);
446 /* Generated */ }
447 /* Generated */
448 /* Generated */ #if defined( _MANAGED )
449 /* Generated */ }}} // Close namespace TicTacTec.TA.Lib
450 /* Generated */ #endif
451 /**** END GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
452 
453