TCP | Money Management indicator | Crypto Version📌 TCP | Money Management Indicator | Crypto Version
A robust, multi-target risk and capital management indicator tailored for crypto traders. Whether you're trading spot, perpetual futures, or leverage tokens, this tool empowers you with precise control over risk, reward, and position sizing—directly on your chart. Eliminate guesswork and trade with confidence.
🔰 Introduction: Master Your Capital, Master Your Trades
Poor money management is the number one reason traders lose their accounts, even with solid strategies. The TCP Money Management Indicator, built by Trade City Pro (TCP), solves this problem by providing a structured, rule-based approach to capital allocation.
Want to dive deeper into the concept of money management? Check out our comprehensive tutorial on TradingView, " TradeCityPro Academy: Money Management ", to understand the principles that power this indicator and transform your trading mindset.
This indicator equips you to:
• Calculate optimal position sizes based on your capital, risk percentage, and leverage
• Set up to 5 customizable take-profit targets with partial close percentages
• Access real-time metrics like Risk-to-Reward (R/R), USD profit, and margin usage
• Trade with discipline, avoiding emotional or inconsistent decisions
💸 Money Management Formula
The indicator uses a professional capital allocation model:
Position Size = (Capital × Risk %) ÷ (Stop Loss % × Leverage)
From this, it calculates:
• Total risk amount in USD
• Optimal position size for your trade
• Margin required for each take-profit target
• Adjusted R/R for each target, accounting for partial position closures
🛠 How to Use
Enter Trade Parameters: Input your capital, risk %, leverage, entry price, and stop-loss price.
Set Take-Profit Targets: Enable 1 to 5 take-profit levels and specify the percentage of the position to close at each.
Real-Time Calculations: The indicator automatically computes:
• R/R ratio for each target
• Profit in USD for each partial close
• Margin used per target (in % and USD)
Visualize Your Trade:
• Price levels for entry, stop-loss, and take-profits are plotted on the chart.
• A dynamic info panel on the left side displays all key metrics.
🔄 Dynamic Adjustments: As each take-profit target is hit and a portion of the position is closed, the indicator recalculates the remaining position size, expected profit, R/R, and margin for subsequent targets. This ensures accuracy and reflects real-world trade behavior.
📊 Table Overview
The left-side panel provides a clear snapshot:
• Trade Setup: Capital, entry price, stop-loss, risk amount, and position size
• Per Target: Percentage closed, R/R, profit in USD, and margin used
• Summary: Total expected profit across all targets
⚙️ Settings Panel
• Total Capital ($): Your account size for the trade
• Risk per Trade (%): The percentage of capital you’re willing to risk
• Leverage: The leverage applied to the trade
• Entry/Stop-Loss Prices: Define your trade’s risk zone
• Take-Profit Targets (1–5): Set price levels and percentage to close at each
🔍 Use Case Example
Imagine you have $1,000 capital, risking 1%, using 10x leverage:
• Entry: $100 | Stop-Loss: $95
• TP1: $110 (close 50%) | TP2: $115 (close 50%)
The indicator calculates the exact position size, profit at each target, and margin allocation in real time, with all metrics displayed on the chart.
✅ Why Traders Love It
• Precision: No more manual calculations or guesswork
• Versatility: Works on all crypto pairs (BTC, ETH, altcoins, etc.)
• Flexibility: Perfect for scalping, swing trading, or futures strategies
• Universal: Compatible with all timeframes
• Transparency: Fully manual, with clear and reliable outputs
🧩 Built by Trade City Pro (TCP)
Developed by TCP, a trusted name in trading tools, used by over 150,000 traders worldwide. This indicator is coded in Pine Script v5, ensuring compatibility with TradingView’s platform.
🧾 Final Notes
• No Auto-Trading: This is a manual tool for disciplined traders
• No Repainting: All calculations are accurate and non-repainting
• Tested: Rigorously validated across major crypto pairs
• Publish-Ready: Built for seamless use on TradingView
🔗 Resources
• Money Management Tutorial: Learn the fundamentals of capital management with our detailed guide: TradeCityPro Academy: Money Management
• TradingView Profile: Explore more tools by TCP on TradingView
Portfolio management
Position Size Calculator (Fixed % or ATR-based Stop Support)Position Size Calculator (Fixed % or ATR-based Stop Support)
Purpose and Background
This indicator allows traders to calculate appropriate position sizes directly on the chart, based on a key rule:
“What percentage of your capital are you willing to risk per trade?”
While many traders focus on entries and indicators, position sizing and risk allocation are often overlooked.
This tool visualizes and simplifies the “1% risk rule” promoted by IBD (Investor’s Business Daily) and William J. O’Neil, helping both beginners and experienced traders maintain disciplined capital management.
Key Features
Automatically calculates and displays:
・ Position Size
The number of units (shares, contracts, coins) you can hold based on your stop-loss range and risk allowance.
・ Stop Price
The price level at which your stop-loss would be triggered.
・ Risk Amount
The maximum loss per trade based on your portfolio size and risk percentage.
Two stop-loss modes available:
・ Fixed % Mode
O’Neil suggests using up to 8% stop-loss in uptrends and keeping it tighter (around 4%) in corrections. This mode allows flexible manual settings.
・ ATR-Based Mode
Uses the asset’s average volatility to dynamically calculate stop-loss width using the Average True Range (ATR).
ATR Usage and Recommended Settings
ATR helps you avoid noise-based stop-outs and align your risk with market volatility.
There are two parameters you can adjust:
・ ATR Length
Defines how many bars are used to calculate the average range.
・Shorter values (5–10) respond faster for day trades
・Longer values (14–21) offer smoother ranges for swing/position trades(Default is 14)
・ATR Multiplier
Sets how wide the stop-loss is by multiplying the ATR value:
・Day trading: 1.0–1.5×
・Swing trading: 1.5–2.5×
・Position trading: 2.0–3.0×
Practical Examples: Risk % × Stop-Loss % → Max Positions
This tool helps estimate how many positions you can hold in a portfolio based on your risk per trade and stop width.
Examples:
・Risk 0.5%, Stop 8% → Max 16 positions
・Risk 0.5%, Stop 4% → Max 8 positions
・Risk 1.0%, Stop 8% → Max 8 positions
・Risk 1.0%, Stop 4% → Max 4 positions
・Risk 2.0%, Stop 8% → Max 4 positions
・Risk 2.0%, Stop 4% → Max 2 positions
These assume worst-case scenarios where all positions are stopped out simultaneously within your overall portfolio risk limit.
Display & Customization Options
・ Currency Display: USD or JPY
No currency conversion is applied. Select based on your trading region (e.g., USD for U.S. stocks, JPY for Japanese stocks).
Support for additional currencies can be added upon request.
・ Show/Hide Decimal Places
Toggle decimals for better visibility. Ideal for fractional assets like crypto and CFDs.
・ Position of Output
Choose from top-right, middle-right, or bottom-right on the chart.
・ Text Display Size: Large / Normal / Small
Choose the table size that best suits your viewing preferences.
・ Explanation of Displayed Labels
・ Position Size : Units to buy/sell based on risk
・ Stop Price : Price where stop-loss is triggered
・ Risk Amount : Max loss allowed for the trade
How to Use
1、Set your Portfolio Size
2、Choose your Currency (USD or JPY)
3、Input Risk per Trade (%) (e.g., 1%)
4、Select Stop Loss Method
・ Fixed % : Enter a manual stop-loss percent (e.g., 8%)
・ ATR : Then also enter:
・ ATR Length : Number of bars used to calculate ATR (e.g., 14)
・ ATR Multiplier : Factor applied to ATR to determine stop-loss (e.g., 2.0)
5、Adjust decimals, label position, or text size as needed
6、The result is displayed in a table directly on your chart
Notes
・ Uses the current close price (close) as the basis
Real-time bid/ask data isn't available in Pine Script, so the close price is used for consistent results.
・ No buy/sell signals are generated
This tool is for position sizing and risk calculation only, not trade entries.
Recommended For
・Traders who want precise, rule-based position sizing
・Users following IBD or O’Neil’s 1% risk principle
・Those incorporating ATR for stop-loss strategies
・Multi-asset traders (stocks, crypto, CFDs, etc.)
・ Anyone who wants to calculate position size and risk without using a calculator or external tool—fully inside TradingView
Dynamic Portfolio TrackerDynamic Portfolio Tracker
The Dynamic Portfolio Tracker is a visual tool for actively managing and monitoring a multi-asset portfolio directly on TradingView. It allows users to input up to 15 custom assets (with a default setup for 5), define how much of each asset they hold, and assign a target allocation percentage to each. The script then calculates live market prices, total portfolio value, current vs. target weightings, and provides clear, color-coded instructions on whether to buy, sell, or hold each asset. It displays all this data in an on-chart table, showing both the dollar amount and the quantity to adjust for each asset, helping users keep their portfolio aligned with their strategy in real time.
How to Use the Inputs (What Each Field Means)
1. Portfolio Assets (Tickers)
Fields: Asset 1 Ticker, Asset 2 Ticker, …, Asset 15 Ticker
What it does: Lets you select which assets (crypto, stocks, etc.) you want to track. These are live symbols pulled from TradingView.
2. Asset Quantities
Fields: Asset 1 Amount, Asset 2 Amount, …, Asset 15 Amount
What it means: How much of each asset you currently hold. For example:
• 0.03 BTC
• 2.1 ETH
Why it’s needed: The script multiplies this by the live price to calculate the current dollar value of each asset in your portfolio.
3. Target %
Fields: Asset 1 Implied %, Asset 2 Implied %, …, Asset 15 Implied %
What it means: Your desired allocation for each asset. For example:
• 40% BTC
• 20% ETH
• 10% SOL, etc.
Important: These must total 100% or less across all assets. The script checks this and shows an error if the total exceeds 100%.
The Dynamic Portfolio Tracker displays two powerful on-chart tables:
1. Main Table — Per Asset Breakdown
This table shows detailed, real-time information for each asset in your portfolio. Each row represents a different asset, and each column has a specific meaning:
Column What It Means
Asset = The symbol of the asset (e.g., BTCUSD, ETHUSD), auto-stripped from the exchange name.
Price = The current market price of the asset, pulled live from TradingView.
Quantity = How much of that asset you currently hold, entered manually in the inputs.
Target % = The percentage of your total portfolio you want this asset to represent.
Actual % = What percentage of your portfolio it currently makes up (based on price × quantity).
Target Value = How much (in $) this asset should be worth in your portfolio.
Actual Value = How much (in $) this asset is currently worth.
Instruction = Whether to Buy, Sell, or Hold to match your target allocation.
Value Change = The dollar amount you’d need to buy/sell to rebalance this asset.
Units to Trade = The number of asset units to buy/sell to reach the target value.
2. Portfolio Summary Table — Portfolio Totals
This smaller table appears in the top-right corner and summarizes your entire portfolio at a glance:
Target % = Total of all your assigned target allocations (should equal 100%).
Actual % = Actual portfolio composition (always 100% unless your capital is zero).
Target Value = Total value your portfolio should be based on your target percentages.
Actual Value = Current live total value of your portfolio.
If there’s a discrepancy between Target Value and Actual Value, the difference is shown in each row of the main table, so you can adjust individual assets accordingly.
Privacy First: Hide Sensitive Financial Data
A unique feature of this tool is the ability to hide sensitive financial data, such as:
• Target Value
• Actual Value
• Total Portfolio Value
You can turn these off using toggle settings, and they’ll be replaced with a crossed-out eye icon (👁️🗨️) — just like on modern crypto exchanges. This feature makes the script safe for streaming, screenshots, or sharing publicly while protecting your privacy.
But more importantly:
Feelings are the enemy of good investing.
Seeing the value of your portfolio fluctuate can trigger fear or greed. By hiding your dollar values, you’re not just securing your data — you’re reducing the temptation to react emotionally.
It’s just numbers. Systems over Feelings.
Table Automatically Adapts to Your Asset Count
The Dynamic Portfolio Tracker is designed to scale with your portfolio. Simply choose how many assets you want to track (up to 15), and the table will automatically resize to fit exactly that number — no wasted space or empty rows.
• Select 1 to 15 assets using the “Number of Assets” input
• The table expands or contracts dynamically to show only those rows
• All calculations, summaries, and layout elements adjust accordingly in real time
This keeps the interface clean, focused, and perfectly tailored to your setup — whether you’re tracking 3 coins or managing a full portfolio of 12+ tokens.
Customize Your Table to Match Your Style
The Dynamic Portfolio Tracker offers a full suite of visual customization options, allowing you to tailor the table to your charting style or stream layout. You can:
• Choose text colors for labels, values, and headers
• Set background colors for the full table and header row — or turn them off completely for a clean, transparent look
• Control border and frame settings, including color, thickness, or disabling them entirely
• Pick custom colors for Buy and Sell signals in the rebalance column
• Adjust table font size from tiny to large to match your resolution or preferences
Special Thanks
This tool wouldn’t exist without the knowledge and inspiration gained through The Real World. A sincere thank you to the Investing Master, the Guides, and Professor Adam — your frameworks and lessons brought clarity, discipline, and structure to this build.
And of course, glory to L4 — where real men are made.
Risk ModuleRisk Module
This indicator provides a visual reference to determine position sizing and approximate stop placement. It is designed to support trade planning by calculating equalized risk per trade based on a stop distance derived from volatility. The tool offers supportive reference points that allow for quick evaluation of risk and position size consistency across varying markets.
Equalized Risk Per Trade
The indicator calculates the number of shares that can be traded to maintain consistent monetary risk. The formula is based on the distance between the current price and the visual stop reference, adjusting the position size proportionally.
Position Size = Dollar Risk / (Entry Price – Stop Price)
The risk is calculated as a percentage of account size; both of which can be set in the indicator’s settings tab. This creates a consistent risk exposure across trades regardless of volatility or structural stop distance.
Stop Placement Reference
The visual stop reference is derived from the Average True Range (ATR), providing a volatility-based anchor. The default value is set to 2 × ATR, but this can be customized.
Price Model: Uses the current price ± ATR × multiplier. This model reacts to price movement and is set as the default option.
EMA Model: Uses the 20-period EMA ± ATR × multiplier. This model is less reactive and can be an option when used in combination with an envelope indicator.
Chart Elements
Stop Levels: Plotted above and below either the current price or EMA, depending on the selected model. These serve as visual reference points for stop placement; the lower level a sell stop for long trades, the upper level a buy stop for short trades.
Information Table: Displays the number of shares to trade, stop level and percentage risk. A compact mode is available to reduce the table to essential information (H/L and Shares).
Settings Overview
Stop Model: Choose between “Price” or “EMA” stop calculation logic.
ATR Multiplier: Change the distance between price/EMA and the stop reference.
Account Size / Risk %: These risk parameters are used to calculate dollar risk per trade.
Visible Bars: Number of recent bars to show stop markers on.
Compact Mode: Minimal table view for reduced chart footprint.
Table Position / Size: Controls table placement and scale on the chart.
Watermark Stepped GridAdd a clean, professional watermark grid to any chart. “Watermark Stepped Grid” repeats your custom text in a diagonal or block pattern with adjustable rows, columns, font size, spacing, transparency, and optional semi‑transparent boxes—perfect for branding screenshots and shared analyses.
SBC ProtfoSBC Portfo PNL Indicator
Description
The SBC Portfo PNL Indicator is a user-friendly tool designed for Hebrew-speaking traders to track the Profit and Loss (PNL) of their stock portfolios on TradingView charts. It supports up to 5 distinct portfolios, each capable of holding an unlimited number of stocks with unlimited buy commands, allowing real-time monitoring of portfolio performance.
Key Features
- Multi-Portfolio Support: Track up to 5 separate portfolios for different trading strategies or accounts.
- Unlimited Stock Entries: Add unlimited stocks and buy commands per portfolio.
- Detailed Buy Commands: Input for each stock:
- Stock Ticker (e.g., AAPL, TSLA).
- Buy Price (e.g., 150.25).
- Buy Amount (e.g., 10).
- Hebrew-Friendly Interface: Intuitive settings dialog with clear instructions in Hebrew.
- Customizable PNL Tracking: Visualize PNL on charts with real-time updates based on market data.
How to Use
1. Add the Indicator:
- Go to the Indicators menu in TradingView and add the "SBC Portfo" PNL Indicator.
2. Configure Portfolios:
- Open the indicator’s settings dialog.
- For each portfolio (up to 5), enter data in the provided input fields using this format:
PortfolioName:StockTicker:BuyPricexBuyAmount;StockTicker:BuyPricexBuyAmount
Example:
Portfolio1:AAPL:150.25x10;TSLA:266.72x5
- This represents a portfolio named "Portfolio1" with:
- 10 shares of AAPL bought at $150.25.
- 5 shares of TSLA bought at $266.72.
- Repeat for additional portfolios (e.g., Portfolio2, Portfolio3).
- Add multiple buy commands for the same stock if needed (e.g., AAPL:160.50x20).
3. Apply Settings:
- Save settings to display PNL based on current market prices.
4. Monitor PNL:
- View PNL for each portfolio on the chart via tables, labels, or graphical overlays (based on settings).
Input Format
Enter portfolio data manually in the settings dialog, one input field per portfolio:
PortfolioName:StockTicker:BuyPricexBuyAmount;StockTicker:BuyPricexBuyAmount
- PortfolioName: Unique name (e.g., Portfolio1, Growth).
- StockTicker: Stock symbol (e.g., AAPL).
- BuyPrice: Purchase price per share (e.g., 150.25).
- BuyAmount: Number of shares (e.g., 10).
- Use
: to separate portfolio name, ticker, and buy data
x to separate price and amount
; for multiple stocks in the portfolio
Example:
- Portfolio 1: GrowthPortfolio:AAPL:150.25x10;TSLA:266.72x5
- Portfolio 2: DividendPortfolio:KO:55.20x50;PG:145.30x30
Notes
- Hebrew Support: Settings and labels are optimized for Hebrew users.
- Manual Input: Enter portfolio data manually in the settings dialog using the correct format.
- Compatibility: Works with any stock ticker supported by TradingView.
תיאור אינדיקטור SBC Portfo PNL הוא כלי ידידותי למשתמש שתוכנן במיוחד עבור סוחרים דוברי עברית למעקב אחר רווח והפסד (PNL) של תיקי המניות שלהם ישירות בגרפים של TradingView. הוא תומך בעד 5 תיקים נפרדים, כאשר כל תיק יכול להכיל מספר בלתי מוגבל של מניות עם פקודות קנייה בלתי מוגבלות, ומאפשר מעקב בזמן אמת אחר ביצועי התיק.
תכונות עיקריות
- תמיכה בריבוי תיקים: מעקב אחר עד 5 תיקים נפרדים עבור אסטרטגיות מסחר או חשבונות שונים.
- רישום מניות ללא הגבלה: הוספת מספר בלתי מוגבל של מניות ופקודות קנייה לכל תיק.
- פקודות קנייה מפורטות: הזנת נתונים עבור כל מניה:
- סימול המניה (למשל, AAPL, TSLA).
- מחיר קנייה (למשל, 150.25).
- כמות קנייה (למשל, 10).
- ממשק ידידותי לעברית: חלונית הגדרות אינטואיטיבית עם הוראות ברורות בעברית.
- מעקב PNL הניתן להתאמה: הצגת רווח והפסד בגרפים עם עדכונים בזמן אמת בהתבסס על נתוני השוק.
כיצד להשתמש
1. הוספת האינדיקטור:
- נווט לתפריט האינדיקטורים ב-TradingView והוסף את "SBC Portfo PNL Indicator".
2. הגדרת תיקים:
- פתח את חלונית ההגדרות של האינדיקטור.
- עבור כל תיק (עד 5), הזן נתונים בשדות המסופקים בפורמט הבא:
PortfolioName:StockTicker:BuyPricexBuyAmount;StockTicker:BuyPricexBuyAmount
לדוגמה:
Portfolio1:AAPL:150.25x10;TSLA:266.72x5
שורה זו מייצגת תיק בשם "Portfolio1" עם:
- 10 מניות של AAPL שנקנו ב-$150.25.
- 5 מניות של TSLA שנקנו ב-$266.72.
- חזור על התהליך עבור תיקים נוספים (למשל, Portfolio2, Portfolio3).
- ניתן להוסיף פקודות קנייה מרובות לאותה מניה לפי הצורך (למשל, AAPL:160.50x20).
3. החלת ההגדרות:
- שמור את ההגדרות להצגת ה-PNL בהתבסס על מחירי השוק הנוכחיים.
4. מעקב אחר PNL:
- צפה ב-PNL עבור כל תיק בגרף באמצעות טבלאות, תוויות או שכבות גרפיות (בהתאם להגדרות).
פורמט קלט הזן נתוני תיק ידנית בחלונית ההגדרות, שדה קלט אחד לכל תיק: PortfolioName:StockTicker:BuyPricexBuyAmount;StockTicker:BuyPricexBuyAmount
PortfolioName: שם ייחודי (למשל, Portfolio1, Growth).
StockTicker: סימול המניה (למשל, AAPL).
BuyPrice: מחיר רכישה למניה (למשל, 150.25).
BuyAmount: מספר המניות (למשל, 10).
השתמש ב-
: להפרדה בין שם התיק, סימול ונתוני קנייה
x להפרדה בין מחיר וכמות
; להפרדה בין מניות מרובות
דוגמה:
- תיק 1: GrowthPortfolio:AAPL:150.25x10;TSLA:266.72x5
- תיק 2: DividendPortfolio:KO:55.20x50;PG:145.30x30
Release Notes
Version 1.1 includes:
- Calculations for extended hours (Pre-Market & After-Hours).
- Option to display portfolio summary data for stocks not in the portfolio (enable via settings checkbox).
- Table background for better visibility; click to bring table to the front.
- Updated text strings (names, titles, tooltips).
הערות
תמיכה בעברית: ההגדרות והתוויות מותאמות למשתמשים דוברי עברית.
הזנה ידנית: הזן נתוני תיק ידנית בחלונית ההגדרות תוך שימוש בפורמט הנכון.
תאימות: עובד עם כל סימול מניה הנתמך על ידי TradingView.
גרסה 1.1 מכילה:
1. חישובים כוללים שעות מסחר מורחבות (Pre-Market ו-After-Hours).
2. אפשרות להציג נתוני תיק כוללים עבור מניות שאינן בתיק (הפעל באמצעות תיבת סימון בהגדרות).
3. צבע רקע לטבלה לשיפור הנראות; לחיצה על הטבלה מביאה אותה לחזית.
4. תיקון נוסחים (שמות, כותרות, וטולטיפים).
Gestión Visual Interactiva + Línea Arrastrable🧠 Interactive Trade Management + Smart Take Profit
This script is designed to manage trades visually and intuitively, combining the best of day trading and swing trading strategies.
✅ Key Features:
Entry and Stop Loss can be configured from the panel or by directly dragging the lines on the chart.
Automatic Take Profit levels calculated based on multiples of Risk (TP1, TP2, TP3).
Smart trailing stop system that activates from a defined level and adjusts dynamically.
Support for both LONG and SHORT trades with adaptive logic.
Integrated alerts for TP1, TP2, Trailing Stop, and Stop Loss.
🎯 Ideal for:
Traders who want to let part of their position run beyond the first target.
Trades where you want to turn a day trade into a swing trade partially.
Those who seek a visual and practical control of their trade management directly on the chart.
💡 Recommendation: Use the configuration panel to define initial values and adjust visually with the interactive lines for maximum flexibility.
PORTFOLIO TABLE Simple [Titans_Invest]PORTFOLIO TABLE Simple
This is a simple table for you to monitor your assets or cryptocurrencies in your SPOT wallet without needing to access your broker’s website or wallet app.
⯁ HOW TO USE THIS TABLE❓
You only need to select the asset and enter the amount of each one.
The table will show how much you have of each asset and the total value of your portfolio.
You’ll be able to monitor up to 39 assets in real time.
⯁ CONVERT VALUES
You can also activate and select a currency for conversion.
For example, cryptocurrency assets are calculated in US dollars, but you can select euros as the conversion currency.
The values originally in dollars will then be displayed in euros.
⯁ Track your Portfolio in real time:
⯁ Add your local Currency to Convert Values:
⯁ Follow your Portfolio Live:
___________________________________________________________
📜 SCRIPT : PORTFOLIO TABLE Simple
🎴 Art by : @Titans_Invest & @DiFlip
👨💻 Dev by : @Titans_Invest & @DiFlip
🎑 Titans Invest — The Wizards Without Gloves 🧤
✨ Enjoy!
___________________________________________________________
o Mission 🗺
• Inspire Traders to manifest Magic in the Market.
o Vision 𐓏
• To elevate collective Energy 𐓷𐓏
🧮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.
Credit Spread Monitor: HY & IG vs US10Y📉 Credit Spread Monitor: HY & IG vs US10Y
This indicator provides a dynamic and visual way to monitor credit spreads relative to the US Treasury benchmark. By comparing High Yield (HY) and Investment Grade (IG) corporate bond yields to the 10-Year US Treasury Yield (US10Y), it helps assess market stress, investor risk appetite, and potential macro turning points.
🔍 What It Does
-Calculates credit spreads:
HY Spread = BAMLH0A0HYM2EY − US10Y
IG Spread = BAMLC0A0CMEY − US10Y
-Detects macro risk regimes using statistical thresholds and yield curve signals:
🔴 HY Spread > +2σ → Potential financial stress
🟠 Inverted Yield Curve + HY Spread > 2% → Recession risk
🟢 HY Spread < 1.5% → Risk-on environment
-Visually highlights conditions with intuitive background colors for fast decision-making.
📊 Data Sources Explained
🔴 High Yield (HY): BAMLH0A0HYM2EY → ICE BofA US High Yield Index Effective Yield
🔵 Investment Grade (IG): BAMLC0A0CMEY → ICE BofA US Corporate Index Effective Yield
⚪ Treasury 10Y: US10Y → 10-Year US Treasury Yield
⚪ Treasury 2Y: US02Y → 2-Year US Treasury Yield (used to detect curve inversion)
✅ This Indicator Is Ideal For:
Macro traders looking to anticipate economic inflection points
Portfolio managers monitoring systemic risk or credit cycles
Fixed-income analysts tracking the cost of corporate borrowing
ETF/Asset allocators identifying shifts between risk-on and risk-off environments
🧠 Why It's Useful
This script helps visualize how tight or loose credit conditions are relative to government benchmarks. Since HY spreads typically widen before major downturns, this tool can provide early warning signals. Similarly, compressed spreads may indicate overheating or complacency in risk markets.
🛠️ Practical Use Case:
You’re managing a multi-asset portfolio. The HY spread jumps above +2σ while the yield curve remains inverted. You decide to reduce exposure to equities and high-yield bonds and rotate into cash or Treasuries as recession risk rises.
📎 Additional Notes
Sourced from FRED (Federal Reserve Economic Data) and TradingView’s bond feeds.
Designed to work best on daily resolution, using open prices to ensure consistency across series with different update timings.
This script is original, not based on built-in or public templates, and intended to offer educational, statistical, and visual insights for serious market participants.
Average Daily LiquidityIt is important to have sufficient daily trading value (liquidity) to ensure you can easily enter and, importantly, exit the trade. This indicator allows you to see if the traded value of a stock is adequate. The default average is 10 periods and it is common to average the daily traded value as both price and volume can have spikes causing trading errors. Some investors use a 5 period for a week, 10 period for 2 weeks, 20 or 21 period for 4 weeks/month and 65 periods for a quarter. You need to ascertain your buying amount such as $10000 and then have the average daily trading value be your comfortable moving average more such as average liquidity is more than 10 x MA(close x volume) or $100000 in this example. The value is extremely important for small and micro cap stocks you may wish to purchase.
ETF Builder & Backtest System [TradeDots]Create, analyze, and monitor your own custom “ETF-like” portfolio directly on TradingView. This script merges up to 10 different assets with user-defined weightings into a single composite chart, allowing you to see how your personalized portfolio would have performed historically. It is an original tool designed to help traders and investors quickly gauge risk and return profiles without leaving the TradingView platform.
📝 HOW IT WORKS
1. Custom Portfolio Construction
Multiple Assets : Combine up to 10 different stocks, ETFs, cryptocurrencies, or other symbols.
User-Defined Weights : Allocate each asset a percentage weight (e.g., 15% in AAPL, 10% in MSFT, etc.).
Single Composite Value : The script calculates a weighted “ETF-style” price, effectively simulating a merged portfolio curve on your chart.
2. Performance Tracking & Return Analysis
Automatic History Capture : The indicator records each asset’s starting price when it first appears in your chosen date range.
Rolling Updates : As time progresses, all asset prices are continually evaluated and the portfolio value is updated in real time.
Buy & Hold Returns : See how each asset—and the overall portfolio—performed from the “start” date to the most recent bar.
Annualized Return : Automatically calculates CAGR (Compound Annual Growth Rate) to help visualize performance over varying timescales.
3. Table & Visual Output
Performance Table : A comprehensive table displays individual asset returns, annualized returns, and portfolio totals.
Normalized Chart Plot : The composite ETF value is scaled to 100 at the start date, making it easy to compare relative growth or decline.
Optional Time Filter : You can define a specific date range (Start/End Dates) to focus on a particular period or to limit historical data.
⚙️ KEY FEATURES
1. Flexible Asset Selection
Choose any symbols from multiple asset classes. The script will only run calculations when data is available—no need to worry about missing quotes.
2. Dynamic Table Reporting
Start Price for each asset
Percentage Weight in the portfolio
Total Return (%) and Annualized Return (%)
3. Simple Backtesting Logic
This script takes a straightforward Buy & Hold perspective. Once the start date is reached, the portfolio remains static until the end date, so you can quickly assess hypothetical growth.
4. Plot Customization
Toggle the main “ETF” plot on/off.
Alter the visual style for tables and text.
Adjust the time filter to limit or extend your performance measurement window.
🚀 HOW TO USE IT
1. Add the Script
Search for “ETF Builder & Backtest System ” in the Indicators & Strategies tab or manually add it to your chart after saving it in your Pine Editor.
2. Configure Inputs
Enable Time Filter : Choose whether to restrict the analysis to a particular date range.
Start & End Date : Define the period you want to measure performance over (e.g., from 2019-12-31 to 2025-01-01).
Assets & Weights : Enter each symbol and specify a percentage weight (up to 10 assets).
Display Options : Pick where you want the Table to appear and choose background/text colors.
3. Interpret the Table & Plots
Asset Rows : Each asset’s ticker, weighting, start price, and performance metrics.
ETF Total Row : Summarizes total weighting, composite starting value, and overall returns.
Normalized Plot : Tracks growth/decline of the combined portfolio, starting at 100 on the chart.
4. Refine Your Strategy
Compare how different weights or a new mix of assets would have performed over the same period.
Assess if certain assets contribute disproportionately to your returns or volatility.
Use the results to guide allocations in your real trading or paper trading accounts.
❗️LIMITATIONS
1. Buy & Hold Only
This script does not handle rebalancing or partial divestments. Once the portfolio starts, weights remain fixed throughout the chosen timeframe.
2. No Reinvestment Tracking
Dividends or other distributions are not factored into performance.
3. Data Availability
If historical data for a particular asset is unavailable on TradingView, related results may display as “N/A.”
4. Market Regimes & Volatility
Past performance does not guarantee similar future behavior. Markets can change rapidly, which may render historical backtests less predictive over time.
⚠️ RISK DISCLAIMER
Trading and investing carry significant risk and can result in financial loss. The “ETF Builder & Backtest System ” is provided for informational and educational purposes only. It does not constitute financial advice.
Always conduct your own research.
Use proper risk management and position sizing.
Past performance does not guarantee future results.
This script is an original creation by TradeDots, published under the Mozilla Public License 2.0.
Use this indicator as part of a broader trading or investment approach—consider fundamental and technical factors, overall market context, and personal risk tolerance. No trading tool can assure profits; exercise caution and responsibility in all financial decisions.
Grid Bot Visualizer V1
📊 Grid Bot Visualizer – V1
A dynamic and visual support tool for grid trading strategies.
🔧 Key Features
• Fixed grid levels based on a central entry price
• Customizable spacing, number of levels, and range
• Color-coded lines (🟢 green above, 🔴 red below)
• Expands automatically when price exceeds boundaries (within the defined box)
• Optional price labels shown outside the grid
• Grid visually framed by a blue box
• Vertical line to mark grid origin
• Built-in alert when price hits a grid level
⚙️ Use Case
Ideal for visualizing grid bot logic in volatile markets.
Monitor how price interacts with predefined zones.
✅ Alert Ready
Use alertcondition to get notified when a grid level is touched.
Max RR CalculatorAutomatically calculates the maximum RR reached during trade. Entry is at the candle close. There is an option available that takes another trade after getting stopped out on the next candle that is in same bias as first trade.
(If the first trade is a long and gets stopped out, then the second trade will wait until the next up candle to enter long again)
Price Map Profile [BigBeluga]An advanced volume-based tool designed to map out how trading activity is distributed across price levels. It combines dynamic volume profiling with structural pivot detection to highlight key levels of interest in the market — including hidden support/resistance zones and dominant liquidity areas.
Unlike traditional volume profiles locked to fixed sessions, this indicator continuously processes historical bars to build a real-time "map" of volume distribution. It intelligently reveals where buyers and sellers were most active, helping traders pinpoint high-impact zones with clarity.
🔵 KEY FEATURES
Creates a volume map profile by scanning price action over a defined lookback window (`length`).
Divides price vertically into volume bins (default: 100) and aggregates either total volume or bar count per bin.
Bins are plotted as horizontal zones extending to the right of the chart — wider offset means more volume at that price.
Each zone is color-coded using gradients to represent volume magnitude:
- Below average volume = cool tones (blue/teal)
- Above average volume = warm tones (red/orange)
The highest volume bin is highlighted with a red label showing the exact volume, helping to identify strong price agreement.
Detects pivot highs and lows using a 15-bar swing method, marking them as potential S/R levels.
If a pivot level is located inside a low-volume zone (volume < average), it is emphasized with a dashed line and label .
Pivot line color matches direction:
- High pivots = yellow
- Low pivots = aqua
The volume of the bin containing the pivot is shown alongside the pivot, providing volume context for the structural level.
Filters out nearby duplicate pivots using ATR-based distance checks to ensure clean and non-redundant signals.
🔵 HOW TO USE
Use the wide red zones as liquidity and consolidation areas where price may stall, reverse, or absorb volume.
Pivot-based dashed lines within low-volume zones highlight hidden support/resistance levels where price may react sharply.
Combine this indicator with trend or order flow tools to validate reversal or breakout setups .
Switch between Volume and Frequency modes to adapt to the type of data your asset provides.
🔵 CONCLUSION
The Price Map Profile transforms raw volume into an actionable visual map. By aligning volume depth with key market structure levels, it helps traders identify where market participants are most active — and where hidden inefficiencies lie. Ideal for traders seeking precision entries, dynamic S/R zones, and deeper volume structure insight.
Prop Firm Business SimulatorThe prop firm business simulator is exactly what it sounds like. It's a plug and play tool to test out any tradingview strategy and simulate hypothetical performance on CFD Prop Firms.
Now what is a modern day CFD Prop Firm?
These companies sell simulated trading challenges for a challenge fee. If you complete the challenge you get access to simulated capital and you get a portion of the profits you make on those accounts payed out.
I've included some popular firms in the code as presets so it's easy to simulate them. Take into account that this info will likely be out of date soon as these prices and challenge conditions change.
Also, this tool will never be able to 100% simulate prop firm conditions and all their rules. All I aim to do with this tool is provide estimations.
Now why is this tool helpful?
Most traders on here want to turn their passion into their full-time career, prop firms have lately been the buzz in the trading community and market themselves as a faster way to reach that goal.
While this all sounds great on paper, it is sometimes hard to estimate how much money you will have to burn on challenge fees and set realistic monthly payout expectations for yourself and your trading. This is where this tool comes in.
I've specifically developed this for traders that want to treat prop firms as a business. And as a business you want to know your monthly costs and income depending on the trading strategy and prop firm challenge you are using.
How to use this tool
It's quite simple you remove the top part of the script and replace it with your own strategy. Make sure it's written in same version of pinescript before you do that.
//--$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$--//--------------------------------------------------------------------------------------------------------------------------$$$$$$
//--$$$$$--Strategy-- --$$$$$$--// ******************************************************************************************************************************
//--$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$--//--------------------------------------------------------------------------------------------------------------------------$$$$$$
length = input.int(20, minval=1, group="Keltner Channel Breakout")
mult = input(2.0, "Multiplier", group="Keltner Channel Breakout")
src = input(close, title="Source", group="Keltner Channel Breakout")
exp = input(true, "Use Exponential MA", display = display.data_window, group="Keltner Channel Breakout")
BandsStyle = input.string("Average True Range", options = , title="Bands Style", display = display.data_window, group="Keltner Channel Breakout")
atrlength = input(10, "ATR Length", display = display.data_window, group="Keltner Channel Breakout")
esma(source, length)=>
s = ta.sma(source, length)
e = ta.ema(source, length)
exp ? e : s
ma = esma(src, length)
rangema = BandsStyle == "True Range" ? ta.tr(true) : BandsStyle == "Average True Range" ? ta.atr(atrlength) : ta.rma(high - low, length)
upper = ma + rangema * mult
lower = ma - rangema * mult
//--Graphical Display--// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-$$$$$$
u = plot(upper, color=#2962FF, title="Upper", force_overlay=true)
plot(ma, color=#2962FF, title="Basis", force_overlay=true)
l = plot(lower, color=#2962FF, title="Lower", force_overlay=true)
fill(u, l, color=color.rgb(33, 150, 243, 95), title="Background")
//--Risk Management--// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-$$$$$$
riskPerTradePerc = input.float(1, title="Risk per trade (%)", group="Keltner Channel Breakout")
le = high>upper ? false : true
se = lowlower
strategy.entry('PivRevLE', strategy.long, comment = 'PivRevLE', stop = upper, qty=riskToLots)
if se and upper>lower
strategy.entry('PivRevSE', strategy.short, comment = 'PivRevSE', stop = lower, qty=riskToLots)
The tool will then use the strategy equity of your own strategy and use this to simulat prop firms. Since these CFD prop firms work with different phases and payouts the indicator will simulate the gains until target or max drawdown / daily drawdown limit gets reached. If it reaches target it will go to the next phase and keep on doing that until it fails a challenge.
If in one of the phases there is a reward for completing, like a payout, refund, extra it will add this to the gains.
If you fail the challenge by reaching max drawdown or daily drawdown limit it will substract the challenge fee from the gains.
These gains are then visualised in the calendar so you can get an idea of yearly / monthly gains of the backtest. Remember, it is just a backtest so no guarantees of future income.
The bottom pane (non-overlay) is visualising the performance of the backtest during the phases. This way u can check if it is realistic. For instance if it only takes 1 bar on chart to reach target you are probably risking more than the firm wants you to risk. Also, it becomes much less clear if daily drawdown got hit in those high risk strategies, the results will be less accurate.
The daily drawdown limit get's reset every time there is a new dayofweek on chart.
If you set your prop firm preset setting to "'custom" the settings below that are applied as your prop firm settings. Otherwise it will use one of the template by default it's FTMO 100K.
The strategy I'm using as an example in this script is a simple Keltner Channel breakout strategy. I'm using a 0.05% commission per trade as that is what I found most common on crypto exchanges and it's close to the commissions+spread you get on a cfd prop firm. I'm targeting a 1% risk per trade in the backtest to try and stay within prop firm boundaries of max 1% risk per trade.
Lastly, the original yearly and monthly performance table was developed by Quantnomad and I've build ontop of that code. Here's a link to the original publication:
That's everything for now, hope this indicator helps people visualise the potential of prop firms better or to understand that they are not a good fit for their current financial situation.
Advanced Momentum Scanner [QuantAlgo]The Advanced Momentum Scanner is a sophisticated technical indicator designed to identify market momentum and trend direction using multiple exponential moving averages (EMAs), momentum metrics, and adaptive visualization techniques. It is particularly valuable for those looking to identify trading and investing opportunities based on trend changes and momentum shifts across any market and timeframe.
🟢 Technical Foundation
The Advanced Momentum Scanner utilizes a multi-layered approach with four different EMA periods to identify market momentum and trend direction:
Ultra-Fast EMA for quick trend changes detection (default: 5)
Fast EMA for short-term trend analysis (default: 10)
Mid EMA for intermediate confirmation (default: 30)
Slow EMA for long-term trend identification (default: 100)
For momentum detection, the indicator implements a Rate of Change (RoC) calculation to measure price momentum over a specified period. It further enhances analysis by incorporating RSI readings for overbought/oversold conditions, volatility measurements through ATR, and optional volume confirmation. When these elements align, the indicator generates trading signals based on the selected sensitivity mode (Conservative, Balanced, or Aggressive).
🟢 Key Features & Signals
1. Multi-Period Trend Identification
The indicator combines multiple EMAs of different lengths to provide comprehensive trend analysis within the same timeframe, displaying the information through color-coded visual elements on the chart.
When an uptrend is detected, chart elements are colored with the bullish theme color (default: green/teal).
Similarly, when a downtrend is detected, chart elements are colored with the bearish theme color (default: red).
During neutral or indecisive periods, chart elements are colored with a neutral gray color, providing clear visual distinction between trending and non-trending market conditions.
This visualization provides immediate insights into underlying trend direction without requiring separate indicators, helping traders and investors quickly identify the market's current state.
2. Trend Strength Information Panel
The trend panel operates in three different sensitivity modes (Conservative, Aggressive, and Balanced), each affecting how the indicator processes and displays market information.
The Conservative mode prioritizes trend sustainability over frequency, showing only strong trend movements with high probability.
The Aggressive mode detects early trend changes, providing more frequent signals but potentially more false positives.
The Balanced mode offers a middle ground with moderate signal frequency and reliability.
Regardless of the selected mode, the panel displays:
Current trend direction (UPTREND, DOWNTREND, or NEUTRAL)
Trend strength percentage (0-100%)
Early detection signals when applicable
The active sensitivity mode
This comprehensive approach helps traders and investors:
→ Assess the strength of current market trends
→ Identify early potential trend changes before full confirmation
→ Make more informed trading and investing decisions based on trend context
3. Customizable Visualization Settings
This indicator offers extensive visual customization options to suit different trading styles and preferences:
Display options:
→ Fully customizable uptrend, downtrend, and neutral colors
→ Color-coded price bars showing trend direction
→ Dynamic gradient bands visualizing potential trend channels
→ Optional background coloring based on trend intensity
→ Adjustable transparency levels for all visual elements
These visualization settings can be fine-tuned through the indicator's interface, allowing traders and investors to create a personalized chart environment that emphasizes the most relevant information for their strategy.
The indicator also features a comprehensive alert system with notifications for:
New trend formations (uptrend, downtrend, neutral)
Early trend change signals
Momentum threshold crossovers
Other significant market conditions
Alerts can be customized and delivered through TradingView's notification system, making it easy to stay informed of important market developments even when you are away from the charts.
🟢 Practical Usage Tips
→ Trend Analysis and Interpretation: The indicator visualizes trend direction and strength directly on the chart through color-coding and the information panel, allowing traders and investors to immediately identify the current market context. This information helps in assessing the potential for continuation or reversal.
→ Signal Generation Strategies: The indicator generates potential trading signals based on trend direction, momentum confirmation, and selected sensitivity mode. Users can choose between Conservative (fewer but more reliable signals), Balanced (moderate approach), or Aggressive (more frequent but potentially less reliable signals).
→ Multi-Period Trend Assessment: Through its layered EMA approach, the indicator enables users to understand trend conditions across different lookback periods within the same timeframe. This helps in identifying the dominant trend and potential turning points.
🟢 Pro Tips
Adjust EMA periods based on your timeframe:
→ Lower values for shorter timeframes and more frequent signals
→ Higher values for higher timeframes and more reliable signals
Fine-tune sensitivity mode based on your trading style:
→ "Conservative" for position trading/long-term investing and fewer false signals
→ "Balanced" for swing trading/medium-term investing with moderate signal frequency
→ "Aggressive" for scalping/day trading and catching early trend changes
Look for confluence between components:
→ Strong trend strength percentage and direction in the information panel
→ Overall market context aligning with the expected direction
Use for multiple trading approaches:
→ Trend following during strong momentum periods
→ Counter-trend trading at band extremes during overextension
→ Early trend change detection with sensitivity adjustments
→ Stop loss placement using dynamic bands
Combine with:
→ Volume indicators for additional confirmation
→ Support/resistance analysis for strategic entry/exit points
→ Multiple timeframe analysis for broader market context
Vietnamese Stocks: Multi-Ticker Fibonacci AlertThis Pine Script™ indicator is designed specifically for traders monitoring the Vietnamese stock market (HOSE, HNX). Its primary goal is to automate the tracking of Fibonacci retracement levels across a large list of stocks, alerting you when prices breach key support zones.
Core Functionality:
The script calculates Fibonacci retracement levels (23.6%, 38.2%, 50%, 61.8%, 78.6%) for up to 40 tickers simultaneously. The calculation is based on the highest high and lowest low identified since a user-defined Start Time. This allows you to anchor the Fibonacci analysis to a specific market event, trend start, or time period relevant to your strategy.
What it Does For You:
Automated Watchlist Scanning: Instead of drawing Fib levels on dozens of charts, select one of the two pre-configured watchlists (up to 40 symbols each, customizable in settings) populated with popular Vietnamese stocks.
Time-Based Fibonacci: Define a Start Time in the settings. The script uses this date to find the subsequent highest high and lowest low for each symbol in your chosen watchlist, forming the basis for the Fib calculation.
Intelligent Alerts: Get notified via TradingView's alerts when the candle closing price of any stock in your active watchlist falls below the critical 38.2%, 50%, 61.8%, or 78.6% levels relative to its own high/low range since the start time. Alerts are consolidated for efficiency.
Visual Aids:
- Plots the same time-based Fibonacci levels directly on your current chart symbol for quick reference.
- Includes an optional on-chart table showing which monitored stocks are currently below key Fib levels (enable "Show Debug Info").
- Features experimental background coloring to highlight potential bullish signals on the current chart.
Configuration:
Start Time: Crucial input – sets the anchor point for Fib calculations.
WatchList Selection: Choose between WatchList #1 (Bluechip/Midcap focus) or WatchList #2 (Defensive/Other focus) using the boolean toggles.
Symbol Customization: Easily replace the default symbols with your preferred Vietnamese stocks directly in the indicator settings.
Notification Prefix: Add custom text to the beginning of your alert messages.
Alert Setup: Remember to create an alert in TradingView, selecting this indicator and the alert() condition, usually with "Once Per Bar Close" frequency.
This tool is open-source under the MPL 2.0 license. Feel free to use, modify, and learn from it.
Enhanced Execution ToolA comprehensive position sizing calculator for disciplined risk management
Description :
This tool provides traders with precise position sizing calculations based on their account parameters and market conditions. The indicator calculates optimal position sizes for different entry scenarios while maintaining strict risk control.
Key Features:
Multiple entry options (High, Close, Manual)
Flexible stop loss configuration (LoD or Previous Day Low)
Account-based risk management (1% risk by default)
ATR-based distance metrics for volatility assessment
Clear visual table displaying all critical trade parameters
How to Use:
Configure your account size and risk percentage
Select your preferred entry methods (High/Close/Manual)
Choose stop loss reference (Low of Day or Previous Day Low)
View calculated position sizes and risk parameters
For manual entries, input your desired entry and stop prices
Input Parameters:
Account Configuration: Set your capital and risk tolerance
Entry Options: Choose which entry methods to display
Stop Loss: Select stop loss reference level
Technical Settings: Adjust ATR length and distance limits
Display Options: Customize table appearance
Output Includes:
Risk amount in dollars
Risk as percentage of entry price
Entry to stop loss as percentage of ATR
Stop loss price
Entry price
Position size as % of account
Share quantity
Ideal For:
Traders who want to maintain consistent risk management
Those who need quick position sizing calculations
Investors who trade with multiple entry strategies
Note: Always verify calculations before executing trades. This tool is designed to assist with trade planning, not as trade advice.
AI-123's BTC vs Gold (Lag Correlation)
DISCLAIMER
I made this indicator with the help of ChatGPT and using what I have learned so far from The Pine Script Mastery Course, LOTS of edits based on what I have learned so far had to be made as well as additions and modifications to my liking thanks to what I have learned so far. I am aware this already exists but I have done my best to make a first ever script/indicator while learning how to properly publish as well, so please bear that in mind.
Overview
This indicator analyzes the correlation between Bitcoin (BTC) and Gold (XAUUSD), with a customizable lag applied to the Gold price, providing insight into the macro relationship between these two assets.
It is designed for traders and investors who want to track how Bitcoin and Gold move in relation to each other, particularly when Gold is lagged by a specific number of days.
Key Features:
BTC and Gold (Lagged) Price Overlay: Display Bitcoin (BTC) and Gold (XAUUSD) prices on the chart, with an adjustable lag applied to the Gold price.
Rolling Correlation Calculation: Measures the correlation between Bitcoin and lagged Gold prices over a customizable lookback period.
Adjustable Lag: The number of days that Gold is lagged relative to Bitcoin is fully customizable (default: 20 days).
Customizable Correlation Length: Allows you to choose the lookback period for the correlation (default: 50 days), providing flexibility for short-term or long-term analysis.
Normalized Plotting: Prices of Bitcoin and Gold are normalized for better visual alignment with the correlation values. BTC is divided by 1000, and Gold by 100.
Correlation Scaling: The correlation value is amplified by 10 for better visual clarity and comparison with price data.
Zero Line: Horizontal line representing a correlation of 0, making it easier to identify positive or negative correlation shifts.
Maximum Correlation Lines: Horizontal lines at +10 and -10 values for extreme correlation scenarios.
Input Settings:
Gold Symbol: Customize the Gold ticker (default: OANDA:XAUUSD).
Bitcoin Symbol: Customize the Bitcoin ticker (default: BINANCE:BTCUSDT).
Lag (in trading days): Adjust the number of trading days to lag the Gold price relative to Bitcoin (default: 20).
Correlation Length (days): Set the number of days over which the rolling correlation is calculated (default: 50).
How to Use:
Price Comparison: The BTC (Spot) and Lagged Gold plots give you a side-by-side visual comparison of the two assets, normalized for clarity.
Correlation Line: The correlation line helps you gauge the strength and direction of the relationship between BTC and lagged Gold. Positive values indicate a strong positive correlation, while negative values indicate a negative correlation.
Visual Analysis: Watch how the correlation shifts with changes in lag and correlation length to identify potential market dynamics between Bitcoin and Gold.
Potential Applications:
Macro Trading: Track how Bitcoin and Gold behave in relation to each other during periods of economic uncertainty or inflation.
Sentiment Analysis: Use the correlation data to understand the sentiment between digital and traditional assets.
Strategic Timing: Identify potential opportunities where Bitcoin and Gold show a strong correlation or diverge based on the lag adjustment.
Understanding Macro Trends/Correlations.
Disclaimer:
This indicator is for informational purposes only. The correlation between Bitcoin and Gold does not guarantee future performance, and users should conduct their own research and use risk management strategies when making trading decisions.
Notes: This script uses historical data, so results may vary across different timeframes.
Customization options allow users to adjust the lag and correlation length to better fit their trading strategy.
Future Enhancements: Additional Correlation Line: A second correlation line for different lengths of lag or different assets.
Color-Coding of Correlation: Future updates may include color-coded correlation strength, visually indicating positive or negative correlation more effectively.
NQ/MNQ Position Sizing
Despite having my own position sizing calculator in an excel sheet, the manual process of having to identify my next trade, switch tabs/screens, input my values into the sheet, go back into TV, input the trade parameters with appropriate contract sizing, has always really gotten to me. I also found that I would often miss ideal entries due to the delay this caused.
I searched TV for position sizing calculators but almost all the ones I found seemed to be similar: based on some form of manual input for the entry and stop parameters, many of which had way more settings and parameters than I needed, also over complicated things.
I just needed something that would allow me to dynamically set my entry and stop levels directly on the chart, and spit out the appropriate contracts I should be using, either on NQ or MNQ, to maintain my desired level of risk, so I could quickly execute the necessary trade.
So, I coded my own and it's been a huge help to me already, so I thought I may as well publish the script as can't imagine there aren't others out there that also hate the manual data entry process of calculating risk.
Upon first load, the script will ask you to set your Entry and Stop levels, before drawing respective lines for these on the chart, and calculating contract sizing based on your risk settings, which you can update directly. The reset values may be buggy, will be easier to just remove the script and re-apply it to your chart if you ever lose track of the levels you've set.
Hope it's useful.
Lot Size TableLot Size Table Indicator – Pine Script (v5)
This TradingView script, “Lot Size Table,” creates a dynamic on-chart table that helps forex traders quickly calculate position sizes (lot sizes) for different capital and risk settings across various stop-loss (SL) pip scenarios.
🔧 Key Features:
📊 Real-time Forex Price Integration
Retrieves daily forex prices from OANDA for accurate lot size adjustments.
Instruments supported: USDJPY, USDCHF, AUDUSD, GBPUSD, NZDUSD, USDCAD, EURUSD.
🧠 Smart Lot Size Adjustments
Custom function adjustLotSize() adjusts lot sizes based on:
The currency of the instrument (e.g., JPY, GBP, AUD, etc.).
Special multiplier for symbols like US30 (e.g., ×8.5).
🧾 Flexible Capital & Risk Inputs
Supports 3 customizable capital groups, each with its own:
Capital amount
Risk percentage
📉 Multiple Stop-Loss (SL) Scenarios
Users input a comma-separated list of SL pip values (e.g., "20,25,30,...").
For each SL value, lot sizes are calculated for all 3 capital/risk combinations.
📋 Formatted On-Chart Table
Displays in a user-selected corner of the chart.
Customizable size, background color, and border.
Header row includes capital values and risk % (formatted to "k" if over 1,000).
Remaining rows show calculated lot sizes for each SL pip value.
📐 How It Works:
User Inputs: Capital, risk %, SL pip list, and table styling.
Calculation:
Lot size = (capital × risk%) / (SL pips × 10)
Adjusted based on instrument’s currency.
Display:
Table shows all SL pip scenarios and the corresponding adjusted lot sizes for each capital group.
Drawdown Visualizer v1.0Drawdown Visualizer
The Drawdown Visualizer tracks the percentage decline from all-time highs, providing valuable insights into market corrections and potential buying opportunities.
Key Features:
1) Real-Time Drawdown Tracking: The indicator continuously calculates and displays the current percentage drawdown from the all-time high price, color-coded from green (minimal drawdown) to red (severe drawdown) for instant visual feedback.
2) Maximum Drawdown Detection: Permanently tracks and displays the maximum historical drawdown encountered during the analyzed period, helping traders understand worst-case scenarios.
3) Statistical Analysis: Calculates and displays three important statistical measures:
* Average Drawdown: The mean value of all drawdowns recorded
* Median Drawdown: The middle value in the sorted list of all drawdowns, providing insight
into typical decline patterns
* Normal Drawdown Range: Visualizes the expected range of typical drawdowns based on
statistical standard deviation
Practical Applications:
1) Risk Management: Understand typical and extreme drawdowns to set appropriate stop-loss levels
2) Market Context: Gain perspective on whether current corrections are normal or exceptional
3) Entry Point Analysis: Identify potential buying opportunities when drawdowns reach statistical extremes