PROTECTED SOURCE SCRIPT

Fractal Time Grid

50
Overview
The Fractal Time Grid is a Pine-Script v5 TradingView indicator designed to automate session-based entries, stops, and targets. It overlays on your chart, shading trading “quarters” of any chosen timezone, highlighting bullish or bearish bias zones, and marking up to N entries per quarter with on-chart signals. Optional SL/TP rays and built-in alerts make it a one-stop tool for disciplined session trading.

1. User Inputs
All inputs appear in the indicator’s Settings panel:


Category Input Description
Trend & History Trend Source („Auto“, Bull, Bear) Auto-detects daily bias or forces Bull/Bear
History (days) (≥1) How far back (in days) to keep session shading active
Session Limits Max Entries per 6H Quarter (1–10) Caps how many signals you’ll get in each 6-hour window
Risk Management & Visuals Show Entry/SL/TP Rays (On/Off) Toggles horizontal lines and price labels
SL Method („Bar High/Low“ or „1.5× Candle“) How the stop-loss distance is calculated
Risk:Reward Ratio (e.g. 4.0) Multiplier applied to SL distance to plot TP
Ray Length (bars) (≥1) How far right SL/TP rays extend
Session Timing Timezone Offset (hours, –12 to +14) Shifts session shading to your local clock
Colors Bullish/Bearish Session BG opacity Semi-transparent fill for bias zones
Entry candle colors (Bull/Bear) Highlights actual entry bars
2. Bias Determination
Daily Close vs. Open

Fetches prior-day open/close via request.security(..., "D", …)

If close > open → bullish bias; close < open → bearish

Manual Override

“Bullish” or “Bearish” mode forces one direction

“Auto” follows daily bias

3. Time-Grid Logic
Timezone Handling

Converts UTC bar timestamps by your tzOffset input

Quarter Windows (6H each)

Q1: 23:00–05:00 local

Q2: 05:00–11:00

Q3: 11:00–17:00

Q4: 17:00–23:00

Session Shading

During Q1–Q3 (configurable days back), background colored to match bias

4. Entry Logic
Conditions:

Within an active quarter, bias must match candle direction (bullish candle in bullish quarter, etc.)

Entry count for the quarter must be below your maximum

Counters:

Automatically resets on quarter switch

Tracks how many entries you’ve taken, preventing over-trading

5. Visual Signals
Bar Coloring: Flags entry bars green/red

Shape Markers:

BUY label below bar for long entries

SELL label above bar for shorts

6. Optional SL/TP Rays
When “Show Entry/SL/TP Rays” is enabled:

Computes SL distance either from bar high/low or a multiple of candle size

TP = SL × R:R ratio

Draws three horizontal rays (entry, SL, TP) with end-of-ray price labels

7. Alerts
Pre-built alertcondition calls let you create TradingView alerts instantly:

Names: “BUY Alert” and “SELL Alert”

Messages:

arduino
Copy
Edit
BUY {{ticker}} at {{close}} – Q{{quarter}} – {{entryCount}}/{{maxEntriesQuarter}} entries
(same format for SELL)

8. Why Publish This?
Discipline Built-In: Caps over-trading per session

Timezone-Agnostic: Works equally for NY, London, Tokyo sessions

All-in-One: Bias, timing, entries, risk and alerts in one script

Fully Customizable: Colors, risk settings, time windows, and more

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.