Identifying Supply/Demand Zones Using ZigZag Swings in ProBuilder

13 Aug 2020
0 comment
0 attachment

This code snippet demonstrates how to identify potential supply and demand zones (commonly known as support and resistance levels) using the ZigZag indicator in the ProBuilder programming language. The ZigZag indicator is used to filter out smaller price movements, focusing on significant highs (peaks) and lows (troughs) based on a specified percentage change.


// Parameters
percent = 3
lookback = 200
threshold = 1
minPoint = 2

// ZigZag calculation and support/resistance logic here
// (Actual code implementation would be placed here)

Explanation of the Code:

  • percent = 3: This sets the minimum percentage change required for a new peak or trough to be considered in the ZigZag calculation. A change smaller than this percentage will be ignored, reducing noise and focusing on significant swings.
  • lookback = 200: This parameter defines the number of bars to look back to determine if a peak or trough can be considered as a potential support or resistance level. This effectively sets the temporal scope for the analysis.
  • threshold = 1: This is the percentage range within which a new ZigZag peak or trough must fall to validate a previous one as a support or resistance level. It ensures that only closely aligned peaks and troughs are considered valid.
  • minPoint = 2: At least two swings of the same type (either peaks or troughs) must be within the “threshold” percentage of each other to validate a level as support or resistance. This parameter helps in confirming the strength and relevance of the support or resistance level.

The code snippet would typically include logic to calculate the ZigZag values based on price data, identify peaks and troughs, and then apply the criteria defined by threshold and minPoint to determine valid support and resistance zones. These zones are crucial for traders as they can indicate potential reversal points in the price of an asset.

Related Post

Check out this related content for more information:

https://www.prorealcode.com/topic/recherche-une-presentation-similaire-aux-rs-zonebourse/#post-90161

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.
Nicolas Master
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
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...