Risk & Position Sizing CalculatorLEGAL DISCLAIMER — READ FIRST
**This script and this description are for EDUCATIONAL PURPOSES ONLY.**
- This is **not** investment advice, a trading recommendation, or a solicitation to buy or sell any stock, index, or F&O (Futures & Options) contract.
- Nothing in this script or description constitutes a recommendation to trade Nifty, Bank Nifty, or any stock, in cash, futures, or options.
- The script does **not** predict market direction and does **not** guarantee profit. Past performance of any rule-set (including the EMA-crossover logic used here) does not guarantee future results.
- Trading in equities, futures, and options carries a **high risk of loss**, including the possible loss of your entire invested capital, and is not suitable for everyone.
- All entries, exits, position sizes, and trading decisions remain **solely your own responsibility**.
- Please independently verify all information and **consult a SEBI-registered Investment Adviser** before making any trading or investment decision.
- The creator of this script accepts **no liability** for any financial loss arising from its use.
By using this script, you acknowledge that you understand and accept the above.
---
1. What This Script Is
A **risk and position-sizing calculator** for TradingView, with an **optional mechanical signal add-on**. It does two separate jobs:
1. **Risk Calculator (always on):** tells you how many lots you could safely trade on any chart (Nifty, Bank Nifty, or a stock), given your capital and risk tolerance — the math, not a prediction.
2. **Signal Add-on (optional, toggle on/off):** plots a Buy marker based on one fixed technical rule (EMA crossover, optionally RSI-filtered), then tracks that trade and marks profit-booking levels (T1/T2/T3) and stop-loss on the chart, with alerts.
3 hours ago
Release Notes
ns on top of any chart (Nifty, Bank Nifty, or a stock) and answers: "If I enter here, how many lots can I safely trade given my capital and risk tolerance?"
1. Inputs (4 setting groups)
Capital & Risk — your capital, risk % per trade, and Caution/High-Risk thresholds that color-code the dashboard.
Stop-Loss Method — ATR-based (volatility-derived) or Swing High/Low (distance to recent swing point).
Contract Details — lot size (65 for Nifty by default, editable) and direction (Long/Short).
Targets — T1/T2/T3 as multiples of your risk (1R, 2R, 3R), mirroring the T1/T2/T3 in your original screenshot.
2. Calculations
Uses current close as "entry."
Computes stop-loss distance via ta.atr() × multiplier, or highest/lowest price over your lookback.
Derives stop-loss price and the three target prices as R-multiples from entry.
Computes risk amount (capital × risk%), risk per lot (SL distance × lot size), and max safe lots (risk amount ÷ risk per lot) — the same math behind "Safe Lots" in your dashboard tool.
Flags a zone: SAFE / CAUTION / HIGH RISK based on your risk % vs. the thresholds.
3. Visuals
Dashed/dotted lines on the chart for entry, stop-loss, and the three targets.
A dashboard table (top-right corner) showing all the numbers, updated on the latest bar.
What it doesn't do: pull option-chain data (strike, premium, decay) — not accessible Penunjuk

Penunjuk

Penunjuk

Penunjuk

Trading ATR Framework **Trading ATR Framework** is a clean, rule-based volatility tool designed for futures traders.
The indicator automatically calculates the previous daily close and the completed Daily ATR(14), then projects the key volatility levels at ±25%, ±50%, ±75%, and ±100% ATR.
It includes:
* Automatic daily ATR levels
* Previous daily close as the basis price
* Tick-size rounding
* Current ATR position and directional bias
* Optional manual settlement and ATR inputs
* Built-in 2.5R risk-to-reward calculator
* Alerts for important ATR level crossings
* Premium black-and-gold visual design
The framework is designed for NQ/MNQ, GC/MGC, and CL/MCL, but can also be used on other markets and timeframes.
ATR levels are context and decision zones, not standalone trade signals. Always combine them with market structure, volume, order flow, and proper risk management.
Penunjuk

