This code snippet demonstrates how to create a stock screener in ProBuilder that filters stocks based on multiple technical indicators and conditions over a specified number of bars. The screener checks for conditions involving the Relative Strength Index (RSI), the Average Directional Index (ADX), volume, and closing price.
c1 = rsi[14] crosses over 40
c2 = adx[14] > 25
c3 = volume > 100000
c4 = close > 5
cx = c1 and c2 and c3 and c4
x = summation[10](cx)
Screener[x](volume)
Explanation of the Code:
- c1: This condition checks if the 14-period Relative Strength Index (RSI) crosses over the value of 40. This is typically used to identify a potential increase in price momentum.
- c2: This condition verifies if the 14-period Average Directional Index (ADX) is greater than 25, suggesting a strong trend.
- c3: This condition ensures that the trading volume is greater than 100,000, indicating significant trading activity.
- c4: This checks if the closing price of the stock is greater than 5, filtering out lower-priced stocks.
- cx: This is a composite condition that combines all the above conditions (c1, c2, c3, and c4) using a logical AND. This means all conditions must be true for cx to be true.
- x: This line calculates the summation of true instances of cx over the last 10 bars. It quantifies how many times all conditions were met during the last 10 periods.
- Screener[x](volume): This function call creates a screener that outputs stocks where the conditions specified in ‘x’ have been true at least once over the specified period, alongside their volumes.
This screener can be particularly useful for traders looking for stocks that meet specific technical criteria consistently over a short period, indicating potential trading opportunities.