MITRAD Watermark - Hari Invest🚀 NOUVEAUTÉ POUR LA COMMUNAUTÉ ! 🎯
Je mets à disposition un watermark exclusif pour TradingView, conçu pour personnaliser et professionnaliser vos graphiques.
🔹 Qu’est-ce qu’un watermark ?
C’est un élément visuel (texte ou logo) intégré aux graphiques pour marquer votre identité, éviter le plagiat et renforcer votre branding.
✅ Ajoutez une signature unique à vos analyses
✅ Valorisez votre travail et votre identité visuelle
✅ Partagez vos graphiques avec une touche pro
📢 100% gratuit !
#MITRAD
#TradingView
#Watermark
Options
SpacemanBTC AlertsAllows the setting of alerts based on Spaceman BTC levels.
e.g. Set alerts on your watchlist each time price crosses daily high or low, weekly high or low etc.
CUSTOM_KKSThis indicator plots **six Exponential Moving Averages (EMAs)** (5, 9, 40, 50, 100, and 200) on the chart to help identify trends. It highlights **EMA crossovers** between the 5 EMA and 9 EMA, signaling potential buy or sell opportunities. Additionally, it **plots target price levels** after a crossover to help traders set profit-taking or stop-loss points. Clear **buy and sell signals** are displayed on the chart for better decision-making. 🚀📊
MOATH EMADversion one
touchesRedLine2 = not na(dojiLineDown2) and
(low <= line.get_y1(dojiLineDown2) and high >= line.get_y1(dojiLineDown2)) and
(open < line.get_y1(dojiLineDown2) and close > line.get_y1(dojiLineDown2)) and // تفتح تحت الخط وتغلق فوقه
(real_close > line.get_y1(dojiLineDown2)) and // إضافة شرط السعر الحقيقي فوق الخط الأحمر
(bar_index - dojiLineDownBarIndex2 <= 5) and // فقط خلال 5 شموع
not labelPlacedDown and // التأكد من أن الإشارة لم توضع مسبقًا
(((close > ema200 + pointDistance)and enableIndicator)or not enableIndicator) and
(((rsi<30 )and enableIndicator2)or not enableIndicator2) and is_stop_candle_down// الشرط الجديد: الشمعة فوق الـ EMA بمقدار نقطتين
if touchesGreenLine
label.new(bar_index, high, text="Sell", color=color.orange, textcolor=color.white, size=size.small, style=label.style_label_down)
labelPlacedUp := true
if touchesRedLine
label.new(bar_index, low, text="Buy", color=color.blue, textcolor=color.white, size=size.small, style=label.style_label_up)
labelPlacedDown := true // تم وضع الإشارة
if touchesGreenLine2
label.new(bar_index, high, text="Sell", color=color.orange, textcolor=color.white, size=size.small, style=label.style_label_down)
labelPlacedUp := true
if touchesRedLine2
label.new(bar_index, low, text="Buy", color=color.blue, textcolor=color.white, size=size.small, style=label.style_label_up)
labelPlacedDown := true // تم وضع الإشارة
alertcondition(touchesGreenLine or touchesRedLine or touchesGreenLine2 or touchesRedLine2 , title="Buy/Sell Alert", message="Signal detected: Buy or Sell")
var table statsTable = table.new(position.top_right, 1, 1, border_color=color.purple, bgcolor=color.new(color.black, 90))
table.cell(statsTable, 0, 0, "Moath Emad", text_color=color.white, bgcolor=color.black, text_size=size.auto)
محاسبه سود/ضرر بر اساس هر پیپاندیکاتور محاسبه قیمت
این اندیکاتور بر اساس پیپت و پیپ هایی که جفت ارزها و سایر شاخص ها جا به جا میشوند به شما نشان میدهد که چقدر در سود و ضرر میروید
Price Envelope+/- Variable price percentage (realtive to current share price) to assist with earnings release price targets, stop-limits, etc.
BTC Expected Volatility [Bruz]Bitcoin Implied Volatility Indicator
This indicator derives Bitcoin’s expected future volatility from options market data, using implied volatility as a key input.
No speculative analysis is performed — this is purely a visualization of market data. It assumes that implied volatility follows a normal distribution, with no skew or kurtosis.
Traders can use this indicator to analyze the variance of future price returns and identify historical periods of unexpectedly high volatility.
Disclaimer: This indicator is for informational and educational purposes only. It does not provide financial, investment, or trading advice. Past performance is not indicative of future results. Trading involves risk, and you should conduct your own research before making any investment decisions. The creator of this indicator is not responsible for any financial losses incurred through its use.
Enjoy and trade wisely!
SMA Crossover SignalThis Pine Script plots 5, 20, and 50-period simple moving averages and highlights trade signals. It shades the background green if the price is above the 50 SMA and red if below. A "BUY SIGNAL" appears only when the 5 SMA crosses above the 20 SMA while the background is green, and a "SELL SIGNAL" appears only when the 5 SMA crosses below the 20 SMA while the background is red.
HTF EMA Pivot PointsHTF EMA Pivot Points - TradingView Indicator
📌 Overview
The HTF EMA Pivot Points indicator displays Exponential Moving Averages (EMAs) from higher timeframes (HTF) on your current chart. These EMAs act as dynamic support and resistance levels, helping traders identify key areas where price is likely to react.
⚡ Key Features
✅ Plots EMAs from multiple timeframes (1H, 4H, Daily)
✅ Works on any chart (1M, 5M, 15M, etc.)
✅ Acts as pivot points for price action, helping with trade entries & exits
✅ Customizable EMA lengths for flexibility
✅ Ideal for scalping, 0DTE options trading, and swing trading
🛠 How It Works
The script calculates EMAs from 1H, 4H, and Daily charts and overlays them on your current timeframe. These levels often act as support and resistance zones, where price tends to bounce or reject.
🎯 How to Use It for Trading
📍 Bullish Setup (Buy Calls)
• Price bounces off a higher timeframe EMA (e.g., 4H or Daily EMA)
• Confirmation with RSI or Fair Value Gaps (FVGs)
📍 Bearish Setup (Buy Puts)
• Price rejects from a higher timeframe EMA
• Confirmation with other indicators (RSI, MACD, Order Flow)
🚀 Why Use This Indicator?
• Filters out noise from lower timeframe EMAs
• Confirms trend direction using key moving averages
• Helps avoid false breakouts by identifying strong institutional levels
This is a must-have tool for traders who rely on higher timeframe confluence for scalping, options trading, or swing trading. 📈🔥
Options Combined Premium StrategyOverview
The "Options Combined Premium Strategy" is a technical analysis indicator coded in Pine Script™ v5, designed for traders who wish to analyze options trading for various indices, such as NIFTY, BANKNIFTY, and others. The script focuses on calculating and visualizing combined premiums from both call and put options, enabling users to make informed trading decisions based on technical indicators.
Key Features:
1> Index Selection: Users can choose from multiple indices (e.g., NIFTY, BANKNIFTY).
2> Expiry Date Configuration: Inputs for specifying the expiry date of the options (day, month,
year).
3>Strike Prices: Allows users to input strike prices for both call (CE) and put (PE) options.
4>Strike Choice: The option to include combined premiums or choose to focus solely on either
calls or puts.
Data Retrieval:
The script retrieves historical price data (open, high, low, close) and volume for the specified call and put options using the generated symbol format, which is compliant with the naming conventions of options on supported exchanges.
Combined Premium Calculation:
Based on the user's selection (Combined, Only Call, Only Put), it computes the combined open, high, low, and close values for the selected options and derives the total volume. This is essential for understanding the overall market sentiment based on both options.
Technical Indicators:
The script offers the flexibility to integrate various commonly used technical indicators, including:
1)Exponential Moving Averages (EMA): To identify trends and potential reversals.
2)Supertrend: A trend-following indicator that helps define bullish and bearish trends.
3)Volume Weighted Average Price (VWAP): Averages price based on volume, providing insight
into price trends throughout the trading day.
4)Relative Strength Index (RSI): A momentum oscillator that measures the speed and change of
price movements, indicating overbought or oversold conditions.
5)Simple Moving Average (SMA): A traditional average used to smooth price data and confirm
trends.
Buy and Sell Signal Generation:
The script incorporates logic to generate buy and sell signals based on the selected indicators. It tracks the conditions for entering (buy) and exiting (sell) trades and executes these based on defined crossover strategies.
Visual Representation:
The combined premium is displayed as candlesticks on the chart, with color coding to differentiate between rising (green) and falling (red) prices.
Buy and sell signals are represented visually on the chart with up (buy) and down (sell) triangles for quick analysis.
Alert Conditions:
Users can set alert conditions for the generated buy and sell signals, allowing for timely notifications when market conditions meet specified criteria.
Conclusion:
This Pine Script provides a comprehensive framework for traders focusing on options strategies by calculating combined premiums and integrating various technical indicators. Its user-friendly interface allows customization, catering to individual trading styles. By leveraging this indicator, traders can enhance their market analysis and improve decision-making when trading options.
SPY EMA Envelope & Momentum StrategyIndicator Description:
This script combines the EMA Envelope (50) with RSI (14) and MACD (12, 26, 9) to identify optimal buy and sell signals based on price momentum.
Features:
✅ EMA Envelope (50): Defines dynamic support/resistance levels
✅ RSI (14): Identifies overbought/oversold conditions for confirmation
✅ MACD (12, 26, 9): Detects trend momentum shifts
✅ Buy Signals: Triggered when price touches the lower EMA Envelope, RSI is oversold, and MACD shows bullish crossover
✅ Sell Signals: Triggered when price reaches the upper EMA Envelope, RSI is overbought, and MACD shows bearish crossover
✅ Custom Alerts: Get notified when buy or sell conditions are met
Best For:
📈 Intraday & Swing Trading on SPY, stocks, crypto, and forex
RSI + EMA + MACD + StochasticThis indicator combines several popular technical analysis tools to generate Buy and Sell signals for binary options trading, especially on a 1-minute timeframe. It utilizes RSI (Relative Strength Index), EMA (Exponential Moving Averages), MACD (Moving Average Convergence Divergence), and the Stochastic Oscillator to provide a comprehensive market analysis and increase the reliability of trading signals.
Buy sell signals by Mahesh KolipakulaBased on the Exponential Moving Averages (EMA) with periods 5, 13, and 26: a buy signal will be generated when the 5-period EMA crosses above the 13-period and 26-period EMAs in upwards. Conversely, a sell signal will be triggered when the 5-period EMA crosses below the 13-period and 26-period EMAs in downwards.
EMA-based Trading Signal by GideonM for Indian MarketsAnother indicator for Indian Markets. Works best 5 mins on Nifty, Bank Nifty, Sensex.
How It Works:
Buy Signal: When the short-term EMA crosses above the long-term EMA and the momentum is positive, it suggests a bullish market, and a buy signal is generated.
Sell Signal: When the short-term EMA crosses below the long-term EMA and the momentum is negative, it suggests a bearish market, and a sell signal is generated.
You’ll see the EMA-based trading signals generated in real-time.
Adjustments:
You can adjust the window sizes for the short and long EMAs to fit your strategy.
You can also modify the momentum window to define how far back the momentum calculation should consider.
Experiment with the logic (e.g., adding more conditions) to fine-tune the signals.
This indicator should give you a responsive indicator that reacts quickly to price movements by using EMA crossovers and momentum as predictive features.
Good luck!!
Monthly Options Expiration 2025Monthly Options Expiration 2025
Plots the monthly options expiration dates in advance for the year 2025.
Happy trading and all the best.
AllDay Session TimesIndicator: Custom Session Times
This indicator is designed to assist traders by visualizing specific trading session times on the TradingView platform. It highlights two important trading sessions: the Day Session and the Evening Session, providing a visual aid that helps traders navigate the markets with greater accuracy.
Day Session Time Range:
Starts: 10:55 UTC+2
Ends: 13:30 UTC+2
Evening Session Time Range:
Starts: 16:55 UTC+2
Ends: 18:30 UTC+2
How It Works:
Colors and Backgrounds: This indicator uses background colors to differentiate the sessions. The green background appears during the Day Session, while the blue background indicates the Evening Session.
Lines: Session time ranges are also marked with clear lines on the chart, making it easier to identify the specific session periods.
Time Zone: The time zone is set to UTC+2 (Europe/Helsinki), but it can easily be adjusted to match your local time zone.
Why Use This Indicator?
This indicator is especially useful for traders who focus on specific market sessions. For example:
The Day Session might be when the market is more active, and trends are clearer.
The Evening Session could be a good time to observe market adjustments based on the events of the day and find potential trading opportunities.
By visualizing these specific time frames, the indicator helps reduce distractions and enables a more focused approach to trading.
Use Cases:
This indicator is ideal for:
Day traders and swing traders who want to focus on certain market sessions.
Technical analysts who prefer to visualize market behavior within specific time frames.
Strategy optimization and a more precise assessment of market conditions.
Features:
Visual session markers that help traders focus on key trading periods.
Easy customization of time zone and session time ranges.
Background colors and lines that improve chart readability and session tracking.
Made By AllDayEsa
Weekly Change(Green&Red) & Percentage Change(Blue&Yellow)Display bar chart of weekly price action. Use to determine the maximum price change in one week. It would be the possible strike price for a covered call option for weekly income.
WD Gann: Vertical Lines for Predefined Days/Bars AgoThis Pine Script draws vertical lines on the chart at specific time intervals, inspired by WD Gann’s theories of time cycles . WD Gann, a famous trader, believed that market movements were influenced by predictable time cycles. This script enables traders to visualize these key time cycles on the chart by placing vertical lines at predefined intervals (in bars ago), helping to identify potential turning points in the market.
The time intervals used in this script are inspired by Gann’s work, as well as astrological and numerological principles , which many traders believe influence market behavior . You can customize which time intervals (such as 3, 7, 9, 21, etc.) you want to track by enabling or disabling specific vertical lines on the chart.
Key Features:
Time Cycles Based on Gann’s Theory: Draws vertical lines at significant time intervals such as 3, 7, 9, 21, 27 bars ago, which are commonly used by Gann traders.
Astrological & Numerological Significance: The predefined intervals also align with key numerological and astrological values, allowing for a broader perspective on market cycles.
Customizable Intervals: You can choose which time intervals to display by enabling or disabling checkboxes for each cycle, allowing flexibility in chart analysis.
Visual Labels: Each vertical line is labeled with its corresponding "bars ago" value, providing clear reference points for the selected time cycles.
What Users Can Do:
Track and analyze market movements based on time cycles that are significant to Gann’s theory, as well as numerological and astrological influences.
Enable or disable vertical lines for specific cycles, like the 3-bar cycle, 9-bar cycle, or 365-bar cycle, depending on the intervals that align with your trading strategy.
Combine with other technical analysis tools and Gann techniques (e.g., Gann Angles, Gann Fans, or Square of Nine) for a more comprehensive trading approach.
This tool is designed for traders who believe in the power of time cycles to influence market behavior, and is especially useful for predicting turning points or key price movements based on these cycles.
Precision Trade Zone By KittisakThis indicator is designed for Money Management calculations, helping to facilitate risk management in trading, determining suitable leverage based on acceptable risk, and adjusting the Stop Loss level to align with the calculated leverage.
Abbreviation Descriptions
LR : Suitable Leverage.
EP : Entry Price.
BEP : Break-Even Point (a point where you can move your Stop Loss to prevent losses once the price reaches a certain level).
SL : Stop Loss (a recalculated Stop Loss level to match the leverage. You should use this as the Stop Loss price instead of the initial level you set).
TP : Take Profit (a point where you take profit based on the defined risk-reward ratio).
Note
When first activating the indicator, an error may occur, and no output will be displayed. This happens because you must first specify the Entry Price and Stop Loss in the indicator settings.
How Much Leverage Should You Use?
It may seem like a simple question but is difficult to answer.
Method for Calculating Suitable Leverage
Use the formula:
Leverage = Acceptable Loss / (Distance between Entry Price and Stop Loss + (Buy Fee + Sell Fee))
Calculating the Correct Stop Loss Point
(Stop Loss levels will be slightly adjusted or extended)
For Long Positions :
New Stop Loss = Entry Price * (1 - Acceptable Loss / (Calculated Leverage * 100))
For Short Positions :
New Stop Loss = Entry Price * (1 + Acceptable Loss / (Calculated Leverage * 100))
Calculating the Correct Take Profit Point
(Take Profit levels will be slightly adjusted or extended)
For Long Positions :
Take Profit = Entry Price * (1 + (Acceptable Loss / (Calculated Leverage * 100) * RR) + ((Buy Fee + Sell Fee) / 100))
For Short Positions :
Take Profit = Entry Price * (1 - (Acceptable Loss / (Calculated Leverage * 100) * RR) + ((Buy Fee + Sell Fee) / 100))
Benefits of This Calculation
1. Accurate Risk Assessment
The calculated leverage accounts for trading fees. For example, if you aim for a 2% loss, this method ensures the actual loss is exactly 2%, not more (e.g., 2% plus fees).
2. Eliminates Guesswork
Randomly setting leverage can lead to risks because the Stop Loss level may not align with your position. This calculation ensures that the leverage aligns precisely with your desired Stop Loss level.
3. Realistic Profit Targets
For example, with a 2% acceptable loss and a 1:2 RR, you expect a 4% profit. However, without this calculation, fees may reduce your profit below 4%. This method includes fees, ensuring your profit matches the intended target.
Caution
This indicator does not account for slippage or requotes. Use it with caution and allow a buffer for slippage in your calculations.
Indicator นี้มีไว้สำหรับคำนวณ Money Management ซึ่งจะช่วยอำนวยความสะดวกในการจัดการความเสี่ยงในการเทรด การคำนวณ Leverage ที่เหมาะสมกับความเสี่ยงที่คุณยอมรับได้ และจัดการจุด Stop Loss ให้เหมาะสมกับ Leverage นั้น
คำอธิบายเกี่ยวกับคำย่อ
LR หมายถึง Leverage ที่เหมาะสม
EP หมายถึง Entry Price หรือราคาเข้าซื้อ
BEP หมายถึง Break-Even Point หรือจุดคุ้มทุน (คุณสามารถย้าย Stop Loss มาที่จุดนี้เมื่อราคาไปถึงจุดหนึ่งเพื่อป้องกันการขาดทุนได้)
SL หมายถึง Stop Loss (ซึ่งเป็น Stop Loss ที่คำนวณใหม่เพื่อให้ตำแหน่งเหมาะสมกับ Leverage ที่คำนวณได้ คุณควรใช้จุดนี้เพื่อเป็นราคา Stop Loss แทนจุด Stop Loss ที่คุณกำหนดไว้ในตอนแรก)
TP หมายถึง Take Profit (เป็นจุดที่คุณจะขายทำกำไรตาม RR ที่กำหนดไว้)
* หมายเหตุ เมื่อเริ่มเปิด Indicator จะเกิด Error ขึ้น และไม่มีผลลัพท์ใด ๆ แสดงให้เห็น นั่นเป็นเพราะคุณต้องเข้าไปกำหนด Entry Price และ Stop Loss ในการตั้งค่าของ Indicator เสียก่อน
ต้องใช้ Leverage เท่าไหร่? มันเป็นคำถามที่ดูเหมือนง่าย แต่ตอบยาก
วิธีคำนวณ Leverage ที่เหมาะสม ใช้สมการคือ
Levarage = การขาดทุนที่ยอมรับได้ / (ระยะห่างระหว่าง Entry Price และ Stop Loss + (ค่าธรรมเนียมซื้อ + ค่าธรรมเนียมขาย))
นำผลลัพท์ Leverage ที่ได้มาคำนวณเพื่อหาจุด Stop Loss ที่ถูกต้อง (จุดของ Stop Loss จะมีการยืดขยายออกไปเล็กน้อย) โดยใช้สมการ
ตำแหน่ง Stop Loss ใหม่ = Entry Price * (1 - การขาดทุนที่ยอมรับได้ / (Leverage ที่คำนวณได้ * 100)) // สำหรับ Long
ตำแหน่ง Stop Loss ใหม่ = Entry Price * (1 + การขาดทุนที่ยอมรับได้ / (Leverage ที่คำนวณได้ * 100)) // สำหรับ Short
นำผลลัพท์ Leverage ที่ได้มาคำนวณเพื่อหาจุด Take Profit ที่ถูกต้อง (จุดของ Take Profit จะมีการยืดขยายออกไปเล็กน้อย) โดยใช้สมการ
ตำแหน่ง Take Profit = Entry Price * (1 + (การขาดทุนที่ยอมรับได้ / (Leverage ที่คำนวณได้ * 100) * RR) + ((ค่าธรรมเนียมซื้อ + ค่าธรรมเนียมขาย) / 100)) // สำหรับ Long
ตำแหน่ง Take Profit = Entry Price * (1 - (การขาดทุนที่ยอมรับได้ / (Leverage ที่คำนวณได้ * 100) * RR) + ((ค่าธรรมเนียมซื้อ + ค่าธรรมเนียมขาย) / 100)) // สำหรับ Short
ข้อดีของการคำนวณคือ
1. คุณจะได้ค่า Leverage ที่เหมาะสมกับความเสี่ยงที่คุณยอมรับได้โดยรวมค่าธรรมเนียมเข้าไปในนั้นแล้ว นั่นหมายความว่า ความสูญเสียจะเป็น 2% (ตามตัวอย่าง) จริง ๆ ไม่ใช่ 2% และถูกหักค่าธรรมเนียมเพิ่มอีก กลายเป็นสูญเสียมากกว่า 2%
2. การตั้ง Leverage มั่ว ๆ กลายเป็นความเสี่ยง นั่นเพราะตำแหน่งของ Stop Loss ไม่ได้อยู่ในจุดที่ควรจะเป็น การคำนวณนี้ช่วยให้คุณได้ Leverage ในตำแหน่ง Stop Loss ที่คุณต้องการโดยแท้จริง
3. ผลกำไรที่ได้รับตรงกับความต้องการจริง ๆ เช่น การขาดทุนที่ยอมรับได้ 2% และ RR 1:2 สิ่งที่คุณคิดคือกำไร 4% แต่จริง ๆ แล้วไม่ถึง 4% นั่นเพราะว่าโดนหักค่าธรรมเนียมไปส่วนหนึ่ง การคำนวณนี้ได้รวมค่าธรรมเนียมให้แล้ว คุณจึงได้กำไรที่ 4% อย่างถูกต้องตามต้องการ
ข้อควรระวัง
Indicator นี้ไม่ได้มีการควบคุมความเสี่ยงในเรื่องของ slippage หรือ requote โปรดใช้งานอย่างระมัดระวังและมีการเผื่อระยะสำหรับ slippage ด้วย
Best of Option Indicator - Manoj WadekarPlot this indicator for both CALL and PUT options and buy only when color of candle is YELLOW and above BLACK line.
Options Levels Support and ResistanceAre you sometimes clueless of where you are going to find support or resistance for the stock price? Nothing can be more powerful than market positioning via options levels.
This indicator visualizes key institutional options levels including short-term and longer-term Put/Call Walls, and projected implied move ranges.
Key Features:
Displays major support/resistance levels derived from options data
Shows institutional Put Walls (PW) and Call Walls (CW) - areas of significant options activity
Identifies short-term and longer-term gamma levels for more precise trading
Includes an option statistics (IV, Put/Call ratio, trend) in a clean dashboard
Automatically(*) updates throughout the trading day to reflect current market positioning
Currently supporting 440 of the most popular tickers.
Presents gamma flip levels for indexes SPX, RUT, NDX and VIX
Trading Applications:
Identify key price levels where institutional options activity may influence price movement
Gauge market sentiment through IV levels, Put/Call ratios, and options positioning
Plan entries/exits around major Put/Call walls where price reversals are more likely
Monitor changes in institutional positioning through level trends
Levels are calculated externally using comprehensive options data and updated into the indicator multiple times per day. Note that I can't guarantee it will be timely updated since TradingView offers no access to external data nor a way to programmatically update the script.
This code simply renders the levels I calculate using external software. I had to make the code as short as possible to accommodate more tickers, reason why there is no commenting.
The last update time (New York/EST) is shown in the dashboard.
OHOL_VWAP_STIts all about OH and OL concept for Nifty Future.
1.When OH candle formed and breaks the high we can enter the position, candle should be below supertrend , moving average and vwap .
2..When OL candle formed and breaks the high we can enter the position, candle should be above supertrend , moving average and vwap .
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.