Kalman Trailing Stop (KTS)█ OVERVIEW
The Kalman Trailing Stop (KTS) is an advanced, math-driven trend-following system designed to keep you in winning trades longer while dynamically filtering out market noise.
Instead of relying on static moving averages or basic ATR multipliers, KTS utilizes a 2D Kalman Filter combined with Statistical Digital Signal Processing (DSP) and Williams Market Structure. It adapts to volatility and volume in real-time, effectively distinguishing between genuine trend shifts and temporary liquidity sweeps.
█ CORE MECHANICS
1. 2D Kalman Adaptive Trailing Stop
At the heart of the indicator is a robust 2D Kalman filter that tracks both price level and velocity.
Volume-Weighted Variance: The trailing stop becomes highly responsive during high-volume pushes (high trust) and flattens out during low-volume consolidation (low trust), preventing premature stop-outs.
Sigmoid Smoothing & Structural Anchoring: Instead of jagged, abrupt jumps, the stop uses sigmoid transitions to smoothly glide to new structural floors/ceilings derived from recent Intermediate-Term Highs and Lows (ITH/ITL).
Slope Confirmation: The trailing stop will only flip its directional bias if the underlying Kalman baseline slope confirms the reversal, neutralizing fake-outs.
2. Statistical Plunger Logic (Liquidity Sweeps)
Markets frequently sweep liquidity beyond technical levels before reversing. The "Plunger" logic mathematically identifies these traps.
Dynamic Sweep Multiplier: By tracking the kurtosis (fat-tail distribution) of price returns, the script dynamically expands its sweep threshold during periods of wild volatility.
Wick Filtering: It detects deep wicks that pierce the Kalman bands and close strongly back within the bar's range, highlighting statistically validated exhaustion points.
3. Algorithmic Pyramiding & Volatility Warnings
Scale-In Detection: KTS monitors volume footprints to identify safe zones to add to your position. It looks for a sequence of volume "dry-up" during a pullback, followed by a volume-backed breakout past recent market structure.
Livermore Ejector Concept: The indicator flags abnormal, massive range expansions that occur against the prevailing trend, acting as an early warning system for sudden momentum shifts.
4. Built-in Risk & Performance Engine
Dynamic Position Sizing: Automatically calculates raw position and pyramid sizes based on your account equity, risk percentage, and maximum leverage.
Live Performance Dashboard: A built-in HUD tracks both the Global and Recent Profit Factor (PF) of the main trend signals, alongside the real-time distance to your trailing stop.
█ VISUAL GUIDE
Colored Gradient Band: The main Kalman Trailing Stop. Green indicates an active long trend; Red indicates an active short trend.
Large Diamonds (♦️): Main Trend Entries. Triggered when price breaks the Kalman Stop with slope confirmation.
Small Triangles (🔼/🔽): Bullish and Bearish Plunger signals. These indicate deep liquidity sweeps and wick rejections at statistical extremes.
Small Crosses (➕): Algorithmic Pyramid signals. Opportunities to scale into the current trend based on volume dry-ups and structural breakouts.
Yellow X-Crosses (❌): Abnormal Reaction Warnings. Signals a massive volatility spike moving against your active position.
█ SETTINGS
Kalman Trailing Stop Settings
Kalman Responsiveness: Adjusts how quickly the system reacts to price changes (1-100).
Trailing Stop Distance (SD): Sets the baseline width of the trailing stop from the Kalman-smoothed price, measured in standard deviations of the True Range. A higher value (e.g., 3.0) gives the trade more breathing room, while a lower value tightens the stop.
Disclaimer
This script is designed for educational and informational purposes only. Trading involves significant risk. The built-in performance table is an un-optimized raw calculation and should not be used as a guarantee of future system profitability. Penunjuk

