EmpiricalFX

MTF Order Block Finder

An Order Block is a special type of pivot point that satisfies the following requirement:
A Bull/Bear candle followed by X consecutive candles in the opposite direction.

Order Blocks are interesting areas that are frequently revisited and can be treated as Support/Resistance levels.
Often, you can see explosive price rejection of these areas via long wicks, high volume , and rapid price change.

Features
Choose from two themes:
- LIGHT: a classic Red and Green representing Bearish and Bullish OBs , respectively
- DARK: a clean Blue and White scheme

Choose from two drawing styles:
- LINE: three lines representing the High, Low, and Mid price levels of the OB candle
- BOX: a bounded area similar to the "rectangle" tool

Chose a custom timeframe:
- From 1 Minute (useful for Seconds interval) up to 1 Month
Note, this setting is experimental and choosing a timeframe that is extraordinarily large may not function properly.

Filter order blocks with two settings:
- Number of consecutive bars
- Minimum % change of the potential OB bar (default 0.25%)

Keep your charts clean and show only relevant OBs
- Maximum number of Bullish zones to show
- Maximum number of Bearish zones to show

FAQ
Q:How do I trade with this indicator?
A:Personally, I use a fast entry indicator to confirm Long/Short position when price is rejected. I set my SL and TP based on the current Zone and the next one, if available.

Q:Does this repaint?
A:Yes and this is okay! The "Bear" and "Bull" signals are not meant for taking positions, only showing which candle reveals the Order Block. The Zone is much more useful to us and can result in several successful trades in the near future when treated as a support/resistance area.

QWhat's the winrate?
A:Hard to say - this isn't a standalone strategy and I haven't been able to properly backtest it quite yet.
發布通知: Added "Fuzzy Logic" support!
This is useful if you have a near-perfect Order Block setup, but one candle in the following sequence is a Doji
New setting: Fuzzy Logicf Percent Move
If the % change from Open to Close is less than your Fuzzy Logic percentage, we consider it to be part of the 5 bar sequence.
發布通知: Bug Fixes
  • Fuzzy Logic bug fix
  • Fuzzy Logic default value is now more strict (reduced to 0.01% from 0.05%)
  • Zones previously drawn with additional 1-candle delay; Zones now created on close of last candle in OB sequence
  • Second candle is now considered the "Order Block" and the zone High/Low is based on this candle
發布通知: Dojis and Bug Fixes
  • Added support for filtering OBs by Doji! Choose to ignore an OB when it starts with a Doji
  • Fixed issues with MTF drawings when using LINE mode
  • Cleaned up code
發布通知: Settings changes, feature requests, and upgrades!

1. New default values for settings
  • Min. Percent move for valid OB (0.25% -> 0.3%)
  • Max Bullish Zones to show (2 -> 4)
  • Max Bearish Zones to show (2 -> 4)
  • Ignore Dojis at Start (disabled -> enabled)

2. Requested Features
  • Bullish/Bearish Zone color - set your own color and transparency instead of choosing from presets
  • Line Widths for High/Low and Avg- set your own line width when using the LINE drawing style

3. Upgrades
Order Block Draw Distance
Often times when using an Intraday chart and drawing MTF Order Blocks, you'll see
your candles shrink and compress - this can be very annoying, especially on TradingView mobile.

TradingView automatically resizes the chart to keep ALL drawings within view and unfortunately,
there are no chart settings to "ignore" drawings that aren't relevant to current price.

Now you can set a Draw Distance by percent (%) change to hide Order Blocks that are
very distant from current price.

Using this setting has several benefits:
  • MTF Order Block zones plot much faster (less objects for TV to draw)
  • Allows you to have many Order Blocks (more than the default of 4) and only show most relevant
  • Overall less frustration! No need to take your chart off "Auto" and resize it manually
發布通知: Small Upgrade!
  • Improved logic for filtering away Dojis
  • Improved clarity on several Settings tooltips
  • Reduced "Max Bars Back" requirement (Load OBs from older bars)
發布通知: MASSIVE UPDATE
Introducing several new settings, improved MTF plotting, and basic Alerts (see below for details)

3 new experimental settings!
  • Order Block Candle Shift
  • Order Block Source Selector
  • Order Block Context Search Length
All of which contribute to the creation of Order Block zones in different ways.

Order Block Candle Shift
Shift the source candle that is used for drawing Zones.
Example: For a Bullish OB, a shift of zero selects the first candle of the pattern - the Bearish candle before a sequence of Bulls.
Default = 1 (selecting the second candle)

Order Block Source Selector
Choose the price values to extract from the Order Block candle. These prices are used to draw the Zone. Default is "High/Low"
  • High/Low Mode = High and Low of OB Candle.
  • OHLC Mode = From the High/Low of the OB Candle to the Open/Close, whichever is in the direction of the OB.
  • Context Mode = Context sensitive algorithm. Picks the largest wick near the OB candle, given a search length.

Order Block Context Search Length
When using Context Mode, you can tweak the search length for the Source Selector. Example: the Default of 2 will start with the first candle of the pattern and then check the following two candles

Improved MTF Plotting
We no longer use the plotshape function, which has many MTF irregularities and drawbacks.
All plotting is done through the Line, Box, and Label functions of Pinescript.
A major benefit is highlighting the entire series of candles on a lower TF in which a higher TF Order Block comes from.
Check out the updated chart image above to get an idea of what this means (Using 4h resolution on a 15m chart)

Alerts
New simple alerts for when a new Bullish and Bearish Order Block is created.
I have plans to create 3 new alert functions for the next update:
  • A candle opening outside of and then closing within an Order Block
  • A candle opening inside of and then closing outside an Order Block
  • A candle wicking into an Order Block

Thank all so much for the wonderful support and feedback!
發布通知: FINAL UPDATE
This script is Open Source and completely free and will remain public indefinitely!

We'll be releasing a Private Script with extremely useful Alert Conditions in ~1 Week!
Consider following my Profile to see updates regarding trial periods and subscriptions.


New Alert Condition
  • Alert on creation of any new OB (previously must select Bearish or Bullish)

New Option for "Order Block Zone Drawing Style"
  • BOTH - will overlay LINE and BOX style zone, allowing you to see the average-line in addition to a clear colored area.

Bug Fixes
  • On intraday charts with a higher TF resolution for OBs - zones had a chance of being drawn multiple times, resulting in duplicates. Fixed!
  • Setting a Line width to 0 did not hide the line. Fixed!
發布通知: Removed settings that violate House Rules
發布通知: Bugs Squashed
Fixed issues with "input sanitization" and "Array out of Range" errors
發布通知: Small Update

More accurate descriptions of settings, renamed settings, moved settings into more logical groupings.
開源腳本

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

想在圖表上使用此腳本?