20, 50, 200 MA Crossover### **Description of the 20, 50, 200 MA Crossover Script**
This script is a custom **Moving Average (MA) crossover indicator** designed for TradingView. It uses three moving averages: **20-day**, **50-day**, and **200-day**, and generates **Buy** and **Sell signals** based on specific crossover conditions.
#### **Features:**
1. **Moving Averages:**
- **20 MA (Short-Term):** Tracks short-term price trends (green line).
- **50 MA (Mid-Term):** Tracks medium-term trends (orange line).
- **200 MA (Long-Term):** Tracks long-term trends (blue line).
2. **Buy Signal:**
- Triggered when the **20 MA crosses above the 50 MA**, and the **50 MA is above the 200 MA**.
- Indicates a potential bullish trend.
3. **Sell Signal:**
- Triggered when the **20 MA crosses below the 50 MA**, and the **50 MA is below the 200 MA**.
- Indicates a potential bearish trend.
4. **Buy/Sell Labels:**
- Displays "Buy" and "Sell" labels directly on the chart at crossover points.
5. **Alerts:**
- Alerts can be enabled to notify you of Buy or Sell signals.
---
### **Use Cases:**
- Helps traders identify short-term and long-term trends.
- Useful for swing trading, day trading, or identifying key market movements.
- Provides visual and actionable signals directly on the chart.
This script is ideal for traders who want to automate trend detection using the popular 20, 50, and 200 moving averages. 🚀
Cycles
SPX Lin Reg with SD -1 +1 -2 +2 (Extented) V1.0Here is a script to plot a linear regression for a given period and add standard deviations.
Beardy Squeeze Pro (With high compression squeeze alert)Added high compression squeeze alert to the Beardy Squeeze Pro
Mahen Support and ResistanceSupport and Resistance to my learning purpose. It may not work for others. Feel free to tweak it according to your needs. This also modified from good soul
Previous Day High/LowThis Pine Script indicator plots the high and low of the previous trading day on the chart using horizontal lines.
Features:
The previous day's high is displayed as a green line.
The previous day's low is displayed as a red line.
These lines are automatically updated at the start of a new trading day.
EMA9_RSI_Strategy_LongShortกลยุทธ์นี้เป็นกลยุทธ์การเทรดโดยใช้ EMA (Exponential Moving Average) และ RSI (Relative Strength Index) ร่วมกับการตรวจสอบ RSI Divergence เพื่อลดโอกาสเกิดสัญญาณหลอก (false signals) ในการเข้าเทรดทั้งฝั่ง Long (ซื้อ) และ Short (ขาย)
21M SMA M2 Global/GOLD With OffsetA média móvel invertida de 21 meses da liquidez global em ouro apresentou alta correlação com BTC nos últimos períodos.
Rich's DikFat Money-Counter - ITM/OTM Options Price ViewerScript Overview
This Pine Script is a custom indicator designed for use on the TradingView platform. It analyzes options contracts, extracting key information from the options symbol, and then visualizes the relationship between the current price of the underlying asset and the option's strike price. Here’s a detailed explanation of the script and its components:
Key Features
Symbol Format Validation: The script checks whether the current symbol matches the expected format of an options symbol (like TSLA250131C400.0).
Extraction of Option Components: It extracts the base symbol (e.g., TSLA), expiration date (e.g., 250131), option type (C for call, P for put), and strike price (e.g., 400.0) from the options symbol.
Price Difference Calculation: It calculates the difference between the current price of the base asset (e.g., TSLA) and the option's strike price. Depending on whether the option is a call or put, the calculation is adjusted.
Visualization: The result is plotted on the chart, with color-coded filling to indicate whether the price difference is positive (ITM) or negative (OTM).
Detailed Explanation of Code Components
1. Indicator Definition
indicator("Rich's DikFat Money-Counter - In the Money/Out of the Money Options Price Viewer", shorttitle="Options Price Viewer", overlay=true)
This line defines the indicator's name, short title, and specifies that it should be plotted on the price chart (with overlay=true).
2. Symbol Detection
currentSymbol = syminfo.ticker
This retrieves the symbol of the current asset being analyzed. The script expects this symbol to be an options contract, for example, TSLA250131C400.0.
3. Symbol Format Validation
isOptionSymbol = str.length(currentSymbol) >= 9 and str.match(currentSymbol, "^ + {6} +(\. +)?$") != ""
This checks whether the current symbol matches the expected format for an option:
The symbol must have at least 9 characters.
It must follow a specific pattern: a base symbol (letters), a 6-digit expiration date, an option type (C for Call or P for Put), and a strike price that could include decimals.
[/list>
4. Extracting Option Components
If the symbol is a valid option symbol, the following code extracts the components:
baseSymbol := str.match(currentSymbol, "^ +")
expirationDate := str.substring(currentSymbol, str.length(baseSymbol), str.length(baseSymbol) + 6)
optionType := str.substring(currentSymbol, str.length(baseSymbol) + 6, str.length(baseSymbol) + 7)
strikePrice := str.substring(currentSymbol, str.length(baseSymbol) + 7, str.length(currentSymbol))
baseSymbol: Extracts the letters representing the stock symbol (e.g., TSLA).
expirationDate: Extracts the expiration date in the form of a 6-digit number (e.g., 250131).
optionType: Extracts the option type (C for Call, P for Put).
strikePrice: Extracts the strike price, which is the value after the option type (e.g., 400.0).
[/list>
5. Fetching the Base Symbol Price
baseSymbolClose = request.security(baseSymbol, "1", close)
This line uses the request.security() function to get the most recent close price of the base symbol (e.g., TSLA) on a 1-minute chart.
6. Converting the Strike Price to a Float
strikePriceFloat = na(strikePrice) ? na : str.tonumber(strikePrice)
Converts the strike price string to a numerical value (float). If the strike price is not available (i.e., na), it will not proceed with calculations.
7. Price Difference Calculation
priceDifference = baseSymbolClose - strikePriceFloat
This calculates the difference between the base symbol's close price and the strike price. For a Call option, this represents how much the stock price is above or below the strike price.
8. Adjusting for Put Options
if optionType == "P"
priceDifference := strikePriceFloat - baseSymbolClose
If the option is a Put, the price difference is reversed because a Put option becomes valuable when the stock price is below the strike price.
9. Plotting the Price Difference
priceDiffPlot = plot(priceDifference, title="Price Difference (Strike - Base)", color=color.blue, linewidth=2, style=plot.style_line, offset=0)
This line plots the calculated price difference as a blue line.
10. Zero Line Plot
zeroLinePlot = plot(0, "Zero Midline", color=color.white, linewidth=1, style=plot.style_line, offset=0)
This plots a white line at the zero level. This helps visually separate when the price difference is positive or negative.
11. Filling the Area Between the Price Difference and Zero Line
fill(priceDiffPlot, zeroLinePlot, color=color.new(priceDifference > 0 ? color.green : color.red, 70))
This fills the area between the price difference plot and the zero line:
Green if the price difference is positive (indicating the option is In the Money for Calls or Out of the Money for Puts).
Red if the price difference is negative (indicating the option is Out of the Money for Calls or In the Money for Puts).
Final Thoughts
This script is useful for traders and options investors who want to track the status of an option relative to the current price of the underlying asset. The green and red fill colors provide an immediate visual cue for whether the option is ITM or OTM. By applying this indicator on TradingView, users can easily see whether a particular option is valuable (ITM) or worthless (OTM) based on the current market price of the underlying asset. This makes it a valuable tool for quick decision-making in options trading.
ATT (3PM-6PM: 8PM-9PM UK) - TRADEWITHWILL
ATT (Advanced time theory) discovered by INuke (Tradewithwill)
The code will only show labels from 3pm to 6pm & 8pm to 9pm
(Only recommended on CME_MINI:NQ1! )
Simple Moving Averages by ComLucro - A/B/C/D/E - 2025_V03This script provides an easy-to-use tool for plotting Simple Moving Averages (SMA) on your TradingView chart. With customizable lengths, colors, and visibility options, you can tailor the script to fit your trading strategy and chart preferences.
Key Features:
Five Simple Moving Averages (SMA): A, B, C, D, and E, with default lengths of 10, 20, 50, 100, and 200 periods, respectively.
Fully Customizable:
Adjust SMA lengths to match your trading needs.
Customize line colors for easy identification.
Toggle visibility for each SMA on or off.
Clear and Intuitive Design: This script overlays directly on your chart, providing a clean and professional look.
Educational Purpose: Designed to support traders in analyzing market trends and identifying key price levels.
How to Use:
Add the indicator to your chart.
Configure the SMA lengths under the input settings. Default settings are optimized for common trading strategies.
Customize the colors to differentiate between the moving averages.
Toggle the visibility of specific SMAs to focus on what's important for your analysis.
Best Practices:
Use shorter SMAs (e.g., A and B) to identify short-term trends and momentum.
Use longer SMAs (e.g., D and E) to evaluate medium- to long-term trends and support/resistance levels.
Combine with other tools like RSI, MACD, or volume analysis for a more comprehensive trading strategy.
Disclaimer:
This script is for educational purposes only and does not constitute financial or trading advice. Always backtest your strategies and use proper risk management before applying them in live markets.
AI-Style Trading Strategy - Long OnlyThis strategy automatically buys you into various products. Each product has its own perfect stop loss and take profit values. You can get these on my discord. The strategy works best in the bull market but can also run continuously.
Crypto Market Caps / Global GDP %This indicator compares the total market capitalization of various crypto sectors to the global Gross Domestic Product (GDP), expressed as a percentage. The purpose of this indicator is to provide a visual representation of the relative size of the crypto market compared to the global economy, allowing traders and analysts to understand how the market is growing in relation to the overall economy.
Key Features
Crypto Market Caps -
TOTAL: Represents the total market capitalization of all cryptocurrencies.
TOTAL3: Represents the market capitalization of all cryptocurrencies, excluding Bitcoin and Ethereum.
OTHERS: Represents the market capitalization of all cryptocurrencies excluding the top 10.
Global GDP -
The indicator uses a combination of GDP data from multiple regions across the world, including:
GDP from the EU, North America (NA), and other regions.
GDP data from Asia, Latin America (LATAM), and the Middle East & North Africa (MENA).
Percentage Representation -
The market caps (TOTAL, TOTAL3, OTHERS) are compared to the global GDP, and the result is expressed as a percentage. This allows you to easily see how the size of the cryptocurrency market compares to the entire global economy at any given time.
Plotting and Visualization
The indicator plots the market cap to global GDP ratio for each category (TOTAL, TOTAL3, OTHERS) on the chart.
You can choose which plots to display through user inputs.
The percentage scale makes it easy to compare how much of the global GDP is represented by different parts of the crypto market.
Labels can be added for additional clarity, showing the exact percentage value on the chart.
How to Use
The indicator provides a clear view of the cryptocurrency market's relative size compared to the global economy.
Higher values indicate that the crypto market (or a segment of it) is becoming a larger portion of the global economy.
Lower values suggest the crypto market is still a smaller segment of the global economic activity.
User Inputs
TOTAL/GlobalGDP: Toggle visibility for the total market capitalization of all cryptocurrencies.
TOTAL3/GlobalGDP: Toggle visibility for the market cap of cryptocurrencies excluding Bitcoin and Ethereum.
OTHERS/GlobalGDP: Toggle visibility for the market cap of cryptocurrencies excluding the top 10.
Labels: Enable or disable the display of labels showing the exact percentage values.
Practical Use Cases
Market Sentiment: Gauge the overall market sentiment and potential growth relative to global economic conditions.
Investment Decisions: Help identify when the crypto market is becoming more or less significant in the context of the global economy.
Macro Analysis: Combine this indicator with other macroeconomic indicators to gain deeper insights into the broader economic landscape.
By providing an easy-to-understand percentage representation, this indicator offers valuable insights for anyone interested in tracking the relationship between cryptocurrency market cap and global economic activity.
HTF Hi-Lo Zones [CHE]HTF Hi-Lo Zones Indicator
The HTF Hi-Lo Zones Indicator is a Pine Script tool designed to highlight important high and low values from a selected higher timeframe. It provides traders with clear visual zones where price activity has reached significant points, helping in decision-making by identifying potential support and resistance levels. This indicator is customizable, allowing users to select the resolution type, control the visualization of session ranges, and even display detailed information about the chosen timeframe.
Key Functionalities
1. Timeframe Resolution Selection:
- The indicator offers three modes to determine the resolution:
- Automatic: Dynamically calculates the higher timeframe based on the current chart's resolution.
- Multiplier: Allows users to apply a multiplier to the current chart's timeframe.
- Manual: Enables manual input for custom resolution settings.
- Each resolution type ensures flexibility to suit different trading styles and strategies.
2. Data Fetching for High and Low Values:
- The indicator retrieves the current high and low values for the selected higher timeframe using `request.security`.
- It also calculates the lowest and highest values over a configurable lookback period, providing insights into significant price movements within the chosen timeframe.
3. Session High and Low Detection:
- The indicator detects whether the current value represents a new session high or low by comparing the highest and lowest values with the current data.
- This is crucial for identifying breakouts or significant turning points during a session.
4. Visual Representation:
- When a new session high or low is detected:
- Range Zones: A colored box marks the session's high-to-low range.
- Labels: Optional labels indicate "New High" or "New Low" for clarity.
- Users can customize colors, transparency, and whether range outlines or labels should be displayed.
5. Information Box:
- An optional dashboard displays details about the chosen timeframe resolution and current session activity.
- The box's size, position, and colors are fully customizable.
6. Session Tracking:
- Tracks session boundaries, updating the visualization dynamically as the session progresses.
- Displays session-specific maximum and minimum values if enabled.
7. Additional Features:
- Configurable dividers for session or daily boundaries.
- Transparency and styling options for the displayed zones.
- A dashboard for advanced visualization and information overlay.
Key Code Sections Explained
1. Resolution Determination:
- Depending on the user's input (Auto, Multiplier, or Manual), the script determines the appropriate timeframe resolution for higher timeframe analysis.
- The resolution adapts dynamically based on intraday, daily, or higher-period charts.
2. Fetching Security Data:
- Using the `getSecurityDataFunction`, the script fetches high and low values for the chosen timeframe, including historical and real-time data management to avoid repainting issues.
3. Session High/Low Logic:
- By comparing the highest and lowest values over a lookback period, the script identifies whether the current value is a new session high or low, updating session boundaries and initiating visual indicators.
4. Visualization:
- The script creates visual representations using `box.new` for range zones and `label.new` for session labels.
- These elements update dynamically to reflect the most recent data.
5. Customization Options:
- Users can configure the appearance, behavior, and displayed data through multiple input options, ensuring adaptability to individual trading preferences.
This indicator is a robust tool for tracking higher timeframe activity, offering a blend of automation, customization, and visual clarity to enhance trading strategies.
Disclaimer
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Best regards and happy trading
Chervolino
Close Difference of rolling candleThis is a modified version of FTFC concept.
FTFC concept look at HTF candle's direction, green or red.
This indicator calculate the closing price difference in a rolling base. For example, if now it is 3:05pm, it will show the price difference at closing between 3:05pm and 2:04pm if you use 60 mins as the setting. The moment it turn or green, it means in the last 1 hour, the candle is green. It is not tied to a time point of the HTF clock.
Monthly Drawdowns and Moves UP This script allows users to analyze the performance of a specific month across multiple years, focusing on maximum drawdowns and maximum upward moves within the selected month. The script offers the following features:
Dynamic Month Selection : Choose any month to analyze using an intuitive dropdown menu.
Maximum Drawdown and Upward Move Calculations :
Calculate the largest percentage drop (drawdown) and rise (move up) for the selected month each year.
Visual Highlights :
The selected month is visually highlighted on the chart with a semi-transparent overlay.
Dynamic Labels:
Labels display the maximum drawdown and upward move directly on the chart for better visualization.
Comprehensive Table Summary:
A table provides a year-by-year summary of the maximum drawdowns and upward moves for the selected month, making it easy to spot trends over time.
Customizable Display Options:
Toggle the visibility of drawdown labels, move-up labels, and the summary table for a clutter-free experience.
This tool is perfect for traders and analysts looking to identify seasonal patterns, assess risk and opportunity, and gain deeper insights into monthly performance metrics across years. Customize, explore, and make informed decisions with this powerful Pine Script indicator.
Master Bitcoin & Litecoin Stock To Flow (S2F) ModelMaster Bitcoin & Litecoin Stock-to-Flow (S2F) Model
This indicator visualizes the Stock-to-Flow (S2F) models for Bitcoin (BTC) and Litecoin (LTC) based on Plan B's methodology. It calculates S2F and projects price models for both assets, incorporating daily changes in circulating supply. The script is designed exclusively for daily timeframes.
Features:
LTC & BTC S2F Models:
Calculates Stock-to-Flow values for both assets using daily new supply and circulating supply data.
Models S2F values with a customizable multiplier for precise adjustments.
500-Day Moving Average Models:
Smoothens the S2F model by applying a 500-day (18-month) moving average, providing a long-term trend perspective.
Customizable Inputs:
Adjust LTC and BTC multipliers to fine-tune the models.
Alert for Timeframe:
Alerts users to switch to the daily timeframe if another period is selected.
Plots:
LTC S2F Model: Blue line representing Litecoin’s calculated S2F-based price model.
BTC S2F Model: Orange line representing Bitcoin’s calculated S2F-based price model.
500-Day Avg Models: Smoothened S2F models for both LTC and BTC.
Notes:
Requires daily timeframe (1D) for accurate calculations.
Supply data is sourced from GLASSNODE:LTC_SUPPLY and GLASSNODE:BTC_SUPPLY.
Disclaimer:
This model is derived from Plan B's S2F methodology and is intended for educational and entertainment purposes only. It does not reflect official predictions or financial advice. Always conduct your own research before making investment decisions.
Global M2 MonitorYoY change in M2s from US, China, Eurozone, and Japan.
US: 30% weight
China: 30% weight
Eurozone: 25% weight
Japan: 15% weight
These weights are approximations based on relative M2 sizes
Global M2 MonitorYoY change in M2s from US, China, Eurozone, and Japan.
US: 30% weight
China: 30% weight
Eurozone: 25% weight
Japan: 15% weight
These weights are approximations based on relative M2 sizes
GOLD H1 & H4 Candle TrackerIndikator Penanda Candle H1 & H4 adalah alat yang dirancang untuk menyoroti candle tertentu pada timeframe H1 dan H4 berdasarkan waktu tertentu, yaitu jam 07.00/08.00 dan 19.00/20.00.
Indikator ini bekerja dengan:
Memberi warna merah untuk candle jam 07.00.
Memberi warna biru untuk candle jam 19.00.
Memungkinkan penyesuaian offset waktu untuk menyesuaikan zona waktu broker dengan waktu lokal.
Indikator hanya aktif pada timeframe H1 dan H4, membantu trader mengidentifikasi candle penting pada waktu-waktu strategis untuk analisis pergerakan harga.
Previous Day's High and Low with Dotted LinesThis indicator shows you the Previous Day's High and Low