HTF CISD Shift Entry Engine [tradewsamet]

4 329
🧭 HTF CISD Shift Entry Engine follows a single idea from start to finish: a level is taken, the delivery that took it reverses, and price comes back to the origin of that reversal. It tracks untaken highs and lows from the higher timeframe, the mid timeframe, the trading sessions, the previous day and the previous week. When price trades through a level, the script measures the candle run that delivered price there and waits for a close through the open of that run. That close is the Change in State of Delivery (CISD). It arms an entry zone with a defined entry, invalidation and exit plan, and the zone stays on the chart until it is retested, expires or is cancelled.

Most CISD tools mark every candle that closes through the open of an opposite run. On an intraday chart that happens many times a day, in the middle of ranges, with no level behind it and against the larger trend. This script asks three questions in order, and a setup only exists when all three are answered: was a level taken, did delivery shift afterwards, and did price return to the zone in time?

The core idea: level first, shift second, entry last. A shift without a level is ignored.

📊 OVERVIEW

Every setup moves through the same states, and the panel always shows which state is active:

— Scanning: untaken levels are tracked above and below price
— Level Taken: price trades through a level and the script starts watching for the shift
— Zone Armed: a full-bodied candle closes through the CISD level and the entry zone is drawn
— In Setup: price returns to the entry and the exit plan takes over
— Completed: the setup ends as TRAILED, TARGET, INVALIDATED or CLOSED, with the result in R on the chart

A zone that is never retested ends as EXPIRED, or as NO RETEST when price leaves without coming back. Neither counts as a setup in the history.

🧩 WHY THESE COMPONENTS WORK TOGETHER

Levels, shift, zone, exit and panel read from the same engine, so they cannot contradict each other. The level that is taken defines where the delivery run ends. The run defines the CISD level. The CISD level and the swept extreme define the entry, the invalidation and the size of 1R. The same R is used for the exit, the chart labels and the history.

The chain is:
Untaken level → Level taken → Delivery run → CISD close → Trend check → Entry zone → Retest → Exit → History

🔍 WHAT MAKES THIS MODEL ORIGINAL

1️⃣ A level must be taken first

Five sources feed the level list: higher-timeframe swings, mid-timeframe swings, completed Asia, London and New York sessions, the previous day and the previous week. Levels that sit within 0.1 ATR of each other count as the same level. When several are taken in the same move, the script measures from the deepest one and names it on the chart, for example PDL+4H LOW.

2️⃣ A measured delivery run

The CISD level is not the open of the last opposite candle. It is the open of the whole run of same-direction candles that delivered price into the swept extreme, up to 12 candles.

3️⃣ Acceptance cancels the idea

If price closes more than 1.5 ATR beyond the taken level before the shift appears, the move is treated as acceptance and the watch is dropped.

4️⃣ A trailing invalidation drawn step by step

In the Runner model there is no fixed target. The invalidation follows the best price at a fixed distance in R and never loosens. The chart draws every step: the red area between the entry and the invalidation shrinks as it moves, and the area beyond the entry turns green once it is locked in. The best price reached is drawn separately from the actual exit, so the drawing never shows more than the result.

5️⃣ Four exit models on the same setup

Runner, Target + Runner, Final Target and Scale Out 1·2·3 use the same entries and the same 1R. Switching the model recalculates the history in the panel.

6️⃣ A history with costs in

Each setup is charged 0.5% of the daily ATR for spread and slippage. A bar that opens beyond the invalidation exits at its open, not at the invalidation price. When entry and invalidation trade in the same bar, the setup counts as invalidated.

🧠 HOW IT WORKS — CALCULATION FLOW

Step 1 — Levels: higher-timeframe and mid-timeframe candles are built from the chart's own bars. A 3-candle swing high or low becomes a level once the candle after it has closed. Session, day and week extremes become levels when that period ends. Each side keeps its eight most recent levels.

Step 2 — Level taken: a high above an untaken high starts a short watch, a low below an untaken low starts a long watch. The watch lasts for the Shift Window (default: one higher-timeframe candle). A new sweep in the same direction extends it, up to three windows.

Step 3 — Delivery run and CISD: the run that made the swept extreme is measured. The shift is confirmed when a bar closes through the open of that run with a body of at least the Displacement setting (default 0.5 ATR).

Step 4 — Trend check: with the HTF Trend Filter on, long setups need the last completed higher-timeframe close above its 200 EMA, short setups need it below.

Step 5 — Entry zone: the zone runs from the CISD level to the midpoint between that level and the swept extreme. The entry is the middle of the zone. The invalidation sits beyond the extreme by the Invalidation Buffer (default 0.75 ATR). Setups with an unusually small or large risk are skipped.

Step 6 — Retest: the zone waits for the Retest Window (default: one higher-timeframe candle). If price reaches the first objective without returning, the zone is cancelled.

Step 7 — Exit: Runner trails the invalidation at the Trail Distance (default 4R): it starts to move at +3R and reaches the entry at +4R. Target + Runner closes half at the target and trails the rest. Final Target uses the nearest untaken opposite level between 1R and 3R, or a fixed R when none qualifies. Scale Out closes in thirds at 1R, halfway and the final target. Setups that run too long are closed by time.

