Flops - OrderblocksDescription
The Advanced Flops - Orderblock indicator is a sophisticated, algorithmic supply and demand tracking system. It dynamically identifies trend-following institutional structures by detecting "Flops" (often known as Orderblocks) in real-time, visualizing exact areas where momentum aggressively shifted.
Instead of relying on a rigid, single-candle definition, this engine operates on a multi-timeframe perspective natively. It simultaneously evaluates 1-Candle, 2-Candle, and 3-Candle breakout logic on every single bar to validate structural breaks and paint flawless institutional supply/demand zones on your chart.
🎯 How It Works: The 1, 2, 3 Logic
The engine evaluates the market looking for a sequence of momentum candles that break structure against the previous opposing candle. By running the 1, 2, and 3-candle logic simultaneously, the script guarantees it catches both immediate V-shape reversals (1-candle) and slower, grinding structural breaks (3-candle) without drawing overlapping or duplicated zones.
Bullish ( Flops - Orderblock ): Formed when the price forcefully breaks the high of the last bearish candle. This indicates newly created demand.
Bearish ( Flops - Orderblock ): Formed when the price forcefully breaks the low of the last bullish candle. This indicates newly created supply.
✨ Key Features
Simultaneous Multi-Candle Logic: Runs three independent sequence checkers at the exact same time to ensure no valid Orderblock is ever missed.
Dynamic Mitigation Engine: Active zones project forward indefinitely into future price action until they are touched or closed through (customizable).
Single Mitigated Memory: A sleek visual feature that automatically deletes old, invalidated zones. It keeps only the absolute last mitigated zone on your chart to show you the most recent point of failure, without cluttering your screen with historical noise.
Trend Deactivation: The script understands market structure. If the dominant trend fully flips (e.g., from Bullish to Bearish based on a 3-candle sequence), all opposing active ( Flops - Orderblock ) zones are immediately deactivated and labeled as "Trend Flip", preventing you from taking trades against a confirmed structural shift.
Boundary Customization: Choose exactly how you want your Orderblock zones measured—either wick-to-wick (High/Low) or body-to-body (Open/Close).
⚙️ Settings
Flop Boundary: Define zones using full Wicks or strictly Candle Bodies.
Mitigation Mode: Choose whether a zone is invalidated the moment a wick "Touches" it, or only when a candle "Closes" fully through the zone.
Show Only Last Mitigated Flop: Keep your charts clean by automatically erasing old mitigated lines and only leaving the single most recent mitigated Orderblock on the chart.
Deactivate on Trend Flip: Automatically invalidate all active supply zones if the macro trend shifts bullish (and vice versa).
Full Visual Control: Customize colors, line widths, line styles (solid, dashed, dotted), and label visibility to fit your exact chart aesthetic. Indicator

