Overbasic – Analysis-Tool functions

My.Analysistool category contains all built-in analysis functions available in Overbasic.

BarSince #

Calculates how many bars the boolean expression passed as an argument is TRUE. Calculation takes place backwards (from current bar to the first bar of data series) and stops when the boolean expression is FALSE, returning the total count of bars processed up to that moment.

Result type: numeric

Arguments:

  • BOOLEAN EXPRESSION: any boolean expression.
Dim i As Numeric = My.Analysistool.Barsince(Close > Open)

CandlePattern #

Returns TRUE if the pattern / candle indicated in the PATTERNNAME argument exists in a given bar.

Result type: boolean

Arguments:

  • PATTERNNAME: name of the pattern to find (select it from available patterns list).
  • TREND PERIODS: number of periods (bars) to use to calculate trend direction. Some candlesticks / patterns take on a different meaning depending on the trend they are in (e.g. Hammer / Hanging-Man). Therefore, if TREND-PERIODS is equal to 20, current bar trend is calculated based on direction of previous 20 bars.
  • PERIOD: (optional) bar index where to find the pattern. If omitted, current bar index is used.
Dim b As Boolean = My.Analysistool.Candlepattern("(bullish) engulfing bullish", 20)

Cross #

Returns the bar index where DATA ARRAY 1 crosses DATA ARRAY 2 for the first time in the specified range of bars. Returns “0” (zero) if no crossing occurs.

Result type: numeric

Arguments:

  • DATA ARRAY 1: any array function or variable (e.g. Open, High, Low, Close, Volume, Indicators, etc.).
  • DATA ARRAY 2: any array function or variable (e.g. Open, High, Low, Close, Volume, Indicators, etc.).
  • PERIOD: (optional) number of bars to explore (preceding the current bar). If FROM and TO are set, they take precedence over PERIOD. If PERIOD, FROM and TO are omitted, the exploration goes from the first to the last bar.
  • FROM: (optional): index of the first bar to explore.
  • TO: (optional): index of the last bar to explore.
'Cross returns the bar index (or zero) where Close crosses its 20-period Simple Moving Average over the last 30 bars.
Dim i As Numeric = My.Analysistool.Cross(Close, Mov(Close, 20, "S"), 30)

CrossAbove #

Returns TRUE if DATA ARRAY 1 crosses DATA ARRAY 2 upwards in the current bar or the bar specified by PERIOD.

Result type: boolean

Arguments:

  • DATA ARRAY 1: any array function or variable (e.g. Open, High, Low, Close, Volume, Indicators, etc.).
  • DATA ARRAY 2: any array function or variable (e.g. Open, High, Low, Close, Volume, Indicators, etc.).
  • PERIOD: (optional) bar index to process. If omitted, current bar is processed.
'In the example, CrossAbove returns TRUE if Close crosses its 20-period Simple Moving Average upwards in the current bar.
Dim b As Boolean = My.Analysistool.CrossAbove(Close, Mov(Close, 20, "S"))

CrossBelow #

Returns TRUE if DATA ARRAY 1 crosses DATA ARRAY 2 downwards in the current bar or in the bar specified by PERIOD.

Result type: boolean

Arguments:

  • DATA ARRAY 1: any array function or variable (e.g. Open, High, Low, Close, Volume, Indicators, etc.).
  • DATA ARRAY 2: any array function or variable (e.g. Open, High, Low, Close, Volume, Indicators, etc.).
  • PERIOD: (optional) bar index to process. If omitted, current bar is processed.
'In the example, CrossBelow returns TRUE if Close crosses its 20-period Simple Moving Average downwards in the current bar.
Dim b As Boolean = My.Analysistool.CrossBelow(Close, Mov(Close, 20, "S"))

GapDown #

Returns True if current bar (or the one indicated in PERIOD) is in “Gap Down” with previous bar.

Result type: boolean

Arguments:

  • PERIOD: (optional) bar index to process. If omitted, current bar is processed.
  • ONLY REAL BODY: (optional) if TRUE, only bar / candle body is considered (i.e. Open / Close range).
Dim b As Boolean = My.Analysistool.Gapdown()

GapUp #

Returns True if current bar (or the one indicated in PERIOD) is in “Gap Up” with previous bar.

Result type: boolean

Arguments:

  • PERIOD: (optional) bar index to process. If omitted, current bar is processed.
  • ONLY REAL BODY: (optional) if TRUE, only bar / candle body is considered (i.e. Open / Close range).
Dim b As Boolean = My.Analysistool.Gapup()

InPrev #

Returns True if current bar (or the one indicated in PERIOD) is contained in previous one.

Result type: boolean

Arguments:

  • PERIOD: (optional) bar index to process. If omitted, current bar is processed.
  • ONLY REAL BODY: (optional) if TRUE, only bar / candle body is considered (i.e. Open / Close range).
Dim b As Boolean = My.Analysistool.Inprev()

Max #

Calculates maximum value of DATA ARRAY in the range of bars being processed (PERIOD + SINCE).

Result type: numeric

