OPEN-SOURCE SCRIPT
Güncellendi

PD Arrays

2 145
Hi all!

This indicator is based on my indicator 'Order blocks' (tradingview.com/script/gBnqr4b2-Order-blocks/) that will show you order blocks (OB) found by the indicator or the once that are in alignment with the current trend.

This indicator will, however, not only show you order blocks but it will also find fair value gaps (FVG). Order blocks and fair value gaps are popular and a big part of inner circle trading (ICT). The true power lies in that the indicator will give you alerts and show you labels for retest ('R'), false breakouts ('FB') and breakouts ('B'). This is possible through my library 'Touched' (tradingview.com/script/6x0Ed1nM-Touched/). The possibilities of interactions in the form of breakouts allows for the findings of broken order blocks and fair value gaps. That means that this indicator allows the showing of zones that are before the CHoCH/CHoCH+ and has flipped function. So a support becomes resistance and vice versa. These zones are popular and are called breaker blocks (BB, a flipped order block) and inversion fair value gap (IFVG, a flipped fair value gap). If a broken order block is before a BOS (instead of a CHoCH/CHoCH+) it's called a mitigation block (MB) instead of a breaker block, but it has the same function.
So, broken order blocks are called breaker blocks (BB) if they're before a change of character (CHoCH/CHoCH+) and mitigation blocks (MB) if they're before a break of structure (BOS).
Broken fair value gaps are called inversion fair value gaps (IFVG). The following zones will be displayed by the indicator:

• Fair value gaps
• Inversion fair value gaps
• Order blocks
• Breaker blocks
• Mitigation blocks

The trend is based on price action that creates change of characters (CHoCH/CHoCH+) and break of structures (BOS). This is based on pivots/swings with your set length for left and right and is possible through my script 'PriceAction' (tradingview.com/script/nAGqSrxy-PriceAction/). The market structure will be displayed with solid lines and a label showing the type (CHoCH/CHoCH+/BOS).

2 things can invalidate a zone and cause it to disappear;
• broken by price or
• a CHoCH/CHoCH+ appears to start a new trend.
I.e. a bullish zone (OB/FVG/BB/MB/IFVG) will disappear upon the closing price being lower than the zone's low or a bearish CHoCH/CHoCH+ happens. A bullish BB/MB/IFVG means a bearish OB/FVG that has been broken by price and is now bullish.

I've tried to make the ability to find zones to be on a different timeframe than chart (like in my script 'Order blocks') but I have not found it to be reliable yet, so the zones are found on the chart's timeframe. I will keep working on making it more reliable, but for now it's only possible to find them on the chart's timeframe.

The default settings will show you all zones (OB/FVG) and their broken version (BB/MB/IFVG). If the trend is bullish it will show bullish OBs and bullish FVGs and bearish OBs/FVGs that are broken and now are bullish (BB/MB/IFVG), and vice versa. OBs and FVGs will be displayed as soon as they are found, IFVGs when it's broken by price and BBs/MBs upon the next structural break (CHoCH/CHoCH+/BOS). All zones within a CHoCH/CHoCH+ (from the high/low pivot that's broken to when it's broken by price) will be kept to be take action on by the script's code. They're hidden until they make sense regarding to the new trend that's determined by the 'PriceAction' library.

Settings

• Keep history
Check this if you want old zones to be kept (from previous trends). They are removed if they are broken or a CHoCH/CHoCH+ appears.

PD ARRAYS

• Fair value gaps
Show fair value gaps or not.

• Inversion fair value gaps
Show inversion fair value gaps or not.

• Order blocks
Show order blocks or not.

• Breaker blocks
Show breaker blocks or not.

• Mitigation blocks
Show mitigation blocks or not.

FAIR VALUE GAPS

• Consecutive rising/falling
The candles in the reaction must consecutivly rise or fall (the 'hl2' must be rising/falling).

• Force strong
If this is enabled it will force the FVG middle candle to have a higher/lower 'hl2' (middle of the entire candle) than the first candle's high.

• Hide consecutive zones
If multiple fair value gaps are found after each other only the first one will be found by the indicator.

• Minimum size
A factor of the Average True Range (of length 14) that the size of the fair value gap must have.

ORDER BLOCKS

• Reaction
A factor of the Average True Range (of length 14) that the total reaction must have. A higher value will create fewer zones with a bigger reaction. And check the checkbox if you want the limit to be displayed.

• Take out
The bar that start the reaction must take out the previous bar high/low (liquidity sweep).

• Consecutive rising/falling
The candles in the reaction must consecutivly rise or fall.

• Fair value gap
The middle bar in the order block must create a fair value gap.

• Hide consecutive zones
If multiple order blocks are found after each other only the first one will be found by the indicator.

DISPLAY

• Bull
The color for bullish zones (OB or FVG). This is the color before a breakout from the price, if it's broken by price once its a bearish zone instead.

• Bear
The color for bearish zones (OB or FVG). This is the color before a breakout from the price, if it's broken by price once its a bullish zone instead.

MARKET STRUCTURE

