Find and FindInclusive

Top  Previous  Next

Example chart for this topic:  FindInclusive and FindSinceInclusive

Find(what, condition1, condition2, series, reset flag)

Parameters:
What - an integer number between 1 and 15 (default 1)  The What values are codes for the type of calculation you want the Find indicator to perform.  See the table below for the meaning of the codes. This value should not be optimized.
Condition 1 – a time series that must be a condition that defines when the search begins (default Close should not be used)
Condition 2 – a time series that must be a condition that defines when the search ends (default Close should not be used)
Series - a time series that is the basis for calculating the output (default Close)
Reset flag – an integer number 0 or 1 (default 1).

The bars on which Conditions 1 and 2 occur are not included in the results.

FindInclusive(what, condition1, condition2, series, reset flag)

The parameters are the same as the Find indicator except that the bars on which conditions 1 and 2 occur are included in the result.

The Find indicators can perform one of 15 different calculations on a time series.  The calculations begin at Condition1 and end at Condition2.  The specific calculation is determined by the value of the What parameter, which is described below.

 

Definitions for the What Parameter

What Value

Performs the calculation described below on the series between conditions 1 and 2*

1

Counts the number of bars between conditions

2

Point change

3

Percent point change

4

Maximum value

5

Minimum value

6

Sum

7

Average

8

Standard Deviation

9

Variance

10

Median

11

Regression slope

12

Number of advancing bars (a bar that is higher than the preceding bar)

13

Number of declining bars (a bar that is lower than the preceding bar)

14

Max advance

15

Max decline

*See notes at the end of this topic for calculation details

Warning: If you are including the Find indicator in a Prediction or Trading Strategy that will be optimized, be sure to lock the optimization range for the What parameter; otherwise your Find indicator will not produce the correct output.

Condition 1 and 2 are time series consisting of zeros and ones. Zero means the condition is not present, one (or any other non-zero value) means that the condition is present. In addition to the conditions included in Advanced Indicator Set 3, you can use conditional indicators such as Rules, Boolean, Relational, Crossovers, etc.  that are included as standard indicators in NeuroShell Trader.

Warning: Both conditions must be present before an output value can be produced. For example, if you're trying to find the max value of the RSI (the series) between the close crossing above a 200-day moving average (condition1) and the close crossing below a 200-day moving average (condition2) and the close never crosses below the 200-day moving average, the output of the find indicator will be missing from the chart because the end condition is not present.

Reset Flag
The reset flag parameter controls how the indicator calculates when there are several repeating occurrences of condition2 after an occurrence of condition1.

Reset flag = 1 (default) The Find indicator calculates on the same bar when condition2 takes place after an occurrence of condition1. The Find indicator recalculates at all repeating occurrences of condition2.

The indicator output is a horizontal line that begins on the same bar where condition2 occurs (exclusive of that bar) and continues up until the next bar where condition2 occurs in the next condition1/condition2 pair (exclusive of that bar). If the reset flag is set to 1, it effectively tells the indicator to “forget” about the condition1 value before the occurrence of the first condition2, and so on.

Reset flag = 0 The Find indicator calculates once on the same bar when the first occurrence of condition2 is found after an occurrence of condition1. The Find indicator does not recalculate if condition2 repeats.

Note: The Find value does not change if conditions 1 and 2 occur on consecutive bars if you are using the Find indicator, but the indicator value will change if you are using FindInclusive.

Note2: The Find indicators use close as a default parameter value when a condition is required. Close is a non-zero value so it is always a true condition.  However, you should not pay attention to these indicator results until you change the close to a condition that may be either true or false.

Calculations Details

Point Change = The value of the series at condition2 – the value of the series at condition1

Percent point change =  100 * (the value of the series at condition2 – the value of the series at condition1) / the value of the series at condition1.    If the value of the series at condition1 = 0, then Percent point change = not calculated, i.e., a missing bar.

Standard deviation = the square root of the variance.

Variance = Variance is a statistical measure of Series volatility.

Variance = (Syy-Sy*Sy/cnt)/(cnt-1),

       Where:

       cnt = number of bars involved,

       Sy = sum of Series values,

       Syy = sum of squared Series values.

       If cnt < 2, then Slope = not calculated, i.e., a missing bar.

Median = A value of the series at the middle bar between conditions.  If there are an even number of bars between condition, then it’s an average of the two middle bars.

Regression slope = The slope of the linear time regression line drawn through Series data points between conditions.

       Slope = (cnt*Sxy-Sx*Sy)/denominator,

       Where:

       Denominator = cnt*Sxx-Sx*Sx,

       cnt = number of bars,

       Sx = sum of bar numbers,

       Sxx = sum of squared bar numbers,

       Sy = sum of Series values,

       Sxy = sum of bar number times Series value.

       If denominator = 0, then Slope = not calculated, i.e., a missing bar.

Max Advance = An advance represents a series of several (at least two) advancing bars. The value of an advance = current high so far - previous low so far. Maximum advance is the highest advance found between conditions.

Max Decline = A decline is a series of several (at least two) declining bars. The value of a decline = current low so far - previous high. Maximum decline is the largest by absolute value decline found between conditions. Max decline displays as a negative number.