Arguments:

  • DATA ARRAY: any array function or variable (e.g. Open, High, Low, Close, Volume, Indicators, etc.).
  • PERIOD: (optional) number of bars preceding current bar involved in the calculation. If omitted, all bars starting from the first (according to ‘SINCE’ expression) will be considered.
  • SINCE: (optional) boolean expression indicating the bar where to start the calculation. In other words, the calculation of maximum value will start from the bar where SINCE is TRUE for the first time.
'In the example, Max returns maximum value of Close calculated in the last 30 bars.
Dim d As Numeric = My.Analysistool.Max(Close, 30)

MaxEx #

Calculates maximum value of DATA ARRAY in the specified TIME INTERVAL.

Result type: numeric

Arguments:

  • DATA ARRAY: any array function or variable (e.g. Open, High, Low, Close, Volume, Indicators, etc.).
  • TIME INTERVAL: time interval where to calculate the maximum. Possible values:
    • MIN: current minute (or the one corresponding to DATE / TIME)
    • H: current hour (or the one corresponding to DATE / TIME)
    • D: current day (or the one corresponding to DATE / TIME)
    • W: current week (or the one corresponding to DATE / TIME)
    • M: current month (or the one corresponding to DATE / TIME)
    • Y: current year (or the one corresponding to DATE / TIME)
  • DATE: (optional) specifies the reference date for the calculation. If omitted, current bar date is used.
  • TIME: (optional) specifies the reference time for the calculation. If omitted, current bar time is used.
'In the example, Maxex returns maximum value of Close calculated in the current minute.
Dim d As Numeric = My.Analysistool.Maxex(Close, "MIN")

Min #

Calculates minimum value of DATA ARRAY in the range of bars being processed (PERIOD + SINCE).

Result type: numeric

Arguments:

  • DATA ARRAY: any array function or variable (e.g. Open, High, Low, Close, Volume, Indicators, etc.).
  • PERIOD: (optional) number of bars preceding current bar involved in the calculation. If omitted, all bars starting from the first (according to ‘SINCE’ expression) will be considered.
  • SINCE: (optional) boolean expression indicating the bar where to start the calculation. In other words, the calculation of minimum value will start from the bar where SINCE is TRUE for the first time.
'In the example, Min returns minimum value of Close calculated in the last 30 bars.
Dim d As Numeric = My.Analysistool.Min(Close, 30)

MinEx #

Calculates minimum value of DATA ARRAY in the specified TIME INTERVAL.

Result type: numeric

Arguments:

  • DATA ARRAY: any array function or variable (e.g. Open, High, Low, Close, Volume, Indicators, etc.).
  • TIME INTERVAL: time interval where to calculate the minimum. Possible values:
    • MIN: current minute (or the one corresponding to DATE / TIME)
    • H: current hour (or the one corresponding to DATE / TIME)
    • D: current day (or the one corresponding to DATE / TIME)
    • W: current week (or the one corresponding to DATE / TIME)
    • M: current month (or the one corresponding to DATE / TIME)
    • Y: current year (or the one corresponding to DATE / TIME)
  • DATE: (optional) specifies the reference date for the calculation. If omitted, current bar date is used.
  • TIME: (optional) specifies the reference time for the calculation. If omitted, current bar time is used.
'In the example, Minex returns minimum value of Close calculated in the current minute.
Dim d As Numeric = My.Analysistool.Minex(Close, "MIN")

OutPrev #

Returns True if current bar (or the one indicated by PERIOD) contains previous bar.

Result type: boolean

Arguments:

  • PERIOD: (optional) bar index to process. If omitted, current bar is processed.
  • ONLY REAL BODY: (optional) if TRUE, only bar / candle body is considered (i.e. Open / Close range).
Dim b As Boolean = My.Analysistool.Outprev()

Pivot #

Returns the pivot level value specified in PIVOT TYPE (in current bar or in the one identified by PERIOD).

Result type: numeric

Arguments:

  • PIVOT TYPE: specifies the pivot level to get from the function:
    • R3: third level of resistance
    • R2: second level of resistance
    • R1: first level of resistance
    • P: pivot
    • S1: first level of support
    • S2: second level of support
    • S3: third level of support
  • PERIOD: (optional) bar index to process. If omitted, current bar is processed.
'In the example, Pivot returns the value of third level of support in the current bar.
Dim d As Numeric = My.Analysistool.Pivot("S3")

TrendForce #

Returns a value between -3 and +3 indicating the strength of trend. The lower the value, the more negative the trend will be and vice versa. “0” (zero) identifies a directionless trend.

More specifically:

  • +3 = identifies a very positive trend
  • +2 = identifies a positive trend
  • +1 = identifies a slightly positive trend
  • 0 = identifies a lateral trend (with no specific direction)
  • -1 = identifies a slightly negative trend
  • -2 = identifies a negative trend
  • -3 = identifies a very negative trend

Result type: numeric

Arguments:

  • DATA ARRAY: any array function or variable (e.g. Open, High, Low, Close, Volume, Indicators, etc.).
  • PERIODS: number of bars preceding current bar involved in the calculation.
In the example, Trendforce returns the trend strength of Close data over the 20 bars prior to current bar.
Dim i As Numeric = My.Analysistool.Trendforce(Close, 20)