PD ArraysHi all!
This indicator is based on my indicator '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' (). 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' (). 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.
• 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.
• Shows a bearish order block (at the top) that's retested and price goes lower.
• 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.
• Shows a retest of a bullish mitigation block (that's a broken bearish order block).
The code for finding these PD Arrays are extracted to my library '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! Indicator

PDArraysLibrary "PDArrays"
Hi all!
This library will help you to draw fair value gaps and order blocks and their broken version; breaker blocks, mitigation blocks and inversion fair value gaps.
It does not contain any example code, but I will create an indicator called 'PD Arrays' that uses this library.
Best of luck trading!
Remove(zones, settings)
Removes the zone in 'zones.Remove' and its visuals. The visuals will be kept if 'settings.KeepHistoryZones' is true.
Parameters:
zones (Zones) : The current zone.
settings (Settings) : Set all values in this parameter to define the settings for the zones.
Interactions(zones, settings, trend)
Sets the interactions (retests\false breakouts\breakouts) from the library 'Touched'.
Parameters:
zones (array)
settings (Settings) : set all values in this parameter to define the settings for the order block creation.
trend (int) : the market structure trend that's used for the integrations direction. 1 = bullish, -1 = bearish, 0 = both.
HiddenInteractions(zones, settings, marketStructureInfo, trend)
Sets the hidden interactions (only breakouts) from the library 'Touched'.
Parameters:
zones (Zones)
settings (Settings) : set all values in this parameter to define the settings for the order block creation.
marketStructureInfo (MarketStructureInfo) : The state of market structure needed.
trend (int) : the market structure trend that's used for the integrations direction. 1 = bullish, -1 = bearish, 0 = both.
Pivots(settings)
Creates pivots (high and low) to be used for order block creation.
Parameters:
settings (Settings) : set all values in this parameter to define the settings for the order block creation.
Returns: a tuple containing two pivot values (high and low) or 'na'
OrderBlock(settings, pivotHigh, pivotLow)
Creates an order block if one is found according to the settings parameter.
Parameters:
settings (Settings) : set all values in this parameter to define the settings for the order block creation.
pivotHigh (float) : The high pivot to use.
pivotLow (float) : The low pivot to use.
Returns: a Zone object if an order block is found, na otherwise
FairValueGap(settings)
Creates a fair value gap if one is found according to the settings parameter.
Parameters:
settings (Settings) : set all values in this parameter to define the settings for the fair value gap creation.
Returns: a Zone object if a fair value gap is found, na otherwise
SetBarIndex(zone)
Sets the 'BarIndex' value of the 'zone' object according to 'zone.ChartBaseTime'.
Parameters:
zone (Zone) : The 'Zone' object to set the bar index on.
MarketStructureZones(marketStructureInfo, foundZones, zones, priceAction, settings)
Creates/draws zones (order blocks and fair value gaps) depending on the current market structure from the price action.
Parameters:
marketStructureInfo (MarketStructureInfo) : The infirmation about the market structure from the price action.
foundZones (array) : All zones (order blocks and fair value gaps) to take action on.
zones (Zones) : The 'Zones' object that holds the current context.
priceAction (PriceAction type from mickes/PriceAction/5) : The 'PriceAction.PriceAction' object from the library 'PriceAction'.
settings (Settings) : set all values in this parameter to define the settings for the fair value gap creation.
Visual
Holds the visual elements or the zone.
Fields:
Boxes (array) : All the visual boxes.
Lines (array) : All the visual lines.
Labels (array) : All the visual labels.
Zone
Holds the values for visuals for the zone and to handle interactions (retests, false breakouts and breakouts).
Fields:
BaseTimeClose (series int) : The time close for the start of the zone.
FoundTimeClose (series int) : The time close for the zone when it's found.
ChartBaseTime (series int) : The time for the start of the zone according to the chart bar.
High (series float) : The maximimum price of the zone.
Low (series float) : The minimum price of the zone.
ReactionLimit (series float) : Set a factor (%) of the Average True Range (of length 14) that the total reaction must have.
TouchedZone (Zone type from mickes/Touched/17) : Zone object that will be created and sent to the library 'Touched'.
Visual (Visual) : An object that holds the visual elements for the zone.
SourceTimeframeSeconds (series int) : The 'timeframe.in_seconds' for the zone.
Direction (series int) : Defines if the found zone is bullish (1) or bearish (-1).
LatestRetestBarIndex (series int) : The latest 'bar_index' for a retest.
LatestFalseBreakoutBarIndex (series int) : The latest 'bar_index' for a false breakout.
LatestBreakoutBarIndex (series int) : The latest 'bar_index' for a breakout.
BarIndex (series int) : The chart's timeeframe 'bar_index'.
OriginType (series Type) : The 'Type' for the origin (order block or fair value gap).
Type (series Type) : The type of the zone.
Visible (series bool) : If the zone is drawn and not removed or re-drawn.
Zones
Holds the values for the charts zones.
Fields:
Zones (array) : The currently active zones.
Removes (array) : Reprsents the zones that will be replaced.
HiddenZones (array) : The currently hidden zones.
OrderBlockSettings
The settings specific for order block creation.
Fields:
TakeOut (series bool) : If the bas candle needs to be higher\lower than the previous candle (liquidity sweep\grab).
FairValueGap (series bool) : If there needs o be a fair value gap between the first and the last (third) candle of the order block.
ConsecutiveRisingOrFalling (series bool) : The candles in the reaction must consecutivly rise or fall (the 'hl2' must be rising/falling).
ReactionFactor (series float) : 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.
ShowReaction (series bool) : Show a solid line for the reaction limit.
HideConsecutiveZones (series bool) : If multiple order blocks are found after each other only the first one will be found by the indicator.
FairValueGapSettings
The settings specific for fair value gap creation.
Fields:
ConsecutiveRisingOrFalling (series bool) : The candles in the reaction must consecutivly rise or fall (the 'hl2' must be rising/falling).
Strong (series bool) : 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.
HideConsecutiveZones (series bool) : If multiple order blocks are found after each other only the first one will be found by the indicator.
MinimumSizeFactor (series float) : A factor of the Average True Range (of length 14) that the size of the fair value gap must have.
Settings
The settings for the creation of order blocks and fair value gaps. You will need to set all the containing values in here.
Fields:
KeepHistoryZones (series bool) : Set to true if you want removed (from previous trend) zones to be displayed.
Bull (series color) : The color of bullish zones.
Bear (series color) : The color of bearish zones.
CreateCreationZone (series bool) : Set to true if you want a box with a border to be drawn at the creation of the zone. This is usefull when the zones comes from a higher timeframe, but not from a lower. If this is false the 'Draw()' function will start at 'time - time_close'.
AlertRetests (series bool) : Enable if you want alerts to fire when the 'Touched' library signals that a retest of the order block has occured.
AlertFalseBreakouts (series bool) : Enable if you want alerts to fire when the 'Touched' library signals that a false breakout of the order block has occured.
AlertBreakouts (series bool) : Enable if you want alerts to fire when the 'Touched' library signals that a breakout of the order block has occured.
AlertMessageFormat (series string) : Set the format of the fired alert uppon 'Touched' library signals. Need to be in the format of '{0} on order block from ...' where '{0}' is replaced with 'retest', 'false breakout' or 'breakout'.
Types (array) : All types that should be displayed.
FairValueGapSettings (FairValueGapSettings) : The settings for the creation of fair value gaps.
OrderBlockSettings (OrderBlockSettings) : The settings for the creation of order blocks.
MarketStructurePivot
Pivot The 'PriceAction.Pivot' for the market structure.
Fields:
BrokenBarIndex (series int)
Pivot (Pivot type from mickes/PriceAction/5)
MarketStructureInfo
Holds the needed market structure pivots needed for this library.
Fields:
LatestBreakOfStructure (MarketStructurePivot) : The latest break of structure (BOS) found by the 'PriceAction' library.
LatestChangeOfCharacter (MarketStructurePivot) : The latest change of character (CHoCH\CHoCH+) found by the 'PriceAction' library. Library
