RS_ReversalPatterns (Series Function)

image\trumpet2.gifDisclaimer

This function has been designed for use with intraday charts only, and *must* be called in conjunction with the RS_DailyDataArray function. The latter extracts daily data from intraday data and makes it available to subsequently called functions like this one that use that daily data.

This function outputs "setups" and "triggers" for the specified reversal direction and criteria, bar by bar (series function). Only the first trigger bar of the day is recognized - both setup and trigger are negated on the bar following the trigger bar.

Reversal Pattern Criteria

Crit1, Gap & Reverse (same day) - Market starts out very strong today, with a large opening CurrDayOpGap, but cannot sustain move and starts fading, triggering alert as it pulls back into yesterday's range.

Crit2, Falter & Reverse (2-day) - Market started out strong yesterday, but retracted by the end of the day, and continues the reversal today, triggering alert as it pulls out of yesterday's range.

Syntax

Value2 = RS_ReversalPatterns(RevDirection, RevCriteria, GapSizeFactor, DataArray, Index, SubArray, oSetup, oTrigger) ;

Returns (Integer)

This function has a dummy return of 1. All the useful information is passed back to the caller via the output parameters. For more information see Multiple Output Functions.

Parameters

Name

Type

Description

RevDirection

Numeric

(Input) 1 for down reversal, 2 for up reversal.

RevCriteria

Numeric

(Input) 1 for Crit1, 2 for Crit2.

GapSizeFactor

Numeric

(Input) This factor is only used when RevCriteria = 1; it forces CurrDayOpGap to be >= PrevDayTR * GapSizeFactor.

DataArray

NumericArray

(Input) The array that contains the daily data to be used. This is an output of the RS_DailyDataArray function, and in input to the RS_ReversalPatterns function. (Note: The calling routine must declare the size of this array as 12-by-MaxNumDays, with MaxNumDays >= NumDays.)

Index

Numeric

(Input) The number of the DataArray column in which the data for the current day is being loaded. This is an output of the RS_DailyDataArray function, and an input to the RS_ReversalPatterns function.

SubArray

NumericArray

(Input) This subordinate array contains some additional information for the final partial day in the MaxBarsBack buffer. This array is also an output of the RS_DailyDataArray function, and in input to the RS_ReversalPatterns function. (Note: The calling routine must declare the size of this array to be 3; element 0 is not used.)

oSetup

Numeric

(Output) This is 1 if a setup exists, 0 otherwise.

oTrigger

Numeric

(Output) At the bar the trigger condition is met, this output indicates the trigger price. At all other times this output is 0.

Remarks

Crit 2 above needs 2 days' history, so the NumDays input in the RS_DailyDataArray function should be set to at least 2 when Crit 2 is specified.

This approach is intended primarily for use with RadarScreen indicators, where only one datastream can be used; in charting, similar calculations can be performed more easily using a multi-data approach.

Example

inputs: NumDays(3), RevDirection(1), RevCriteria(1), GapSizeFactor(.2) ;

variables: Index(0), oSetup (0), oTrigger(0) ;

arrays: DataArray[12, 100] (0), SubArray[3] (0) ;

Value1 = RS_DailyDataArray( NumDays, DataArray, Index, SubArray ) ;

Value2 = RS_ReversalPatterns(RevDirection, RevCriteria, GapSizeFactor, DataArray, Index, SubArray, oSetup, oTrigger) ;

Plot1(oSetup) ;

Plot2(oTrigger) ;