ToggleSince and ToggleSinceInclusive

Top  Previous  Next

ToggleSince(what, condition)

ToggleSinceInclusive(what, condition)

 

Parameters:

What - an integer number between 1 and 4 (default 1).

Condition  – a time series that must be a condition that defines when the search begins (default Close should not be used)

 

What:

1 = between the conditions, it returns 1 and elsewhere it returns 0
2 = between the conditions, it returns 0 and elsewhere it returns 1
3 = between the conditions, it returns 1 and elsewhere it returns N/A
4 = between the conditions, it returns N/A and elsewhere it returns 1

 

ToggleSince excludes the bar where condition is true.

ToggleInclusive includes the bar where condition is true.

 

These indicators are the same as the Toggle and ToggleInclusive indicators, but Condition 2 is replaced by the current bar. These indicators tell you when a condition began.

The N/A (missing value) is a largely undocumented feature that causes the indicator to be ignored (missing).  You could use options 3 and 4 above to exclude rows for training a neural net.

Note:  This indicator uses 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 the indicator results until you change the close to a real condition such as the RSI < 30 or a crossover.