CROSSES UNDER

Category: Instructions

The CROSSES UNDER operator in ProBuilder language is used to determine if one curve or line graphically crosses below another curve on a chart. This operator is particularly useful in technical analysis for identifying potential bearish signals when analyzing financial data.

Syntax:

a CROSSES UNDER b

Example:

Consider two moving averages calculated on the closing prices of a stock: a short-term exponential moving average (EMA) and a long-term EMA. The following example demonstrates how to use the CROSSES UNDER operator to generate a signal when the short-term EMA crosses under the long-term EMA:


a = ExponentialAverage[20](close)
b = ExponentialAverage[50](close)
signal = 0
IF a[1] CROSSES UNDER b[1] THEN
    signal = -1
ELSE
    signal = 0
ENDIF
RETURN signal AS "Bearish Signal"

Explanation:

  • a = ExponentialAverage[20](close): This line defines ‘a’ as the 20-period exponential moving average of the closing prices.
  • b = ExponentialAverage[50](close): This line sets ‘b’ as the 50-period exponential moving average of the closing prices.
  • The IF statement checks if the curve ‘a’ from the previous period (a[1]) crosses under the curve ‘b’ from the previous period (b[1]).
  • If ‘a’ crosses under ‘b’, the variable signal is set to -1, indicating a bearish signal. Otherwise, it remains 0, indicating no bearish crossover.

This operator is essential for creating trading strategies and signals based on the relationship between different data series, particularly in the context of moving averages or other technical indicators.

Related Instructions:

  • CROSSES OVER instructions
  • Logo Logo
    Loading...