OPEN-SOURCE SCRIPT

Order blocks

Hi all!

This indicator will show you found order blocks that can be used as supply or demand. It's my take on trying to create good order blocks and I hope it makes sense.

First off I suggest to verify the current trend before using an order block. This can be done in a variety of ways, one way could be to use my other script "Market structure" (tradingview.com/script/ud6AQSm2-Market-structure/) which I use and suggest.

You can configure the indicator to behave differently depending on settings. These are the settings available:

• The order blocks created can be found in any higher timeframe defined in "Timeframe"
• The number of active order blocks are defined in "Count". If an order block is found the earliest order block will be replaced
• You can choose the type of order blocks that are found ("Bullish", "Bearish " or "Both") in "Type"
• The old order blocks can be kept if "Keep history" is checked
• Order blocks that are found are not removed when mitigated (entered) but when a new one appears. They can be removed when they are broken by price if "Remove broken zones" are checked

There is also a setting section called "Requirements" that defines what is required for an order block to be created. These are the settings:

• "Take out"
Check this if you want the base of the order block (the candle where the zone is drawn from (high and low)) to have to take out the previous candle (be higher or lower depending if the order block is bullish or bearish).
• "Consecutive rising/falling"
Each following candle in the reaction (the 3 reaction candles) needs to reach higher or lower (depending on bullish or bearish). Check this if you want that to be true.
• "Reaction"
Some sort of reaction is needed from the 3 candles creating the order block. This reaction is based on the value of the Average True Length (ATR) of length 14. You can here define a factor of the value from the ATR that these 3 candles needs to move in price. A higher need for a reaction (higher factor of the ATR) will create lesser zones. You can also choose to show this limit with the checkbox.
• "Fair Value Gap"
The reaction needs to create a gap (imbalance) in price. This gap is known as a "Fair Value Gap" and is created when the last candle's wick does not meet with the base candle's wick. Check this if you want this to be needed.

After these settings you can also choose the colors of the created zones. The ones that are active (called "Zones"), the ones that are replaced ("Replaced zones") and the ones that are broken ("Broken zones") (if this is enabled in "Remove broken zones").

I'm using my library "Touched" to be able to show you labels when the order blocks have a retest, false breakout and breakout. These labels can be hidden if you disable the labels under the style tab in the indicator settings.

The concept of order blocks is widely used among traders and can provide you with good supply or demand zones. I hope that this indicator makes sense.

My todo-list has a few things, but top of that list is adding alerts for zone interactions or creations. Please feel free to say what you want to be coded!

The order blocks in the publication chart are found in weekly timeframe but are shown on the daily timeframe. Other than that the image shows you zones from the default settings (which are based on the daily timeframe).

Best of luck trading!
orderblocksupplanddemandSupport and Resistance

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?

Aviso legal