OPEN-SOURCE SCRIPT

ICT & FVG [UgurTash]

1 505
ICT & FVG [UgurTash]

The level that stopped you was never on your chart
You are on the 15m. The setup is clean, the structure agrees, you take it, and price stalls twelve ticks later at nothing. There is no level there. Not on the 15m.
Open the daily and there it is: a gap left three weeks ago, or the block that started the leg you are currently trading against. It was always there. You just could not see it from where you were standing.
That is the problem this script is built around. Everything else it does is support.

What it actually draws
Five higher timeframes at once, projected onto whatever chart you are on. Monthly, weekly, daily, 4H and 1H by default, each with its own colour and its own switch. Every zone is tagged with the timeframe that produced it, so a box reading OB+ [D] is unambiguous: that is a daily bullish order block, seen from the 15m, drawn at its real daily price and its real daily origin bar.
Two kinds of zone come from each timeframe:
Fair Value Gaps. A three candle gap in that timeframe's own bars. A daily FVG is built from daily candles, not from an average of 15m ones.
Order Blocks. The candle a move actually came from, found by structure rather than by colour. More on the method below, because the method is the part that matters.
And because a higher timeframe zone is only interesting while it is still unfilled, each one carries a state you can see at a glance: untouched, tested, or filled.

How an Order Block is found
Most order block scripts take the last opposite coloured candle before a strong move. That sounds right and often is not. In a real displacement leg there is usually a small pause bar somewhere in the middle, and the nearest opposite candle rule will happily mark that pause bar instead of the place the move came from.
This one works differently, in two steps.
Step one, structure. A swing high or low is confirmed only after a set number of bars have failed to exceed it. Nothing happens until price closes beyond that confirmed swing. No break of structure, no block.
Step two, the origin. When the break happens, the leg between the swing point and the breakout bar is scanned, and the block is anchored to the extreme candle of that leg: the lowest low for a bullish block, the highest high for a bearish one. That is the candle the move actually left from, whatever colour it happened to close.
Each swing point can only produce one block. Once it has been broken it is spent, so the same level does not keep re-arming as price chops around it.
The same function runs on the chart timeframe and inside each of the five higher timeframes, so a 1H block and a 1D block are built by an identical definition. They are comparable because they are the same measurement at different scales.
Optional on top of that: Use Candle Body to measure the block from the body instead of the full range, and Break Confirmation, which demands the breakout close clear the swing by a fraction of the swing range before anything is created. Both are off by default.

Higher timeframe blocks do not repaint
This is worth its own paragraph because it is the easiest thing in a multi timeframe script to get quietly wrong.
Confirm MTF Order Blocks On HTF Close is on by default. A higher timeframe block is only published once its own bar has closed. A daily block appears at the daily close and then never moves, never shifts edge, never vanishes on a later reload.
Turn it off and blocks appear as soon as the condition is met inside the forming higher timeframe bar. Earlier, and able to change its mind. The switch is there because some people want that trade off. The default is the honest one.

Breaker Blocks
A block that price closes through does not have to die.
Turn on Show Breaker Blocks and it flips polarity instead. A bullish block that fails becomes resistance, keeps its box, and is relabelled BB-. It stays until price closes back through its far edge, at which point it is genuinely spent and removed.
This is the same idea the script already applies to gaps through Inverse FVG, now applied to blocks, on the chart timeframe and on every higher timeframe alike. Off by default.

Zone states, and what happens when a zone is used up
Three states, and all three are configurable.
Untouched. Full colour. Nobody has been there yet.
Tested. Price has wicked into the zone without closing through it. The fill fades by an amount you set and the border changes to dashed, dotted, solid or nothing. Turn the whole thing off if you would rather not see it.
Filled. Price closed through. This is where the script stops deciding for you: pick Gray Out to keep it greyed and frozen as a record, Delete to clear it off the chart entirely, or Keep to leave it in its original colour. Fair Value Gaps and Order Blocks get that choice separately, because most people want different behaviour from each.
If you trade a clean chart, set filled gaps to Delete and filled blocks to Gray Out. The chart cleans itself and you still keep the history where it matters.

The chart timeframe layer
The higher timeframe module sits on top of a full imbalance engine running on your own chart, and the two are controlled independently. Switching the MTF panel off does not touch your local zones, and vice versa.
Fair Value Gaps with three mitigation definitions (Engulf, Mitigate, Rebalance), a consequent encroachment line, and Liquidity Void mode which merges consecutive gaps into one region.
Inverse FVG. A filled gap flips and starts working from the other side.
Implied FVG. The wick based variant, for the gaps that do not show up as a clean three candle structure.
Volume Imbalance in classic and advanced form, the body to body gaps between consecutive candles.
True GAP and GAP plus inefficiency, for instruments that actually gap.
Order Blocks and Breaker Blocks, by the method described above.
Each family has its own box limit and its own mitigation rule. Nothing is forced on you.

About the way the boxes look
The fills use a rule worth explaining, because it is the reason the chart stays readable with eight families of zone drawn at once.
The colour picker shows what you chose. What gets drawn is a fixed fraction of that opacity, so the default 50 in the settings lands on screen at a density that layers cleanly instead of burying the candles. Move the slider and the chart moves with it. You get an honest number in the settings and a usable chart at the same time, which the usual approaches give you one of but not both.
Borders are off by default, because a fill and a frame competing for the same edge is noise. Set Box Border Width to 1 if you disagree. Tested and filled zones can still draw their own border regardless.

Where to start
Turn off what you are not using. Seriously. With five higher timeframes and eight local zone families all enabled at once the chart is unreadable, and that is a setting problem, not a script problem.
A reasonable starting point for an intraday chart: monthly and weekly off, daily and 4H on, FVG and Order Blocks on, everything else off. Add one thing at a time from there.
Then set the Swing Lookback for each layer. It is the single control that decides how many blocks you get. Low means many, early and noisy. High means few, late and significant. The MTF layer has its own value because higher timeframe bars are scarce and usually want a smaller number than your chart does.

Limitations, honestly
Chart timeframe order blocks move on the live bar. A block is created the moment price closes beyond a swing, and on the forming bar that close is still changing. It can appear and disappear until the bar closes. Higher timeframe blocks do not have this problem when Confirm On HTF Close is on, which is why it is on.
The block scan is bounded. Max Scan Bars defaults to 50. In an unusually long leg the block anchors to the extreme within the last 50 bars rather than the true origin of the move. Raise it if your instrument runs long legs, but it is a real ceiling and you should know it is there.
Zone state is judged on the chart timeframe's closes. A daily zone is marked filled when the chart you are looking at closes through it, not when the daily candle does. On a 5m chart that is a faster verdict than a daily trader would give.
Five higher timeframes means ten data requests. On a slow connection or a thin symbol the script takes a moment to draw. Disable the slots you are not using.
None of this is a signal. There is no entry, no stop, no target, no win rate, nothing backtested and nothing claimed. It draws where price left work undone. What you do about that is the actual trade, and it is yours.

Feedback welcome, particularly the kind that finds something broken.
Nothing here is financial advice.

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.