📖 HOW TO USE

🎯 Quick start:

1. Add the indicator to a 15 minute chart. Auto pairs it with 4H levels.
2. Read the large state at the top of the panel: SCANNING, LONG or SHORT, with the current step below it.
3. Follow the three numbered steps in the panel. Each one is checked off as it completes and shows how long ago that happened.
4. While a zone is armed, check the remaining retest window and the distance to the entry in ATR.
5. In a setup, the plan section shows the entry, the current invalidation and where the trail reaches the entry.
6. Compare the exit models on your symbol and timeframe, and read the history as a description of the loaded bars.

👁️ Reading the chart:

— ① marks the level that was taken, with a ring on the swept extreme
— ② marks the CISD, with a line from the start of the delivery run to the candle that closed through it
— The painted candle is the one that confirmed the shift. A painted candle without a drawing is a shift whose zone was never retested
— The white dot (dark dot on light charts) is the entry
— Red area: distance between the entry and the invalidation. Green area: locked in by the trail. Faint area: how far price reached
— Stepped line: every move of the trailing invalidation
— On a live setup, a curved dashed path sketches the plan. It is a visual aid, not a forecast
— Long setups are cyan, short setups amber and levels violet by default, so they stay clear of red and green candles

📋 Panel:

— State and direction, with a progress bar for the current window or for the open setup
— Three steps: level taken, shift, entry on retest
— Plan: entry, invalidation or trail, and the target or entry-lock price. While scanning it shows the last setup instead
— History: net R with costs, number of setups, the last 14 outcomes (■ trailed or target, □ invalidated, ◪ closed by time) and the count of each ending
— The history label shows the period it covers: LAST 12 MONTHS, or SINCE a month when the chart holds less data

🎨 VISUALS

The theme follows the chart background automatically, or the panel can be fixed to Dark or Light. Lines, boxes and labels always adapt to the real background, and custom colors that would be hard to read are adjusted. Step labels move aside when they would overlap. Labels have four sizes, the panel has three sizes and five positions, and up to 40 past setups can be kept on the chart.

⚙️ KEY SETTINGS

⚙️ Engine:

— Higher Timeframe: Auto, or 15m to 1D
— Daily Levels, Weekly Levels, Session Levels (charts of 1H and below), Mid-Timeframe Levels
— HTF Trend Filter and Trend EMA Length: default on, 200
— Displacement: default 0.5 ATR
— Max Displacement: default off
— Shift Window and Retest Window: default 1 higher-timeframe candle each
— Direction: Both, Long Only or Short Only

🎯 Setup:

— Exit Model: default Runner
— Trail Distance: default 4R
— Invalidation Buffer: default 0.75 ATR
— Target and Fixed / Fallback R: used by the models that close at a target
— Setups per Direction: default 2

🎨 Display and panel:

— Past Setups, Step Labels, Label Size, CISD Candle Color, Plan Path, HTF Levels, colors, Theme
— Show Panel, Position, Size

🔔 ALERTS

— HTF Level Taken: a tracked level was taken and the watch started
— CISD Confirmed · Zone Armed: the shift closed and the entry zone is live
— Entry Zone Retested: price reached the entry
— Target / Trail Exit: a target was reached or a runner was trailed out
— Invalidated: a setup was invalidated
— Any Event: all of the above in a single condition
— An alert set to "Any alert() function call" sends a text message with the level, entry, invalidation and exit details

Alerts describe a change in the script's state. They are not trade instructions.

⚠️ IMPORTANT NOTES & LIMITATIONS

— ✅ Every state change is confirmed on bar close and nothing repaints. Levels and the trend are built from the chart's own bars, with no request to another timeframe.
— 🏃 With the Runner model most setups end at the invalidation, and the history depends on a small number of long runs. Long sequences of invalidated setups are normal for this model. Target + Runner is the more balanced choice.
— 🌊 The trend filter and the trail need directional markets. Ranges produce more invalidated setups.
— 🪙 Defaults were chosen on gold (XAUUSD) at 15 minutes. Other symbols and timeframes behave differently and should be checked before relying on them.
— 📊 The history describes the bars loaded on the chart and depends on the plan, the symbol and the settings. Defaults were picked with past data in view, so past numbers flatter the model and do not describe the next period.
— 💱 Costs cover an estimate of spread and slippage. Overnight financing is not included, and runners can stay open for several days.
— ⏳ The trend EMA starts as a running average on the first bars and settles as more higher-timeframe candles become available.
— 🕯️ Use standard candles. On non-standard chart types the panel shows a warning, because prices there are synthetic.
— 📐 Entries and exits are checked with the high and low of each bar. The order of events inside a bar is unknown, so the less favorable order is assumed.
— 🗂️ Only the most recent setups within 4,500 bars are drawn. The history counts all of them.

🛡️ DISCLAIMER

This script is provided for educational and analytical purposes. It does not provide financial advice or guarantee any trading outcome.
The levels, zones, setups, results, panel values and alerts describe the script's internal rules only. They should be checked against your own analysis and risk tolerance before any decision is made.

면책사항

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