Daily ATR Big Move DetectorDaily ATR Big Move DetectorThis indicator identifies significant intraday price moves relative to the Daily ATR (14).It automatically detects both bullish surges and bearish drops on your current chart timeframe (ideal for 5m, 15m, 30m charts) when a candle’s range exceeds 20% of the Daily ATR.Key Features:Highlights candles that represent 20%+ of the Daily ATR
Labels each qualifying candle with the exact percentage (e.g. “22.45% of Daily ATR”)
“Manipulation Candle” label automatically appears on moves ≥ 25% of Daily ATR
Color-coded:Green tones for bullish moves
Red/purple tones for bearish moves
Shows current Daily ATR value and candle percentage in a clean table
Works on any symbol (stocks, ETFs, futures, crypto, etc.)
Perfect for spotting potential manipulation moves, exhaustion candles, or high-conviction intraday momentum.Recommended Timeframes: 5min, 15min, or 30min charts (using Daily ATR as reference).
Penunjuk

Price Action Concepts [b1k]Price Action Concepts
everything i actually watch on an intraday chart, in one indicator. built off my Essential Time Ranges and folded in the tools i kept loading separately.
what's inside:
Time ranges — hourly high/low + midpoint, opening range (30s up to 30m, pulled from lower-timeframe data so it's accurate on any chart and extends across RTH), initial balance (9:30-10:30), and the RTH box.
Range metrics — ADR(10), AWR(8), today's day range and this week's range, plus % of each used so you know how much is left in the tank. ADR/AWR projected off the open (open +/- range/2), same read as Quant Matrix.
Value areas — VAH / VAL / POC for the session you choose (RTH or ETH), both TPO and volume profile, plus the last 3 sessions. volume draws as a zone, TPO as lines. also marks TPO single prints and volume imbalances (low-volume nodes) for the fast-move levels.
1kpier levels — overnight high/low, previous day and week high/low, wickless 15m candles, and a reference grid.
HoD/LoD timing — where the high and low of the range printed and how long it took to get there.
Session distributions — the Quant Matrix boxes (each session sized to its own average range, centered on the open) and the distribution table, total or by day of week, points or percent.
built around ES/NQ but the ratios carry across instruments. every element has its own color, line type and width, so you can set it up to read the way you want and turn off what you don't use.
- b1kPier
Penunjuk

Penunjuk

Penunjuk

Penunjuk

Adaptive S/R Box Zones with Dynamic Stop Loss & EMA FilterTitle: Adaptive S/R Box Zones with Dynamic Stop Loss & EMA Filter
Description:
This indicator is an advanced tool designed to automatically identify key Support and Resistance (S/R) levels by blending momentum, volatility, and structural pivot points. The core objective of the script is to visualize asymmetric risk zones (Stop Loss zones) and filter out false breakouts using an integrated EMA momentum filter.
How it works:
S/R Detection Logic: Levels are not derived from simple highs and lows. The script utilizes a sophisticated algorithm that dynamically combines the RSI (Relative Strength Index) to spot extreme overbought/oversold conditions, a HMA-based CMO (Chande Momentum Oscillator) for momentum confirmation, and historical Close Pivots.
Asymmetric SL Zones (Boxes): Instead of standard symmetric lines that often distort spatial risk, the indicator renders dynamic box shapes. The height of these zones automatically adapts to the market's current volatility using the ATR (Average True Range).
The Resistance Zone expands asymmetrically upward from the level, offering a clear visual map for placing Stop Losses on Short setups.
The Support Zone expands asymmetrically downward from the level, defining the logical Stop Loss area for Long setups.
EMA Momentum Filter & Trigger: The script features an optional EMA crossover filter. When enabled, the detection of a new S/R zone acts as a dynamic "setup alert", while the actual BUY or SELL signal triggers only when the price breaks through the EMA line, confirming directional momentum.
Key Features & Inputs:
Zone Height (ATR Multiplier): Controls the thickness of the risk zones based on market volatility.
S/R Timeframe: Multi-timeframe (MTF) functionality to plot higher time frame levels onto your current chart.
Signal Trigger Mode: Toggle between On Candle Close and After Candle Close (waits for the candle to seal to prevent repainting).
EMA Filter Toggle: Can be fully deactivated if you prefer to receive raw signals immediately upon the formation of S/R levels. Penunjuk

Sheabot Relative Volume and RangeDisplay a combined table showing relative volume and relative range (also known as Daily True Range vs Average True Range) on all timeframes. The table rows change colors based on the relative volume and relative range values. The values and colors can be configured.
These indicators are combined together for a more efficient display in the same location. These indicators also commonly move together. A low relative volume will also likely have a low relative range. A high relative volume may accompany the price breaking out past the average range and a relative range over 100%. The relative range can also help set price targets. If the relative range is less than 100%, then the stock has not yet moved to its average range.
These concepts are used and inspired by the great @ripster47 .
Relative Volume
Table displays current volume, average volume, and relative volume as a percent of current volume / average volume over the timeframe.
When the timeframe is 1D or less, then the current volume is the volume for the day so far, and the average volume is calculated over the past bar length days.
When the timeframe is greater than 1D, then the current volume is the volume for the week/month/year so far, and the average volume is calculated over the past bar length weeks/months/years.
High Percent: Default is 100. Relative volume below this is considered low and the table row is colored grey. Relative volume above this is considered high and the table row is colored yellow.
Unusual Percent. Default is 200. Relative volume above this is considered unusual and the table row is colored green.
Relative Range
Table displays daily true range (DTR), average true range (ATR), and relative range as a percent of DTR / ATR over the timeframe.
When the timeframe is 1D or less, then the daily true range is the difference between the high and low price since open, and the average true range is calculated over the past bar length days.
When the timeframe is greater than 1D, then the daily true range is the difference between the high and low price for the past week/month/year, and the average true range is calculated over the past bar length weeks/months/years.
Normal Percent: Default is 50. Relative range below this is considered low and the table row is colored grey. Relative range above this is considered normal and the table row is colored yellow.
High Percent. Default is 90. Relative range above this is considered high and the table row is colored red.
Penunjuk

Volatility Halo | NAL1. Overview
Volatility Halo | NAL is an adaptive volatility band indicator built from a Zero-Lag EMA baseline, ATR band structure, and a recursive GARCH-style volatility regime multiplier.
The indicator does not use fixed-width bands. Instead, it starts with ATR-based bands and then adjusts their width using a projected volatility regime model. This allows the bands to respond differently when market volatility is expanding, contracting, or stabilizing.
2. Calculation
The indicator starts by calculating a Zero-Lag EMA baseline from the selected source. This baseline acts as the central trend reference, helping reduce lag compared to a standard EMA while still keeping the structure smooth.
float baseline = f_zlema(src, baseline_len)
float ATR_Value = ta.atr(ATR_Len)
The ATR value is then multiplied by the user-defined ATR multiple. This forms the base volatility distance used for the upper and lower bands.
The more advanced part of the indicator is the recursive GARCH-style regime multiplier. It begins by calculating log returns and converting them into shock variance. A long-run variance estimate is then built from recent shock variance.
GARCH_LogReturn = close > 0.0 and close > 0.0 ? math.log(close / close ) : 0.0
GARCH_ShockVariance = math.pow(GARCH_LogReturn, 2.0)
GARCH_LongRunVariance = ta.ema(GARCH_ShockVariance, GARCH_LongRunLen)
The model recursively updates conditional variance using three components: recent shock variance, long-run variance, and previous conditional variance. When adaptive coefficients are enabled, the script searches for coefficient weights that better fit recent variance behavior.
GARCH_ConditionalVariance :=
GARCH_Gamma * GARCH_LongRunVariance +
GARCH_Alpha * GARCH_ShockVariance +
GARCH_Beta * GARCH_PreviousConditionalVariance
The conditional variance is then projected and converted into a volatility estimate. This volatility is compared against its own regime baseline to create a volatility regime multiplier. The multiplier is clamped between a minimum and maximum value, preventing the bands from becoming too narrow or too wide.
GARCH_Volatility = math.sqrt(math.max(GARCH_ProjectedVariance, 0.0))
GARCH_RegimeMultiplierRaw = GARCH_Volatility / GARCH_RegimeBase
GARCH_RegimeMultiplier = f_clamp(GARCH_RegimeMultiplierSmooth, GARCH_MinMult, GARCH_MaxMult)
The final band width is created by combining ATR with the GARCH regime multiplier. The upper and lower bands are placed around the Zero-Lag EMA baseline.
hybridBandWidth = ATR_Value * ATR_Mult * GARCH_RegimeMultiplier
upperBand = baseline + hybridBandWidth
lowerBand = baseline - hybridBandWidth
A bullish state triggers when price closes above the upper band. A bearish state triggers when price closes below the lower band. When price remains inside the bands, the previous state is held.
3. Key Features
Zero-Lag EMA baseline for reduced-lag trend structure.
ATR-based volatility bands.
Recursive GARCH-style conditional variance model.
Adaptive volatility regime multiplier.
Bands expand or contract based on projected volatility conditions.
State-based candle coloring, band coloring, glow effect, and regime fills.
4. Use
Volatility Halo is designed to identify moments where price begins escaping its volatility-adjusted structure. A close above the upper band reflects bullish expansion, while a close below the lower band reflects bearish expansion.
The adaptive volatility engine allows the bands to shift with the underlying market environment, making the signal more responsive to changes in pressure and regime.
This indicator is best used as a specialized module within a complete strategy framework. Its real strength appears when it is combined with a broader process for reading market behavior, timing, and risk. The full edge comes from how the signal is integrated, not from the signal existing in isolation.
Penunjuk

Penunjuk

Penunjuk

Penunjuk

Penunjuk

Penunjuk

Penunjuk

Penunjuk

McGinley T3 Flow Campaign [NICK789] v.1McGinley T3 Flow Campaign is a trend-following strategy built around an adaptive signal trail and a campaign-style trade management model.
The script is designed to identify confirmed trend-flow transitions, open a long or short campaign, and then display entry, target, and optional stop levels directly on the chart. It is not intended to predict tops or bottoms. Instead, it waits for the selected flow engine to shift direction and then manages the trade as a structured campaign.
━━━━━━━━━━━━━━━━━━━━━━
CORE IDEA
━━━━━━━━━━━━━━━━━━━━━━
The main concept is to combine an adaptive moving-average engine with an ATR-based trailing structure.
The signal engine can use:
• McGinley Dynamic only
• T3 smoothing only
• A blend of McGinley Dynamic and T3
The McGinley Dynamic is used because it adapts to changes in price speed more smoothly than a standard moving average. T3 smoothing is included as an optional alternative for traders who prefer a smoother trend basis. The blended mode averages both curves to create a balanced engine between responsiveness and smoothness.
After the engine basis is calculated, the script builds an ATR signal trail around it. The trail updates using volatility distance and then locks in a directional path. A confirmed transition in this trail creates the long or short signal.
This means the signal is not based on a simple moving-average crossover. The strategy waits for the adaptive trail itself to shift direction.
━━━━━━━━━━━━━━━━━━━━━━
HOW SIGNALS ARE GENERATED
━━━━━━━━━━━━━━━━━━━━━━
A long signal occurs when the ATR signal trail confirms an upward transition.
A short signal occurs when the ATR signal trail confirms a downward transition.
Signals are confirmed on closed bars. This helps avoid reacting to unfinished candle movement.
The script separates main signals from continuation signals:
• Main BUY / SELL labels appear when a new direction starts
• Smaller continuation triangles appear when the same direction refreshes
This keeps the chart cleaner while still showing when the flow continues in the same direction.
━━━━━━━━━━━━━━━━━━━━━━
CAMPAIGN TARGET MODEL
━━━━━━━━━━━━━━━━━━━━━━
Instead of using only fixed ATR targets, this strategy uses a campaign target system.
There are two target modes:
1. Flow Trail Based
Targets are projected from the distance between price and the active ATR signal trail. This makes the target model expand and contract with the current trend structure.
2. ATR Baseline
Targets are projected from a standard ATR baseline for traders who prefer a more traditional volatility target model.
The Flow Trail Based mode is the default because it connects the target spacing directly to the same adaptive trail that produced the signal.
Target levels are displayed as:
• Entry
• TP1
• TP2
• TP3
• Optional SL
Each level includes its price on the chart.
━━━━━━━━━━━━━━━━━━━━━━
TAKE PROFIT EXIT MODES
━━━━━━━━━━━━━━━━━━━━━━
The strategy includes multiple take-profit behaviours:
• TP1 Only
• TP2 Only
• TP3 Only
• Scale Out TP1 / TP2 / TP3
In scale-out mode, the position is reduced across TP1, TP2, and TP3 using the percentage settings.
In single-target modes, the strategy exits the full position at the selected target.
This allows the same signal engine to be tested with different trade management styles.
━━━━━━━━━━━━━━━━━━━━━━
STOP MODE
━━━━━━━━━━━━━━━━━━━━━━
The stop system has three modes:
• Off
• Visual Only
• Visual + Strategy Exit
By default, Stop Mode is set to Visual Only.
This means the SL line is shown as a campaign reference, but it does not close the strategy trade unless the user changes Stop Mode to Visual + Strategy Exit.
This is intentional because some traders use the stop line as a visual invalidation reference while others want the strategy tester to execute the stop automatically.
━━━━━━━━━━━━━━━━━━━━━━
DASHBOARD
━━━━━━━━━━━━━━━━━━━━━━
The dashboard shows:
• Selected engine mode
• Selected target mode
• Current flow state
• Current strategy position
• Win rate
• PNL and drawdown
━━━━━━━━━━━━━━━━━━━━━━
HOW TO USE
━━━━━━━━━━━━━━━━━━━━━━
1. Choose the engine mode
McGinley Only is the default and gives a responsive adaptive trend read. T3 Only is smoother. Blend mode combines both.
2. Adjust ATR Trail Length and ATR Trail Multiplier
These settings control how sensitive the signal trail is. Lower values react faster but may create more signals. Higher values create smoother signals but can be slower.
3. Choose the Target Mode
Flow Trail Based uses the distance from price to the signal trail. ATR Baseline uses a standard ATR distance.
4. Choose the Take Profit Exit Mode
Use TP1, TP2, or TP3 only for full exits, or use Scale Out mode for partial profit-taking.
5. Choose the Stop Mode
Use Visual Only for chart reference. Use Visual + Strategy Exit if you want the strategy tester to close trades at the stop level.
6. Use the Backtest Start setting
The Backtest Start input lets users control the test period without changing the script.
━━━━━━━━━━━━━━━━━━━━━━
WHAT MAKES THIS SCRIPT DIFFERENT
━━━━━━━━━━━━━━━━━━━━━━
This script is not a simple collection of unrelated indicators.
The components are connected in a single workflow:
• The McGinley/T3 engine creates the adaptive trend basis
• The ATR signal trail converts that basis into a directional flow line
• Confirmed trail transitions create campaign entries
• The target system projects trade levels from the active flow structure
• The dashboard summarizes the active engine, target model, trade state, and performance
The main purpose of the script is to turn an adaptive trend transition into a structured trade campaign with visible entry, targets, stop reference, and performance context.
━━━━━━━━━━━━━━━━━━━━━━
IMPORTANT NOTES
━━━━━━━━━━━━━━━━━━━━━━
This is a strategy script for backtesting and study. It is not financial advice.
Past performance does not guarantee future results.
Results will vary by symbol, timeframe, spread, commission, session, and market condition.
The script works best when users test different settings for the market they trade instead of assuming one preset fits every asset.
Because this is a trend-following model, it can perform well during directional moves but may produce weaker results during sideways or choppy conditions.
Strategi

Penunjuk
