指定
Inputs
- Number of bars to the left of fractal
- Number of bars to the right of fractal
- Number of bars we look back from the current bar (e.g., 30)
- Number of most recent up (or down) fractals we consider (e.g., 3) within the look-back period (from input 3) to form a valid level
- Option to either consider last consecutive fractals OR simply all fractals meeting criteria (within the look-back period for both)
- Fractals' distance from each other in order to form a valid level; it can be set as a fixed percentage, value, pips or dynamically calculated based on another indicator being a coefficient times current ATR or StdDev (e.g., within 1/3*ATR from each other)
- Draw level at either last fractal’s value or candle’s high (or low) associated with last fractal
- Terminate level after x bars
- Too far criteria for termination of drawn level (fixed distance, percentage, pips or coefficient*ATR or StdDev) with an option to turn it ON/OFF
- Indicators’ settings (different settings can be used for input 6 and 9)
- Anything else that is useful (suggestions are welcome)
Criteria for Finite Support or Resistance
A support or resistance level should be finite when any of the following conditions are met:
- A new support or resistance level forms, meeting the updated criteria
- Finite/terminate level after x bar
- Price moved significantly far away from the level. Far being either a fixed value, pips, percentage difference or a coefficient*(ATR or StdDev) from the level, indicators value associated when price was last time at the level’s value. Example: price is currently at 78, valid level is at 74, we look at the indicators’ value when price was last time at 74 and not current levels because in fast-moving markets, indicators' values increase.
This is mainly implemented to keep the levels relevant.
Example Inputs
Assume we have the following settings:
- Bars to the left of fractal: 2
- Bars to the right of fractal: 2
- Look-back period (bars): 30
- Recent fractals count: 3
- Consecutive mode
- Distance between fractals: Fixed at 0.05%
- Draw from last fractal value
- Terminate level after 20 bars
- Terminate if prices are 4*ATR or more far from drawn level
- Default settings
- ...
With these settings, in the last 30 bars, if the last 3 (so consecutive) or more down fractals (using 2 bars left, 2 bars right) have no more than a 0.05% difference from each other, a resistance line is drawn at the last fractal value. If either a new resistance is formed OR 20 bars passed OR price moved 4ATR from the level, we stop drawing the resistance for the future while letting the level visible for the whole period it was valid.
Purpose
This will be used in various Expert Advisors to detect potential turning points in the market (trade breakouts, failed breakout, etc.).
Quality
The indicator needs to be reliable, robust and non-repainting.
Note
The x-bar fractals indicator is provided to you for ease of programming.
I'm open to any suggestions or ideas to improve the indicator.