PROTECTED SOURCE SCRIPT
BIAS

Bias — MTF Market Structure
What it does
Bias determines bullish/bearish bias from a higher timeframe (HTF) market structure and shows BOS/CHOCH events in a minimal, uncluttered way. When a BOS/CHOCH is confirmed, the script draws a single horizontal line at the broken swing that extends to the right and stops automatically once price invalidates it. Background shading reflects the current bias.
Why it’s different (Minimal Clean)
No boxes or noisy fills — just clean horizontal continuation lines and small optional labels.
Pivot-based structure on your chosen HTF; lines update only when swings are confirmed.
Built-in anti-clutter controls (limit number of active lines).
Optional conservative confirmation (wait for HTF close).
How Bias is determined (BOS/CHOCH logic)
On the selected HTF, the script detects swing highs/lows using Pivot Left / Right.
New swings are filtered by Min Swing Distance (%) so tiny wiggles are ignored.
A breakUp occurs when price crosses the latest HTF swing high; a breakDown when it crosses the latest swing low (by Close or Wick, per your setting).
Event classification:
BOS (Break of Structure): break in the same direction as the current bias (trend continuation).
CHOCH (Change of Character): break in the opposite direction (trend change).
After a break, bias flips/updates (Bullish after breakUp, Bearish after breakDown). A thin horizontal line is drawn from that level, extending until price invalidates it in the opposite direction.
Inputs & Settings (what to tweak)
Basis Timeframe (HTF) – the timeframe used to build structure (e.g., 1H, 4H, 1D).
Pivot Left / Right – swing sensitivity (higher = cleaner, slower).
Confirm Break by Close – if ON, require close beyond the level; if OFF, wick is enough.
Wait for HTF Close – confirms only after the HTF candle closes (safer, later).
Min Swing Distance (%) – minimum percent distance vs. previous swing to accept a new swing.
Show Bias Background – soft background shading of current bias.
Show BOS/CHOCH Labels – small tags on the break candle (optional).
Max Active Level Lines – caps how many horizontal lines are kept on the chart (default 8).
Line Width – thickness of the horizontal lines.
Colors
Bull continuation lines/labels use a teal theme; Bear uses orange. You can adjust in code if desired.
How to use (quick start)
Add to any chart and keep your trading timeframe as you like (e.g., 5m, 15m, 1H).
Set HTF to the structure frame you trust (e.g., 1H for intraday, 4H/D for swing).
For a cleaner map, raise Pivot Left/Right (e.g., 4–6) and Min Swing Distance (e.g., 0.5–1%).
Choose break confirmation:
Want early signals? leave Confirm by Close ON and Wait for HTF Close OFF.
Want stronger signals? turn Wait for HTF Close ON.
Read the chart:
Background = current Bias (Bullish or Bearish).
Each BOS/CHOCH prints a short label and a horizontal line that extends to the right until price invalidates it.
Use the lines as clean reference for structure and for where bias last changed/continued.
Reduce clutter by lowering Max Active Level Lines (e.g., 5–8) or turning labels off.
Multi-HTF tip: Add two instances — e.g., HTF=4H for strategic bias and HTF=1H for tactical entries. Keep labels ON only on the tactical one for simplicity.
Alerts
The script provides ready-made alert conditions (constant strings per Pine v6 rules):
BOS Bullish
BOS Bearish
CHOCH Bullish
CHOCH Bearish
Bias Flip → Bullish
Bias Flip → Bearish
Create an alert on the indicator and choose the condition you want.
Notes & Limitations
Swings use pivots; a pivot only finalizes after pR bars, so signals don’t repaint forward once the HTF pivot is confirmed.
If Wait for HTF Close is OFF, intrabar spikes can trigger earlier (faster but less strict).
As with any tool, this is not financial advice and should be combined with your own risk management.
Recommended presets
Intraday: HTF = 1H, pL/pR = 4/4, Min Swing % = 0.6–1.0, Confirm by Close = ON, Wait HTF Close = OFF, Max Lines = 6–8.
Swing: HTF = 4H or 1D, pL/pR = 5–6, Min Swing % = 1.0–2.0, Confirm by Close = ON, Wait HTF Close = ON, Max Lines = 5.
What it does
Bias determines bullish/bearish bias from a higher timeframe (HTF) market structure and shows BOS/CHOCH events in a minimal, uncluttered way. When a BOS/CHOCH is confirmed, the script draws a single horizontal line at the broken swing that extends to the right and stops automatically once price invalidates it. Background shading reflects the current bias.
Why it’s different (Minimal Clean)
No boxes or noisy fills — just clean horizontal continuation lines and small optional labels.
Pivot-based structure on your chosen HTF; lines update only when swings are confirmed.
Built-in anti-clutter controls (limit number of active lines).
Optional conservative confirmation (wait for HTF close).
How Bias is determined (BOS/CHOCH logic)
On the selected HTF, the script detects swing highs/lows using Pivot Left / Right.
New swings are filtered by Min Swing Distance (%) so tiny wiggles are ignored.
A breakUp occurs when price crosses the latest HTF swing high; a breakDown when it crosses the latest swing low (by Close or Wick, per your setting).
Event classification:
BOS (Break of Structure): break in the same direction as the current bias (trend continuation).
CHOCH (Change of Character): break in the opposite direction (trend change).
After a break, bias flips/updates (Bullish after breakUp, Bearish after breakDown). A thin horizontal line is drawn from that level, extending until price invalidates it in the opposite direction.
Inputs & Settings (what to tweak)
Basis Timeframe (HTF) – the timeframe used to build structure (e.g., 1H, 4H, 1D).
Pivot Left / Right – swing sensitivity (higher = cleaner, slower).
Confirm Break by Close – if ON, require close beyond the level; if OFF, wick is enough.
Wait for HTF Close – confirms only after the HTF candle closes (safer, later).
Min Swing Distance (%) – minimum percent distance vs. previous swing to accept a new swing.
Show Bias Background – soft background shading of current bias.
Show BOS/CHOCH Labels – small tags on the break candle (optional).
Max Active Level Lines – caps how many horizontal lines are kept on the chart (default 8).
Line Width – thickness of the horizontal lines.
Colors
Bull continuation lines/labels use a teal theme; Bear uses orange. You can adjust in code if desired.
How to use (quick start)
Add to any chart and keep your trading timeframe as you like (e.g., 5m, 15m, 1H).
Set HTF to the structure frame you trust (e.g., 1H for intraday, 4H/D for swing).
For a cleaner map, raise Pivot Left/Right (e.g., 4–6) and Min Swing Distance (e.g., 0.5–1%).
Choose break confirmation:
Want early signals? leave Confirm by Close ON and Wait for HTF Close OFF.
Want stronger signals? turn Wait for HTF Close ON.
Read the chart:
Background = current Bias (Bullish or Bearish).
Each BOS/CHOCH prints a short label and a horizontal line that extends to the right until price invalidates it.
Use the lines as clean reference for structure and for where bias last changed/continued.
Reduce clutter by lowering Max Active Level Lines (e.g., 5–8) or turning labels off.
Multi-HTF tip: Add two instances — e.g., HTF=4H for strategic bias and HTF=1H for tactical entries. Keep labels ON only on the tactical one for simplicity.
Alerts
The script provides ready-made alert conditions (constant strings per Pine v6 rules):
BOS Bullish
BOS Bearish
CHOCH Bullish
CHOCH Bearish
Bias Flip → Bullish
Bias Flip → Bearish
Create an alert on the indicator and choose the condition you want.
Notes & Limitations
Swings use pivots; a pivot only finalizes after pR bars, so signals don’t repaint forward once the HTF pivot is confirmed.
If Wait for HTF Close is OFF, intrabar spikes can trigger earlier (faster but less strict).
As with any tool, this is not financial advice and should be combined with your own risk management.
Recommended presets
Intraday: HTF = 1H, pL/pR = 4/4, Min Swing % = 0.6–1.0, Confirm by Close = ON, Wait HTF Close = OFF, Max Lines = 6–8.
Swing: HTF = 4H or 1D, pL/pR = 5–6, Min Swing % = 1.0–2.0, Confirm by Close = ON, Wait HTF Close = ON, Max Lines = 5.
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarlo liberamente e senza alcuna limitazione – per saperne di più clicca qui.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarlo liberamente e senza alcuna limitazione – per saperne di più clicca qui.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.