Correlation Heatmap█ OVERVIEW
This indicator creates a correlation matrix for a user-specified list of symbols based on their time-aligned weekly or monthly price returns. It calculates the Pearson correlation coefficient for each possible symbol pair, and it displays the results in a symmetric table with heatmap-colored cells. This format provides an intuitive view of the linear relationships between various symbols' price movements over a specific time range.
█ CONCEPTS
Correlation
Correlation typically refers to an observable statistical relationship between two datasets. In a financial time series context, it usually represents the extent to which sampled values from a pair of datasets, such as two series of price returns, vary jointly over time. More specifically, in this context, correlation describes the strength and direction of the relationship between the samples from both series.
If two separate time series tend to rise and fall together proportionally, they might be highly correlated. Likewise, if the series often vary in opposite directions, they might have a strong anticorrelation . If the two series do not exhibit a clear relationship, they might be uncorrelated .
Traders frequently analyze asset correlations to help optimize portfolios, assess market behaviors, identify potential risks, and support trading decisions. For instance, correlation often plays a key role in diversification . When two instruments exhibit a strong correlation in their returns, it might indicate that buying or selling both carries elevated unsystematic risk . Therefore, traders often aim to create balanced portfolios of relatively uncorrelated or anticorrelated assets to help promote investment diversity and potentially offset some of the risks.
When using correlation analysis to support investment decisions, it is crucial to understand the following caveats:
• Correlation does not imply causation . Two assets might vary jointly over an analyzed range, resulting in high correlation or anticorrelation in their returns, but that does not indicate that either instrument directly influences the other. Joint variability between assets might occur because of shared sensitivities to external factors, such as interest rates or global sentiment, or it might be entirely coincidental. In other words, correlation does not provide sufficient information to identify cause-and-effect relationships.
• Correlation does not predict the future relationship between two assets. It only reflects the estimated strength and direction of the relationship between the current analyzed samples. Financial time series are ever-changing. A strong trend between two assets can weaken or reverse in the future.
Correlation coefficient
A correlation coefficient is a numeric measure of correlation. Several coefficients exist, each quantifying different types of relationships between two datasets. The most common and widely known measure is the Pearson product-moment correlation coefficient , also known as the Pearson correlation coefficient or Pearson's r . Usually, when the term "correlation coefficient" is used without context, it refers to this correlation measure.
The Pearson correlation coefficient quantifies the strength and direction of the linear relationship between two variables. In other words, it indicates how consistently variables' values move together or in opposite directions in a proportional, linear manner. Its formula is as follows:
𝑟(𝑥, 𝑦) = cov(𝑥, 𝑦) / (𝜎𝑥 * 𝜎𝑦)
Where:
• 𝑥 is the first variable, and 𝑦 is the second variable.
• cov(𝑥, 𝑦) is the covariance between 𝑥 and 𝑦.
• 𝜎𝑥 is the standard deviation of 𝑥.
• 𝜎𝑦 is the standard deviation of 𝑦.
In essence, the correlation coefficient measures the covariance between two variables, normalized by the product of their standard deviations. The coefficient's value ranges from -1 to 1, allowing a more straightforward interpretation of the relationship between two datasets than what covariance alone provides:
• A value of 1 indicates a perfect positive correlation over the analyzed sample. As one variable's value changes, the other variable's value changes proportionally in the same direction .
• A value of -1 indicates a perfect negative correlation (anticorrelation). As one variable's value increases, the other variable's value decreases proportionally.
• A value of 0 indicates no linear relationship between the variables over the analyzed sample.
Aligning returns across instruments
In a financial time series, each data point (i.e., bar) in a sample represents information collected in periodic intervals. For instance, on a "1D" chart, bars form at specific times as successive days elapse.
However, the times of the data points for a symbol's standard dataset depend on its active sessions , and sessions vary across instrument types. For example, the daily session for NYSE stocks is 09:30 - 16:00 UTC-4/-5 on weekdays, Forex instruments have 24-hour sessions that span from 17:00 UTC-4/-5 on one weekday to 17:00 on the next, and new daily sessions for cryptocurrencies start at 00:00 UTC every day because crypto markets are consistently open.
Therefore, comparing the standard datasets for different asset types to identify correlations presents a challenge. If two symbols' datasets have bars that form at unaligned times, their correlation coefficient does not accurately describe their relationship. When calculating correlations between the returns for two assets, both datasets must maintain consistent time alignment in their values and cover identical ranges for meaningful results.
To address the issue of time alignment across instruments, this indicator requests confirmed weekly or monthly data from spread tickers constructed from the chart's ticker and another specified ticker. The datasets for spreads are derived from lower-timeframe data to ensure the values from all symbols come from aligned points in time, allowing a fair comparison between different instrument types. Additionally, each spread ticker ID includes necessary modifiers, such as extended hours and adjustments.
In this indicator, we use the following process to retrieve time-aligned returns for correlation calculations:
1. Request the current and previous prices from a spread representing the sum of the chart symbol and another symbol ( "chartSymbol + anotherSymbol" ).
2. Request the prices from another spread representing the difference between the two symbols ( "chartSymbol - anotherSymbol" ).
3. Calculate half of the difference between the values from both spreads ( 0.5 * (requestedSum - requestedDifference) ). The results represent the symbol's prices at times aligned with the sample points on the current chart.
4. Calculate the arithmetic return of the retrieved prices: (currentPrice - previousPrice) / previousPrice
5. Repeat steps 1-4 for each symbol requiring analysis.
It's crucial to note that because this process retrieves prices for a symbol at times consistent with periodic points on the current chart, the values can represent prices from before or after the closing time of the symbol's usual session.
Additionally, note that the maximum number of weeks or months in the correlation calculations depends on the chart's range and the largest time range common to all the requested symbols. To maximize the amount of data available for the calculations, we recommend setting the chart to use a daily or higher timeframe and specifying a chart symbol that covers a sufficient time range for your needs.
█ FEATURES
This indicator analyzes the correlations between several pairs of user-specified symbols to provide a structured, intuitive view of the relationships in their returns. Below are the indicator's key features:
Requesting a list of securities
The "Symbol list" text box in the indicator's "Settings/Inputs" tab accepts a comma-separated list of symbols or ticker identifiers with optional spaces (e.g., "XOM, MSFT, BITSTAMP:BTCUSD"). The indicator dynamically requests returns for each symbol in the list, then calculates the correlation between each pair of return series for its heatmap display.
Each item in the list must represent a valid symbol or ticker ID. If the list includes an invalid symbol, the script raises a runtime error.
To specify a broker/exchange for a symbol, include its name as a prefix with a colon in the "EXCHANGE:SYMBOL" format. If a symbol in the list does not specify an exchange prefix, the indicator selects the most commonly used exchange when requesting the data.
Note that the number of symbols allowed in the list depends on the user's plan. Users with non-professional plans can compare up to 20 symbols with this indicator, and users with professional plans can compare up to 32 symbols.
Timeframe and data length selection
The "Returns timeframe" input specifies whether the indicator uses weekly or monthly returns in its calculations. By default, its value is "1M", meaning the indicator analyzes monthly returns. Note that this script requires a chart timeframe lower than or equal to "1M". If the chart uses a higher timeframe, it causes a runtime error.
To customize the length of the data used in the correlation calculations, use the "Max periods" input. When enabled, the indicator limits the calculation window to the number of periods specified in the input field. Otherwise, it uses the chart's time range as the limit. The top-left corner of the table shows the number of confirmed weeks or months used in the calculations.
It's important to note that the number of confirmed periods in the correlation calculations is limited to the largest time range common to all the requested datasets, because a meaningful correlation matrix requires analyzing each symbol's returns under the same market conditions. Therefore, the correlation matrix can show different results for the same symbol pair if another listed symbol restricts the aligned data to a shorter time range.
Heatmap display
This indicator displays the correlations for each symbol pair in a heatmap-styled table representing a symmetric correlation matrix. Each row and column corresponds to a specific symbol, and the cells at their intersections correspond to symbol pairs . For example, the cell at the "AAPL" row and "MSFT" column shows the weekly or monthly correlation between those two symbols' returns. Likewise, the cell at the "MSFT" row and "AAPL" column shows the same value.
Note that the main diagonal cells in the display, where the row and column refer to the same symbol, all show a value of 1 because any series of non-na data is always perfectly correlated with itself.
The background of each correlation cell uses a gradient color based on the correlation value. By default, the gradient uses blue hues for positive correlation, orange hues for negative correlation, and white for no correlation. The intensity of each blue or orange hue corresponds to the strength of the measured correlation or anticorrelation. Users can customize the gradient's base colors using the inputs in the "Color gradient" section of the "Settings/Inputs" tab.
█ FOR Pine Script® CODERS
• This script uses the `getArrayFromString()` function from our ValueAtTime library to process the input list of symbols. The function splits the "string" value by its commas, then constructs an array of non-empty strings without leading or trailing whitespaces. Additionally, it uses the str.upper() function to convert each symbol's characters to uppercase.
• The script's `getAlignedReturns()` function requests time-aligned prices with two request.security() calls that use spread tickers based on the chart's symbol and another symbol. Then, it calculates the arithmetic return using the `changePercent()` function from the ta library. The `collectReturns()` function uses `getAlignedReturns()` within a loop and stores the data from each call within a matrix . The script calls the `arrayCorrelation()` function on pairs of rows from the returned matrix to calculate the correlation values.
• For consistency, the `getAlignedReturns()` function includes extended hours and dividend adjustment modifiers in its data requests. Additionally, it includes other settings inherited from the chart's context, such as "settlement-as-close" preferences.
• A Pine script can execute up to 40 or 64 unique `request.*()` function calls, depending on the user's plan. The maximum number of symbols this script compares is half the plan's limit, because `getAlignedReturns()` uses two request.security() calls.
• This script can use the request.security() function within a loop because all scripts in Pine v6 enable dynamic requests by default. Refer to the Dynamic requests section of the Other timeframes and data page to learn more about this feature, and see our v6 migration guide to learn what's new in Pine v6.
• The script's table uses two distinct color.from_gradient() calls in a switch structure to determine the cell colors for positive and negative correlation values. One call calculates the color for values from -1 to 0 based on the first and second input colors, and the other calculates the colors for values from 0 to 1 based on the second and third input colors.
Look first. Then leap.
Quản lý danh mục đầu tư
CME Price Limits (Futures Prop Firm Rule)This indicator shows the CME Price Limit, combined with a safety distance that is used by several futures prop firms. Trading in the highlighted area means a rule violation for many Futures prop firm accounts.
The levels are calculated from the "Settlement as close" closing price of the previous daily candle.
TP/SL Percentage & RR Visual Tool📊 TP/SL Percentage & RR Visual Tool
This advanced trading indicator is designed to enhance your decision-making process by visually displaying dynamic risk-to-reward (RR) levels, trend conditions, and market signals directly on your chart. Whether you're scalping or swing trading, this tool gives you real-time insight into trade opportunities with built-in logic from the UT Bot.
🧠 Key Features:
TP/SL Levels: Automatically plots up to 3 customizable take-profit and stop-loss levels based on percentage.
Risk-to-Reward Visualization: Clearly displayed entry, TP, and SL zones to help manage risk and improve trade planning.
UT Bot Alerts Logic: Smart entry and exit signals using UT Bot crossover logic with optional Heikin Ashi candle filtering.
Trend Strength Meter: Detects market structure and trend direction using multi-timeframe EMAs (20 vs 50 EMA).
Volatility Indicator: Shows high or low volatility zones using ATR with a 100-period average benchmark.
Session Dashboard: Includes real-time trend analysis across 5m, 15m, 1h, 4h, and 1D timeframes.
Price Action Signals: Detects bullish and bearish engulfing patterns.
Customizable EMA Overlay: Plot EMA 20, 50, 100, and 200 directly on the chart.
Dynamic Table Display: Summarizes all key data points in a fixed-position, Excel-style table for quick reference.
🔧 Fully Customizable:
TP/SL percentages and line styles
EMA lengths and colors
Table placement
Heikin Ashi logic toggle
Volatility and trend sensitivity
Live Risk/Reward Lines (Dynamic Update: Tick or Bar Close)This script displays dynamic Risk and Reward target lines directly on the chart.
You can choose whether the updates happen live with each price tick or only once a bar closes.
It supports both long and short trading directions, with customizable risk and reward percentages.
Key Features:
Dynamic live updates (per tick or per bar close).
Choose Long or Short trade direction.
Customize risk and reward percentages individually.
Adjustable line length and color.
Option to show or hide risk and reward lines.
How It Works:
For long trades: Risk = Close Price * (1 - Risk %), Reward = Close Price * (1 + Reward %).
For short trades: Risk = Close Price * (1 + Risk %), Reward = Close Price * (1 - Reward %).
Lines are automatically centered around the current bar.
Why It Is Unique:
Unlike static risk/reward indicators, this script allows traders to see real-time dynamic changes based on the latest tick or bar close.
It offers full flexibility for scalpers and swing traders by allowing manual control over update timing and visualization style.
Usage Instructions:
Select your trade direction (Long or Short) from the settings.
Set your preferred risk and reward percentages.
Choose whether lines should update with every tick or only on bar close.
Optionally adjust the length and colors of the lines.
Important:
The script focuses on visualizing risk and reward directly on the price chart without giving buy or sell signals.
Disclaimer:
This tool is intended for educational and informational purposes only and should not be considered financial advice.
🧮Calculadora de Entrada/ApalancamientoThis tool automatically calculates the required position size and leverage for a trade based on the user's defined risk amount, stop loss percentage, and capital allocated for the operation.
📊 It displays the following data in a clean table at the bottom-right corner of the chart:
🟨 Required position size
⚡ Leverage needed
💰 Capital used in the trade
🟥 Risk amount per trade
Perfect for traders who manage their capital and risk with precision.
Values update automatically every few candles.
💡 Recommended for traders using fixed risk management strategies (% of capital) and who want a quick visual reference for executing safe and efficient trades.
Minimalist Trading Plan ChecklistMinimalist Trading Plan Checklist
A clean, customizable indicator to monitor your trading plan.
Features:
Checklist: Monitor bias, narrative, context, entry.
Timeframes: Set or leave blank (❌).
Risk-Reward Ratio: Display in a neat box.
News Checkbox: Toggle for high-impact events.
Customizable: Adjust colors and layout.
Stay organized and focused on your strategy with this minimalist tool.
Short and sweet! Let me know if you need further tweaks. 😊
Circuit Breaker - MFFUThis Indicator Is Used To Protect User From Over Trading After Market Hit The Circuit Breakers.
The CME Exchange Usually Halts Trading If Market Hit + or - 7%.
To Protect Users From Extreme Volatile Condition MFFU, Halts Trading If Market Hits + or - 5%.
This Indicator helps us to plot the circuit breaking lines helping us to when to stop trading.
Z-Score Normalized Volatility IndicesVolatility is one of the most important measures in financial markets, reflecting the extent of variation in asset prices over time. It is commonly viewed as a risk indicator, with higher volatility signifying greater uncertainty and potential for price swings, which can affect investment decisions. Understanding volatility and its dynamics is crucial for risk management and forecasting in both traditional and alternative asset classes.
Z-Score Normalization in Volatility Analysis
The Z-score is a statistical tool that quantifies how many standard deviations a given data point is from the mean of the dataset. It is calculated as:
Z = \frac{X - \mu}{\sigma}
Where X is the value of the data point, \mu is the mean of the dataset, and \sigma is the standard deviation of the dataset. In the context of volatility indices, the Z-score allows for the normalization of these values, enabling their comparison regardless of the original scale. This is particularly useful when analyzing volatility across multiple assets or asset classes.
This script utilizes the Z-score to normalize various volatility indices:
1. VIX (CBOE Volatility Index): A widely used indicator that measures the implied volatility of S&P 500 options. It is considered a barometer of market fear and uncertainty (Whaley, 2000).
2. VIX3M: Represents the 3-month implied volatility of the S&P 500 options, providing insight into medium-term volatility expectations.
3. VIX9D: The implied volatility for a 9-day S&P 500 options contract, which reflects short-term volatility expectations.
4. VVIX: The volatility of the VIX itself, which measures the uncertainty in the expectations of future volatility.
5. VXN: The Nasdaq-100 volatility index, representing implied volatility in the Nasdaq-100 options.
6. RVX: The Russell 2000 volatility index, tracking the implied volatility of options on the Russell 2000 Index.
7. VXD: Volatility for the Dow Jones Industrial Average.
8. MOVE: The implied volatility index for U.S. Treasury bonds, offering insight into expectations for interest rate volatility.
9. BVIX: Volatility of Bitcoin options, a useful indicator for understanding the risk in the cryptocurrency market.
10. GVZ: Volatility index for gold futures, reflecting the risk perception of gold prices.
11. OVX: Measures implied volatility for crude oil futures.
Volatility Clustering and Z-Score
The concept of volatility clustering—where high volatility tends to be followed by more high volatility—is well documented in financial literature. This phenomenon is fundamental in volatility modeling and highlights the persistence of periods of heightened market uncertainty (Bollerslev, 1986).
Moreover, studies by Andersen et al. (2012) explore how implied volatility indices, like the VIX, serve as predictors for future realized volatility, underlining the relationship between expected volatility and actual market behavior. The Z-score normalization process helps in making volatility data comparable across different asset classes, enabling more effective decision-making in volatility-based strategies.
Applications in Trading and Risk Management
By using Z-score normalization, traders can more easily assess deviations from the mean in volatility, helping to identify periods when volatility is unusually high or low. This can be used to adjust risk exposure or to implement volatility-based trading strategies, such as mean reversion strategies. Research suggests that volatility mean-reversion is a reliable pattern that can be exploited for profit (Christensen & Prabhala, 1998).
References:
• Andersen, T. G., Bollerslev, T., Diebold, F. X., & Vega, C. (2012). Realized volatility and correlation dynamics: A long-run approach. Journal of Financial Economics, 104(3), 385-406.
• Bollerslev, T. (1986). Generalized autoregressive conditional heteroskedasticity. Journal of Econometrics, 31(3), 307-327.
• Christensen, B. J., & Prabhala, N. R. (1998). The relation between implied and realized volatility. Journal of Financial Economics, 50(2), 125-150.
• Whaley, R. E. (2000). Derivatives on market volatility and the VIX index. Journal of Derivatives, 8(1), 71-84.
Option Contract Size CalculatorOption Contract Size Calculator
This indicator helps you to figure out the ideal number of contracts for your trade and its only used for options day trading.
The indicator needs to fill the input section in order to give you the information table that includes Contract size .
The input section consists of two sections. The first section requires user entry of the delta of the options contract from the broker chain and the stop loss size on the chart.
The second section allows you to enter your account balance and risk per trade
(2% recommended) .
There is also the option for where you wish to display your table like bottom right , bottom left or top right, top left.
special thanks to @Mohamedawke for the open source script this code is based off
TP/SL Percentage & RR Visual Tool📈 TP/SL Percentage & RR Visual Tool with UT Bot & EMA Suite
This all-in-one visual trading tool combines powerful precision with clean, dynamic overlays designed to help traders make smarter decisions in real time.
✅ Features:
TP/SL Lines + Zones
Visualize up to 3 Take Profit targets and your Stop Loss level on the chart. Zones are shaded for quick risk/reward perception.
Customizable Risk/Reward
Adjust TP/SL percentages and see real-time percentage distance from price, plus live R:R ratio.
Floating Table Display
A sleek, movable table shows:
Entry & Current Price
TP & SL values
% distance to TP
R:R Ratio
Current Session + Next Session time
Session Awareness
Automatically detects and displays whether you're in the Asian, London, or New York session. Highlights upcoming session transitions.
UT Bot Alerts Integration
Get clear Buy/Sell signals using trailing stop logic powered by ATR and optional Heikin Ashi candles.
Built-in EMAs (20, 50, 100, 200)
Customize and plot key moving averages directly on the chart with color-coded lines.
🔧 Customization Options:
TP/SL levels
Line style, color & thickness
EMA lengths
Table placement
Session timing logic
UT Bot sensitivity (ATR & key multiplier)
💡 Ideal For:
Scalping & intraday trading
Swing traders who use clear entry/exit zones
Anyone who wants clean R:R visuals and precision-based decisions
TP/SL Percentage & RR Visual ToolThis tool is designed to help traders visually and statistically assess their trade setup by calculating Stop Loss (SL), Take Profit (TP), and Risk-to-Reward (RR) based on percentage inputs from the current price.
🔧 How It Works:
Uses the current candle’s close price as your entry.
Calculates TP and SL as percentage-based levels (e.g., 1% SL, 1.5% TP).
Displays horizontal lines and labels on the chart for TP and SL (only on the latest candle to reduce clutter).
Shows a compact table in the top-right corner with all key values:
Entry Price
Current Price
TP Price (+%)
SL Price (-%)
TP Distance from current price
RR Ratio (e.g., 1:1.5)
💡 Use Cases:
Quickly validate if a trade setup meets your desired RR profile (e.g., 1:2).
Perfect for scalpers, swing traders, and position traders who rely on structured risk management.
Combine with your entry signal strategy to visualize targets and stops without manual calculations.
⚙️ Inputs:
Stop Loss % – Sets how far your SL is from the entry.
Take Profit % – Sets how far your TP is from the entry.
Metatrader CalculatorThe “ Metatrader Calculator ” indicator calculates the position size, risk, and potential gain of a trade, taking into account the account balance, risk percentage, entry price, stop loss price, and risk/reward ratio. It supports the XAUUSD, XAGUSD, and BTCUSD pairs, automatically calculating the position size (in lots) based on these parameters. The calculation is displayed in a table on the chart, showing the lot size, loss in dollars, and potential gain based on the defined risk.
CME Price LimitCalculates the CME Price Limit
The reference price is obtained from the previous day's closing settlement price
(data pulled from the asset's daily chart with settlement enabled)
Percentage limit can be modified in settings
Buffer can be enabled (for example, 2% buffer on a 7% limit, so a line gets drawn at 5% too)
Alert can be enabled for price crossing a certain percentage from reference on the day
You can choose to plot the historical lines on every day, or the current day only
The reference price output can be found in the data window, or in the indicator status line if enabled in the settings.
Before placing real trades with this, you should compare the indicator's reference price to what's shown on CME's website, to double check that TradingView's data matches for your contract.
www.cmegroup.com
Zonas Prohibidas Topstep (NQ) - Auto🛡️ Topstep Restricted Zones (Auto Previous Close) — by Dragonthegood
This script is built for traders using Topstep or other prop firm accounts that enforce risk rules near daily price limits (such as on futures like NQ, the E-mini Nasdaq-100).
🧠 What does this indicator do?
🔹 Automatically fetches the previous day's closing price
🔹 Based on that close, it calculates:
The 7% daily price limit (up and down)
The 2% restricted zone near those limits, where Topstep does not allow trading
🔹 Visually draws two red horizontal zones (upper and lower) on the chart, indicating where you should not open or hold positions
🔹 Optionally displays the previous close as a label on the chart for reference
🔒 Why is it useful?
Helps you avoid violations of Topstep's high-risk zone rules
Prevents you from getting stuck in a trade if the market hits limit up or limit down
Works in real-time, without needing to manually input the previous close
🛠️ How to use it:
Apply the script to your chart (works on any timeframe)
The danger zones will auto-draw based on yesterday’s close
If price is inside the red zone — don’t trade (per Topstep rules)
No daily configuration required
📌 Perfect for:
Futures traders in funded accounts (Topstep, Apex, etc.)
Scalpers and day traders using NQ, ES, RTY, etc.
Anyone managing risk during high-volatility conditions
ProfitPivotProfitPivot dynamically shows the difference between unit cost and current market price of an asset, both in absolute term and in percentage. Traders can ascertain the profit level of a particular asset at a glance. Traders can input or change unit cost of the asset at any time directly through attribute settings. Previous bar close price will be used by default if the unit cost is not supplied.
ProfitPivot is developed by @isarab with the assistance of Copilot. It is licensed under Mozilla Public License Version 2.0.
Portfolio Monitor - DolphinTradeBot1️⃣ Overview
▪️This indicator unifies the value of all your investments—whether stocks, currencies, or cryptocurrencies—in your chosen currency. This tool not only provides a clear snapshot of your overall portfolio performance but also highlights the individual growth of each asset with intuitive visualizations and an easy-to-understand performance report.
2️⃣ What sets this indicator apart
▪️is its ability to convert values from various currency pairs into any currency you choose. This means you can monitor your portfolio's performance against any currency pair you prefer, offering a flexible and comprehensive view of your investments.
3️⃣ How Is It Work ?
🔍The indicator can be analyzed under two main categories: visual representations and tables.
1- Visual representations ;
The indicator includes three different types of lines:
1. 1 - Reference Line → This represents the cost of all assets we hold, based on the selected date.
1. 2 - Total Assets Line → Displays the real-time value of all assets in our possession, including cash value, in the selected trading pair.
The area between the reference line is filled with green and red. The section above the reference line is represented in green, while the section below is shown in red.
1. 3 - Performance Lines → These visualize the performance of the assets, starting from the reference line and taking into account their weights in the portfolio. (Note: The lines are scaled for visualization purposes, so their absolute values should not be considered.)
"The names of the lines are shown in the image below."⤵️
2- Tables
The indicator includes three different types of tables:
2. 1 - Analysis Table : It provides a superficial overview of wallet statistics and values.
▪️TOTAL ASSETS → The current equivalent of all assets in the target currency
▪️CASH VALUE → The current value of the amount "Cash Value", in the target currency.
▪️PORTFOLIO VALUE → The total value of assets excluding Cash, in the target currency.
▪️POSTFOLIO COST → The cost of assets excluding Cash, in the target currency.
▪️PORTFOLIO ABSOLUTE RETURN → It shows the profit or loss relative to the cost of assets
▪️PORTFOLIO RETURN % →It shows the profit or loss relative to the cost of assets on a percentage basis
2. 2 - Performance Table : It displays the names of assets excluding Cash and their profit amounts, sorted from highest to lowest profit. If "Show as Percentage" is selected in the settings, it shows the percentage profit or loss relative to the cost. Profits are represented in green, while losses are represented in red.
"You can see the visual showing the tables below"⤵️
4️⃣How to Use ?
1- Choose the date on which the visualization will begin (📌The start date only affects the exchange rate used for calculating the reference line in the target currency.)
2- If you have cash holdings, enter the amount and specify the currency.
3- Select the currency in which your portfolio value will be displayed.(Default value is USD)
4- To set up your portfolio;
SYMBOLS - QUANTITY - PURCHASE PRICE
Enter the symbols of your assets - the number of units you hold - and their cost levels.
5- If you have cash, be sure to include your cash balance. If you also hold other currencies, enter them as separate assets with their corresponding quantities and purchase prices.
6- If you want to see the percentage returns of the assets in the performance table relative to their cost, select the "Show as Percent" option.
7- If you want to see the performance visuals of the assets, click on the "Show Asset Performance" option.
You can find an image of the settings section where the numbers above are used as references below.⤵️
📌 NOTE → By default, a few assets and their values have been pre-added in the initial settings. This is to ensure that you don’t see an empty screen when adding the indicator to the chart. Please remember to enter your own assets and values. The default settings are only provided as an example.
Nasan Risk Score & Postion Size Estimator** THE RISK SCORE AND POSITION SIZE WILL ONLY BE CALCUTAED ON DIALY TIMEFRAME NOT IN OTHER TIMEFRAMES.
The typically accepted generic rule for risk management is not to risk more than 1% - 2 % of the capital in any given trade. It has its own basis however it does not take into account the stocks historic & current performance and does not consider the traders performance metrics (like win rate, profit ratio).
The Nasan Risk Score & Position size calculator takes into account all the listed parameters into account and estimates a Risk %. The position size is calculated using the estimated risk % , current ATR and a dynamically adjusted ATR multiple (ATR multiple is adjusted based on true range's volatility and stocks relative performance).
It follows a series of calculations:
Unadjusted Nasan Risk Score = (Min Risk)^a + b*
Min Risk = ( 5 year weighted avg Annual Stock Return - 5 year weighted avg Annual Bench Return) / 5 year weighted avg Annual Max ATR%
Max Risk = ( 5 year weighted avg Annual Stock Return - 5 year weighted avg Annual Bench Return) / 5 year weighted avg Annual Min ATR%
The min and max return is calculated based on stocks excess return in comparison to the Benchmark return and adjusted for volatility of the stock.
When a stock underperforms the benchmark, the default is, it does not calculate a position size , however if we opt it to calculate it will use 1% for Min Risk% and 2% for Max Risk% but all the other calculations and scaling remain the same.
Rationale:
Stocks outperforming their benchmark with lower volatility (ATR%) score higher.
A stock with high returns but excessive volatility gets penalized.
This ensures volatility-adjusted performance is emphasized rather than absolute returns.
Depending on the risk preference aggressive or conservative
Aggressive Risk Scaling: a = max (m, n) and b = min (m, n)
Conservative Scaling: a = min (m, n) and b = max (m, n)
where n = traders win % /100 and m = 1 - (1/ (1+ profit ratio))
A default of 50% is used for win factor and 1.5 for profit ratio.
Aggressive risk scaling increases exposure when the strategy's strongest factor is favorable.
Conservative risk scaling ensures more stable risk levels by focusing on the weaker factor.
The Unadjusted Nasan risk is score is further refined based on a tolerance factor which is based on the stocks maximum annual drawdown and the trader's maximum draw down tolerance.
Tolerance = /100
The correction factor (Tolerance) adjusts the risk score based on downside risk. Here's how it works conceptually:
The formula calculates how much the stock's actual drawdown exceeds your acceptable limit.
If stocks maximum Annual drawdown is smaller than Trader's maximum acceptable drawdown % , this results in a positive correction factor (indicating the drawdown is within your acceptable range and increases the unadjusted score.
If stocks maximum Annual drawdown exceeds Trader's maximum acceptable drawdown %, the correction factor will decrease (indicating that the downside risk is greater than what you are comfortable with, so it will adjust the risk exposure).
Once the Risk Score (numerically equal to Risk %) The position size is calculated based on the current market conditions.
Nasan Risk Score (Risk%) = Unadjusted Nasan Risk Score * Tolerance.
Position Size = (Capital * Risk% )/ ATR-Multiplier * ATR
The ATR Multiplier is dynamically adjusted based on the stocks recent relative performance and the variability of the true range itself. It would range between 1 - 3.5.
The multiplier widens when conditions are not favorable decreasing the position size and increases position size when conditions are favorable.
This Calculation /Estimate Does not give you a very different result than the arbitrary 1% - 2%. However it does fine tune the % based on sock performance, traders performance and tolerance level.
Trade Ladder Pro: Compounding & Risk ManagerTrade Ladder Pro: Compounding & Risk Manager
Inspired by the popular $20 to $52,000 trading challenge, this tool is designed to help you scale your trading account using systematic compounding and enhanced risk management techniques. Whether you’re aiming for disciplined growth or fine-tuning your risk/reward, Trade Ladder Pro offers a flexible approach to visualizing your trade levels.
How to Use:
Inputs:
Compounding Mode:
Set your starting balance, final balance goal, number of trades, and current trade level. You can move to the next trade after a successful trade in settings. The entries are not signals. They are there to help manage risk.
The script calculates the necessary compounding factor to grow your balance across the defined trades.
Risk Management Mode:
In addition to the above, specify a risk percentage and risk/reward ratio.
Input an entry price (or leave it at 0 to use the current price) to automatically compute the stop loss and take profit levels.
Display Options:
Choose the table’s position on the chart (e.g., Top Right, Top Left, Bottom Right, Bottom Left).
Pick between a vertical or horizontal layout for a display that suits your workflow.
Results:
The table will display the trade level, starting balance, risk amount, entry price, take profit, and (if in Risk Management mode) stop loss along with the projected ending balance.
Community & Feedback:
Your feedback is invaluable! Please share any tips or report any errors you encounter so we can continue to improve this tool. Happy trading!
Smart % Levels📈 Smart % Levels – Visualize Significant Percentage Moves
What it does:
This indicator plots horizontal levels based on a percentage change from the previous day's close (or open, if selected). It allows traders to visualize price movements relative to meaningful thresholds like ±1%, ±2%, etc.
What makes it different:
Unlike other level indicators, Smart % Levels only displays the relevant levels based on current price action. This avoids clutter by showing only the levels that are being approached or crossed by the current price. It's a clean and dynamic way to visualize key price zones for intraday analysis.
How it works:
- Select between using the previous day's Close or Open as the reference
- Choose the percentage spacing between levels (e.g., 1%, 0.5%, etc.)
- Enable optional labels to see the exact percentage of each level
- Automatically filters levels to only show those between yesterday's price and today's current price
- Includes customization for colors, line styles, widths, and opacity
Best for:
Day traders and scalpers who want a quick, clean view of how far the current price has moved from yesterday’s reference, without being overwhelmed by unnecessary lines.
Extra notes:
- The levels are recalculated each day at the market open
- All graphics reset at the start of each session to maintain clarity
- This script avoids repainting by only plotting levels relative to available historical data (no lookahead)
This tool is for informational purposes only and should not be considered as financial advice. Always do your own research before making trading decisions.
Cartera SuperTrends v4 PublicDescription
This script creates a screener with a list of ETFs ordered by their average ROC in three different periods representing 4, 6 and 8 months by default. The ETF
BIL
is always included as a reference.
The previous average ROC value shows the calculation using the closing price from last month.
The current average ROC value shows the calculation using the current price.
The previous average column background color represents if the ETF average ROC is positive or negative.
The current average column background color represents if the ETF average ROC is positive or negative.
The current average column letters color represents if the current ETF average ROC is improving or not from the previous month.
Changes from V2 to V3
Added the option to make the calculation monthly, weekly or daily
Changes from V3 to V4
Adding up to 25 symbols
Highlight the number of tickers selected
Highlight the sorted column
Complete refactor of the code using a matrix of arrays
Options
The options available are:
Make the calculation monthly, weekly or daily
Adjust Data for Dividends
Manual calculation instead of using ta.roc function
Sort table
Sort table by the previous average ROC or the current average ROC
Number of tickers selected to highlight
First Period in months, weeks or days
Second Period in months, weeks or days
Third Period in months, weeks or days
Select the assets (max 25)
Usage
Just add the indicator to your favorite indicators and then add it to your chart.
Trading Capital Management for Option SellingTrading Capital Management for Option Selling
This Pine Script indicator helps manage trading capital allocation for option selling strategies based on price percentile ranking. It provides dynamic allocation recommendations for index options (NIFTY and BANKNIFTY) and individual stock positions.
Key Features:
- Dynamic buying power (BP) allocation based on close price percentile
- Flexible index allocation between NIFTY and BANKNIFTY
- Automated calculation of recommended number of stock positions
- Risk management through position size limits
- Real-time INDIA VIX monitoring
Main Parameters:
1. Window Length: Period for percentile calculation (default: 252 days)
2. Thresholds: Low (30%) and High (70%) percentile thresholds
3. Capital Settings:
- Trading Capital: Total capital available
- Max BP% per Stock: Maximum allocation per stock position
4. Buying Power Range:
- Low Percentile BP%: Base BP usage at low percentile
- High Percentile BP%: Maximum BP usage at high percentile
5. Index Allocation:
- NIFTY/BANKNIFTY split ratio
- Minimum and maximum allocation thresholds
Display:
The indicator shows two tables:
1. Common Metrics:
- Total BP Usage with percentage
- Current INDIA VIX value
- Current Close Price Percentile
2. Capital Allocation:
- Index-wise BP allocation (NIFTY and BANKNIFTY)
- Stock allocation pool
- Recommended number of stock positions with BP per stock
Usage:
This indicator helps traders:
1. Scale positions based on market conditions using price percentile
2. Maintain balanced exposure between indices and stocks
3. Optimize capital utilization while managing risk
4. Adjust position sizing dynamically with market volatility
All Forex Sessions (SAST Accurate) + LabelsFor traders in South Africa
Uses timestamp("Africa/Johannesburg", ...) — this locks the session window to true SAST time
The session now perfectly aligns from 14:00 to 18:00 local time no matter what time zone your TradingView chart is in
Also shows start and end vertical lines only when the session opens and closes