• Enable
If zones found should follow market structure or not. This is automatically enabled if 'Current trend' is true.

• Pivot
Set the length of pivots and check if they should be shown or not.

• Font size
Set the font size of market structure text.

ALERT

• Retests
Enable alerts for retest.

• False breakouts
Enable alerts for false breakouts.

• Breakouts
Enable alerts for breakouts.

Examples
Below will be some examples of how the indicator behaves. All the examples are with the default settings but only the example zone is visible.

• This demonstrates a retest of an inversion fair value gap after a CHoCH+. After price goes higher (after that support) price retests later IFVGs and goes even higher.

ekran görüntüsü

• Shows the lowest bullish fair value gap that's retested two times and goes higher. On the journey of higher prices more FVGs are retested/has false breakouts and price goes higher.

ekran görüntüsü

• Shows a bearish order block (at the top) that's retested and price goes lower.

ekran görüntüsü

• Shows a bearish breaker block that has two retests and a false breakout. The origin is a bullish order block that's now (after price has broken it) a bearish breaker block. After that resistance price goes lower.

ekran görüntüsü

• Shows a retest of a bullish mitigation block (that's a broken bearish order block).

ekran görüntüsü

The code for finding these PD Arrays are extracted to my library 'PDArrays' (tradingview.com/script/80p2t4uT-PDArrays/).

I hope that this indicator will help you in your trading and I've been trying to make an indicator like this for a very long time. Many new tries, a lot of time spent and lots of lines of code I managed to make one that I think is good enough!

If you have any findings of unexpected behavior or feature of, feel free to reach out!

Best of luck trading!
Sürüm Notları
- Disable the creation of zones if no turtle soup has happened before the change in the trend through a CHoCH/CHoCH+. This update means that zones can be created upon the occurrence of a turtle soup, if no turtle soup happened no zones will be created. The code is from my indicator 'Liquidity & inducements' (tradingview.com/script/IOmugjfT-Liquidity-inducements/). You can disable this update, and make the indicator behaves like earlier, uncheck the 'Filter' setting under the section 'Turtle soups'.

Let me know if you have any other requests on disabling zone creation of something is present or missing.
Sürüm Notları
- Be able to set the intended direction in the 'Market Structure' section. The default is both, but you can set if you only want bearish or bullish zones.
Sürüm Notları
Hi all!

Introduce what I choose to call 'confirmation pivots'. These are pivots that appears after a CHoCH/CHoCH+. After that pivot (high for bullish CHoCH/CHoCH+ and low for bearish) you can choose to let the indicator stop creating new zones. This is disabled by default, but you can enable it under the section 'CONFIRMATION PIVOTS'. The indicator will behave like this:

Disabled:
ekran görüntüsü

Enabled:
ekran görüntüsü

As you can see 2 new zones (an inverse fair value gap and a fair value gap) is created later on if it's disabled, they're not created after this pivot if filtering is enabled. When enabled it's also visualized (as a red triangle). This allows for zones that's deeper (lower for bullish trends and higher for bearish trends) and more likely to be in discount for long zones and premium for short zones (in the current dealing range).

Best of luck trading!
Sürüm Notları
Hi all!

This is a major update concerning the Pine screener from Tradingview. You can now use it to find previous integrations. These integrations causes trades to be entered and the latest 5 trades can be screened upon. You can screen for:

Entry
How many bars ago the trade was opened.

Profit
The possible maximum risk/reward for the trade. If the trade has hit it's stop loss this value will be negative. That doesn't mean a negative r/r (risk/reward), just the the stop loss is hit.

Trailing stop profit
The actual r/r win (0.5R, 1.2R etc.) if a market structure trailing stop loss would have been used. This trailing stop loss will be hit upon a change in the trend. For these statistical trades it will be hit on the open price of the bar after the trend change. This is because a change of character will happen on closed candles only, and you will be stopped out (executing but/sell order) on the next bar open.

I find this update very useful and I hope you do to!
Sürüm Notları
Hi all!

This update is about how turtle soups are detected and a Pine Screener feature.

If no turtle soup was found at the deepest retracement (highest/lowest price) before a CHoCH/CHoCH+ all zones will be invalidated. It will change the behaviour like this:


Before the change:
ekran görüntüsü

After the change:
ekran görüntüsü

So if a turtle soup is found inside a CHoCH/CHoCH+ it now needs to be at the deepest retracement (lowest in the bullish example) otherwise it will be displayed but all zones will be invalidated if that filter is on.

In the Pine Screener from Tradingview it's now possible to see/screen for the source of a trade.

It's mapped like this:
Type.FairValueGap => 1
Type.OrderBlock => 2
Type.InversionFairValueGap => 3
Type.BreakerBlock => 4
Type.MitigationBlock => 5

Hope that this update finds you well, best of luck trading!
Sürüm Notları
Hi all!

This update is considering the alert message.

"formed during falling prices" or "formed during rising prices" is added.

Best of luck trading!
Sürüm Notları
- Revalidate zones if direction has changed (and the zone now makes sense). This is applicable if turtle soups are disabled.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.