Implementing a Multi-Condition Screener with Summation in ProBuilder

24 Sep 2019
0 comment
0 attachment

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.

Related Post

Check out this related content for more information:

https://www.prorealcode.com/topic/fishing-for-certain-events-in-the-last-few-days/#post-134054

Visit Link
What is a Snippet? A snippet is a small, reusable chunk of code designed to solve specific tasks quickly. Think of it as a shortcut that helps you achieve your coding goals without reinventing the wheel. How to Use: Simply copy the snippet and paste it into your project where needed. Don't forget to tweak it to fit your context. Snippets are not just time-savers; they're also learning tools to help you become a more efficient coder.
robertogozzi Master
Roberto https://www.ots-onlinetradingsoftware.com
Author’s Profile

Comments

Search Snippets

Showing some results...
Sorry, no result found!

Snippets Categories

global
35
indicator
133
strategy
171

Recent Snippets

How to Create a Simple MTF Trend Dashboard with EMA and SMA
indicator
This indicator builds a compact multi-timeframe (MTF) dashboard that shows whether price is trading above or below a [...]
How to Display Per-Bar Volume Accumulation in Real Time (Intrabar Updates)
global
This snippet tracks and displays the current bar’s accumulated volume while the bar is still forming, instead of only [...]
Ticks Counter: Count Tick Updates Per Bar on Tick or Time Charts
global
This snippet counts how many tick updates have occurred for the current bar by incrementing a per-bar counter on each [...]
How to Build a Step-Based Trailing Stop That Moves to Break-Even First
strategy
This snippet implements a step trailing stop that advances in fixed increments once price reaches predefined profit [...]
Utilizing Arrays to Track and Compare Indicator Values Within the Same Bar in ProBuilder
indicator
This ProBuilder code snippet demonstrates how to use arrays to compare the values of an indicator (RSI in this case) [...]
Logo Logo
Loading...