Session Levels Predictor [LuxAlgo]The "Session Levels Predictor" indicator predicts the maximum/minimum levels that will be made within a user-specified session. Hit rate percentages are displayed to measure how often a specific level has been hit.
🔶 USAGE
The indicator can be used to estimate the expected maximum/minimum levels within a specified session, these are directly displayed at the start of a session. This operation can be useful to set take profits/stop losses levels when we expect to exit within a specific session.
Users can display up to 3 upper and lower extremities on their chart (by default only 2 upper and lower extremities are displayed), with their distance from the session opening price being determined by the user-set percentile setting, values closer to 100 will return levels farther away from the session opening price.
Predicting maximum/minimum levels effectively allows obtaining support/resistance levels for the user-defined session, with a breakout probability indicating how easy it can be for the price to reach the estimated levels. These levels can be extended outside the specified session, allowing to test their relevancy as support/resistance levels to prices outside the specified sessions.
🔶 DETAILS
To predict maximum/minimum levels made within a session we keep a record of the distance between a session's maximum/minimum value and the session opening price (opening price when the session starts).
By using the percentile_nearest_rank() on our recorded distances we draw levels from the session opening price. If a level is hit between 2 sessions, this is saved for further calculations.
Lastly, a % hit rate of these levels is shown at the sessions open, indicating the probability that these levels could be hit before the next session.
🔹 array.percentile_nearest_rank()
Returns the value for which the specified percentage of array values (percentile) is less than or equal to it, using the nearest-rank method.
For example, taking the 75th percentile from our recorded distances between the maximum session level and session opening price will return a new distance where 75% of the recorded distances are lower.
The same goes for the green session's open - low levels
🔶 SETTINGS
Session: User-defined session interval, uses the symbol timezone.
Percentile (1, 2, 3): K-th percentile used to estimate session max/min levels, higher values will return more distant levels.
Max Population: Maximum amount of recorded distance data for the calculation of percentiles.
🔹 Style
Extend Middle Line: Toggle to extend the blue Middle Line to the next session - Default disabled
Educational
QuantumTrader Suite - Chart WatermarkThis "Indicator" allows you to add a watermark to your chart. This allows you to add things such as your name and trading goals / affirmations to your chart to remind you everytime you load up the charts.
The following Features are fully customisable:
Title
Subtitle
Position, Text Size, Text Color, and Background of the title and subtitle
Day Coloring @shrilssDay Coloring Indicator, A tool designed to bring visual clarity to your charts by dynamically coloring the background based on the day of the week. This script adds a layer of organization to your charts, making it easier for traders to track and analyze market movements on different weekdays.
Key Features:
- Customizable Timezone:
Choose from a range of timezones, including popular ones like New York, Los Angeles, Chicago, Phoenix, Vancouver, Santiago, and Mexico City.
- Intuitive Background Coloring:
Each weekday is assigned a distinctive background color, allowing for quick identification and differentiation between different trading days.
Portfolio Management [TrendX_]Portfolio Management is a powerful tool that helps you create and manage your own portfolio of stocks, based on your risk and return preferences.
*** Note: You should select the appropriate index for each stock as the benchmark to compare your portfolio’s performance.
*** Note: You should apply the indicator to the same chart as the benchmark, so that it can capture the historical trends of all the 10 stocks in your portfolio.
USAGE
Analyze your portfolio’s return factor, which shows the compound annual growth rate (CAGR) of each stock and the portfolio as a whole, as well as the weight of each stock in the portfolio.
The Weighting approach contains 2 options, Equal and Growth-based method:
Customize your portfolio by selecting up to 10 stocks from a wide range of markets and sectors:
Compare your portfolio’s performance with a benchmark of your choice, which is the S&P500 by default setting.
Evaluate your portfolio’s risk factor, which includes the capital asset pricing model (CAPM), the portfolio beta, and the Sharpe ratio of both the portfolio and the benchmark:
- CAPM is a model that calculates the expected return of the portfolio based on its risk and the risk-free rate of return.
- Portfolio beta is a measure of how sensitive the portfolio is to the movements of the benchmark. A beta of 1 means the portfolio moves in sync with the benchmark, a beta of less than 1 means the portfolio is less volatile than the benchmark, and a beta of more than 1 means the portfolio is more volatile than the benchmark.
- Sharpe ratio measures how much excess return the portfolio generates per unit of risk. It is calculated by subtracting the risk-free rate of return from the portfolio’s return, and dividing by the portfolio’s standard deviation. A higher Sharpe ratio means the portfolio has a better risk-adjusted return. A Sharpe ratio of more than 1 is considered good, a Sharpe ratio of more than 2 is considered very good, and a Sharpe ratio of more than 3 is considered excellent .
Adjust your portfolio’s rebalancing strategy, which determines when and how to change the weight of each stock in the portfolio to optimize your return and risk objectives. The tool also suggests a default hedging-stock asset, which is the US dollar interpreted through the dollar index (DXY):
- The dollar index is a measure of the value of the US dollar relative to a basket of other major currencies. It is often used as a proxy for the global economic sentiment and the demand for safe-haven assets. A rising dollar index means the US dollar is strengthening, which may indicate a bearish outlook for the stock market. A falling dollar index means the US dollar is weakening, which may indicate a bullish outlook for the stock market.
- The rebalancing strategy suggest increasing the weight of the hedging-stock asset when the dollar index is under positive supertrend condition, and decreasing the weight of the hedging-stock asset when the dollar index is in the downward supertrend. This way, you can hedge against the adverse effects of the stock market fluctuations on your portfolio, simply you can just cash out at the suggested hedging weight.
CONCLUSION
Investors can gain a deeper insight into their portfolio’s performance, risk, and potential, and make informed decisions to achieve their financial goals with confidence and ease.
DISCLAIMER
The results achieved in the past are not all reliable sources of what will happen in the future. There are many factors and uncertainties that can affect the outcome of any endeavor, and no one can guarantee or predict with certainty what will occur.
Therefore, you should always exercise caution and judgment when making decisions based on past performance.
Table to filter trades per dayThis script contains a block of code that allows users to filter the total number of trades, loss trades, win trades and win rate per day in a table. This makes it easier to compare which days were profitable and which were not.
Be aware that this script can only be used in strategy scripts. To use the script, open it and copy every line from "START" to "STOP". Then, paste these lines at the very bottom of the strategy script that you want to attach it to.
The user has the ability to adjust the position of the table and customize the size of the text displayed.
If the user sets "Check when the trade:" to "Opened", the script will monitor when the trade opens and add it to the table once it has been closed. If "Check when the trade:" is set to "Closed", the script will track when the trade is closed and add it to the table once it has been closed.
It is recommended to run the script on the "Exchange" setting for more accurate results, even though a "Set the timezone" option is available. This will prevent discrepancies caused by daylight saving time changes.
Please note that the code will only work properly if you choose a daily timeframe or lower.
Session Sweeps [LuxAlgo]The Session Sweeps indicator combines ICT-based features for a complete trading methodology involving market sessions, market structure, and fair value gaps to find optimal entry conditions for trading price action.
Traders frequently tend to place stop/limit orders at the high and low points of major trading sessions such as Asian (Tokyo), European (London), and North American (New York), resulting in the establishment of liquidity pools at those particular levels. The Session Sweeps indicator is crafted to recognize and underscore occurrences of session sweeps or liquidity sweeps during these major trading sessions.
🔶 USAGE
Default settings utilize major forex trading sessions, yet users can select their preferred opening and closing times, rename the sessions, or adjust the colors. It's important to note that the specified times for each session align with the respective local timezones: Asian (Tokyo) UTC+9, European (London) UTC, and North American (New York) UTC-5.
If the price briefly crosses either the highest or lowest point of a market session. These movements, aiming at triggering stop losses, suggest potential shifts in the market direction. Detecting such movements is the fundamental purpose and core functionality of the script.
🔹Market Structure Shifts
A Market Structure Shift refers to a change in market direction, either from an uptrend to a downtrend or vice versa. A part of a common entry model when using session sweeps is waiting for the formation of a CHoCH after a session sweep.
🔹Fair Value Gaps
A Fair Value Gap (FVG) holds particular appeal for price action traders, emerging when there are inefficiencies or imbalances in the market, often a result of uneven buying and selling activity. The underlying concept of FVGs is that the market tends to revisit these inefficiencies before resuming its trajectory in alignment with the initial impulsive move.
After the formation of a CHoCH traders can enter a position when the price enters the area of a Fair Value Gap (FVG).
🔹Setup Examples
This entry setup is commonly used by ICT traders and is shared for informational & educational purposes only.
Long Positions (5-Minute Timeframe):
Wait for the previous session's low to be swept.
Look for a Bullish Choch.
Find a Bullish FVG formed by or before the Choch.
Entry Point: At the FVG.
Take Profit (TP): At the session high or aim for a 1:2 Risk-Reward Ratio.
Stop Loss (SL): At the session low or nearest Swing Low.
Take partial profits at intermediate swings, but don’t shift SL prematurely.
Short Positions (5-Minute Timeframe):
Wait for the previous session's high to be swept.
Look for a Bearish Choch.
Find a FVG formed by or before the Choch.
Entry Point: At the FVG.
Take Profit (TP): At the previous session's low or aim for a 1:2 RR.
Stop Loss (SL): At the session high or nearest Swing High.
Take partial profits at intermediate swings, but don’t shift SL prematurely.
🔶 SETTINGS
🔹Session Sweeps
Buyside Sweep Zones, Color, and Margin: toggles the visibility of bullside sweep zones, customizes the associated color, and sets the margin value defining the range of a bullside sweep zone.
Sellside Sweep Zones, Color, and Margin: toggles the visibility of sell-side sweep zones, customizes the associated color, and sets the margin value defining the range of a sell-side sweep zone.
Sweep Margin Length: specifies the maximum allowed length of a sweep zone invalidation, the length over which the price slightly invalidated the margin range.
Detect Sweeps Once per Session: if enabled will detect only once a sweep zone within a session.
Hide Fake Sweep Zones, and Color: controls the visibility and color of the fake sweep zones.
🔹Sessions
Session (Asia, London, New York AM, and New York PM), Start Time, and End Time: enables or disables the visibility of the named market session range, and customization of the session hours.
Color: color customization option of the named session.
Extend Max/Min: extends the highest and lowest price levels of the named session until the end of the next enabled session. This option is recommended to be enabled when sweep zone detection is activated to observe the relationship between the sweep zone and previous session extreme levels.
Extend Mid: extends the mean price levels of the named session until the end of the next enabled session. The extended line may serve as potential support and resistance levels.
Fill: enables/disables background coloring of the named session.
New York DST | London DST: enabling this option initiates Daylight Saving Time (DST) for New York or London. Note: Daylight Saving Time is not applied to the Asian (Tokyo) session.
Sessions Extreme Lines | Sessions Names: toggles the visibility of the highest and lowest price levels, as well as the names, for all market sessions.
Session Lines Width: sets the width of the lines for all sessions.
Session Fill Transparency: sets the background color transparency of the range for all sessions.
🔹Market Structure Shifts
Market Structure Shifts: toggles the visibility of market structure shifts, also known as change of character (CHoCH).
Detection Length: specifies the detection length.
Market Structure Shifts; Bull & Bear: color customization options.
🔹Fair Value Gaps
Fair Value Gaps: toggles the visibility of the fair value gaps.
Fair Value Gap Width Filter: specifies the filtering multiplier; additional details can be found in the tooltip of the respective input option.
Bullish & Bearish Imbalance: color customization options.
🔹Sessions Tabular View
Sessions Tabular View: toggles the visibility of the tabular view of the sessions, displaying date &time, status, and countdown counter.
Hide if not Forex Market Instrument: checks the market and automatically enables/disables the option based on the market instrument.
Table Text Size & Position: size and placement customization options
🔶 LIMITATIONS
Please be aware that fair value gap filtering cannot be applied to the initial 144 candles (with a fixed-length ATR) as the ATR value necessary for filtering won't be available during this period.
🔶 RELATED SCRIPTS
Buyside-Sellside-Liquidity
Sessions
Liquidity-Voids-FVG
Thank you to our community for the recommendation of this script. To explore additional conceptual scripts and related content, we invite you to visit >>> LuxAlgo-Scripts .
SRC Helper IndicatorsShows closest support / resistance level from current price and distance in pips.
ICT Unicorn Model [LuxAlgo]The ICT Unicorn Model indicator highlights the presence of "unicorn" patterns on the user's chart which is derived from the lectures of "The Inner Circle Trader" (ICT) .
Detected patterns are followed by targets with a distance controlled by the user.
🔶 USAGE
At its core, the ICT Unicorn Model relies on two popular concepts, Fair Value Gaps and Breaker Blocks. This combination highlights a future area of support/resistance.
A Bullish Unicorn Pattern consists out of:
A Lower Low (LL), followed by a Higher High (HH)
A Fair Value Gap (FVG), overlapping the established Breaker Block
A successful re-test of the FVG which confirms the pattern.
A Bearish Unicorn Pattern consists of:
A Higher High (HH), followed by a Lower Low (LL)
A Fair Value Gap (FVG), overlapping the established Breaker Block
A successful re-test of the FVG which confirms the pattern
The pattern detection depends on detected swings, which can be controlled by the Swing setting. Using higher values of this setting will return longer-term breaker blocks.
🔹 Using Risk/Reward Targets
A confirmed Unicorn pattern will show a blue ( Target ) / grey ( Stop Loss) "Risk/Reward" areas (RR).
When the Stop Loss or Target is hit, a white line is shown on the concerned side.
The Risk/Reward ratio can be adjusted in the "Targets" settings.
🔹 Trailing Stop
As seen in the previous snapshots, besides the RR areas, this indicator also includes an optional Trailing Stop .
This can be helpful to lower your risk, by exiting earlier than if you would wait until the Stop Loss is hit.
This example shows a successful bullish and bearish Unicorn Pattern . In this scenario, the Trailing Stop could be used for partial Take Profit.
The goal of this publication is to show confirmed Unicorn Patterns . To increase the chance of success, it is important to evaluate the bigger picture & use this in confluence with your price action analysis. For example, look for potential areas of liquidity, consider this pattern only during certain market sessions, avoid trading during heavy impact news, &/or incorporate other aspects of technical analysis rather than just following this pattern blindly.
🔶 DETAILS
🔹 Combine
When disabled, all potential Unicorn Patterns will delete previous unconfirmed patterns:
Enabling Combine ensures the last Unicorn Patterns in the opposite direction will remain.
While the latter bullish pattern became invalid, another one formed.
The combination of the previous bearish pattern, and looking at the big picture, the bullish pattern did not have much chance to be successful.
While disabling 'combine' helps minimize clutter, enabling this feature can give a pattern more chance to hit the SL/Target level.
🔹 Mitigated FVG
Users can determine if a pattern becomes invalid due to a mitigated FVG, causing the pattern to be deleted.
🔹 New pattern detected
When a new pattern is detected, the previous unconfirmed pattern in the same direction (bullish - bullish or bearish - bearish) will be deleted. This will always be the case, whether "Combine' is enabled or disabled.
When the previous pattern was confirmed but no SL or Target level was hit, this pattern will stop updating.
🔶 SETTINGS
🔹 Unicorn
Swings: This sets the length of swings, used for the underlying ZigZag and Unicorn Patterns detection.
Bull: Enable/disable Bullish patterns, and set the color of FVG box and Trailing Stop .
Bear: Enable/disable Bearish patterns, and set the color of FVG box and Trailing Stop .
Combine: When enabled, patterns in opposite directions (bullish/bearish) can exist at the same time. disabling this feature tends to give less clutter. See the "Usage" section for more information.
🔹 Targets
Risk/Reward: Sets the Risk/Reward ratio.
Trailing Stop: Set the length of small swings, which is used for the Trailing Stop .
IU Support and Resistance How this script works :
1. This script is an indicator script which calculates the support and resistance based on pivot high and pivot low and plot them as zone onto the chart.
2. The first user input is minimum number of touches which indicates how many time pivot high or pivot low should be tested in order to be a valid support or resistance level.
3.The second user input "Set Buffer" check if the user wants to use a custom buffer or not if it's unchanged then the default is 50% of the 1000 period ATR value .
4. If "Set Buffer" is checked meaning if it's set to true then only the third user input will be execute which is the "buffer" which indicates how much price range user wants his zone to have.
5. After the user input part this script create two arrays to store the pivot high and pivot low values every time he have a new value.
6. This script also creates two arrays to store the bar index of the bar where the new pivot high or pivot low is detected those bar index will be later use while creating the support and resistance zones.
7. Then the script creates four more arrays to store the final support and resistance values and their respective bar index which will be use for creating the support and resistance zones.
8. After this the script check that we are at the last bar of our chart if we are then we sort the support and resistance indices by descending order and store them into an new variable after that we sort the support and resistance arrays by descending order, then we loop through the arrays elements and we check if the previous element comes under the zone of the current element if so we increase the "minimum touch" variable by 1, once we have 5 or more count in our variable and we no longer have a valid zone then we store the element value and the sorted index of the element into our final arrays.
9. Finally the script will loop through the final support and resistance arrays and it will create a box for each support and resistance with respect to extending it on both directions.
10.The green zones are the support and the red zones are the resistance.
How user can benifits from this script:
1. User can automatically identify support and resistance zones and he can plan his trade as per that.
2. User can test how different markets reacts with support and resistance zones.
3. User can plan breakout trade on the break of the support or resistance level.
4. User can adjust he stop loss and take profit as per the support and resistance zones.
Sessions [TradingFinder] New York, London, Tokyo & Sydney ForexTiming is one of the influential factors in a trader's position. This indicator categorizes transactions into three sessions (Asia, Europe, and America). Five significant trading cities (New York, London, Frankfurt, Tokyo, and Sydney) are selectable.
I recommend using the tool on a 5-minute time frame, but it is usable on all time frames.
Settings:
• Trading sessions: Display or hide each trading session as needed.
• Color: Change the color of each box.
• Session time intervals: The default is based on the main working hours for each time interval and can be adjusted.
• Information table: Delete or display additional information table.
Information Table:
• Trading sessions
• Opening and closing times of each trading session
How to Use:
Initiating trading sessions involves entering with increased liquidity, and the market usually experiences significant movements. Many trading strategies are based on "time" and "session openings." This tool empowers traders to focus intensely on each time interval.
These trading sessions are crucial for all Forex, stock, and index traders:
The total price ceiling and floor in the Asia session (Tokyo and Sydney) are crucial for traders in the European session.
The European session starts with Frankfurt, and an hour later, London begins, collectively forming the European session.
The dashboard provides additional information, displaying hours based on UTC.
Customization options are considered in all sections so that everyone can apply their own settings.
Important: Default times are the most accurate for each region, and in most indicators, this time is not correctly selected. Therefore, the level of influence and time intervals are specified at the beginning of each session. If you are using another indicator, match its default time to the announced time and share the results with me in the comments.
Master Fren Jedi HelperDescription:
The "Master Fren Jedi Helper" is a TradingView indicator designed to enhance trading analysis by plotting distinct lines at crucial times of the trading day.
This indicator is an invaluable tool for traders who focus on intraday price movements and patterns around specific times. Its primary features include:
Customizable Time Markers: The script allows users to mark specific times of the day with lines of different colors and styles. These times are adjustable based on the user's timezone and preferences.
Configurable Line Properties: Users can customize the color and style of each line. The script offers options for a green line at 7 AM, a red line at 11 AM, a grey line at midnight, and a yelow line to denote the daily open.
Time Zone Adjustment: To work with New York time zone, you have ability to adjust for different time zones. Users can input their time zone offset, advised to use UTC -5 allowing the script to plot the lines accurately according to their local time.
Day Labels: The indicator also labels each day of the week at midnight, providing a clear and easy way to track the days on the chart.
Functionality Overview:
Green Line at 7 AM: This line helps identify the early morning market sentiment. Users can customize the color and style of this line.
Red Line at 11 AM: Plotted to highlight mid-morning price levels, this line is also customizable in color and style.
Grey Line at Midnight: Marks the start of a new trading day. The line style and color can be personalized.
Yellow Line for Daily Open: Indicates the opening price of the day. The line's color and style are adjustable.
Time Zone Configuration: Users can set their local time zone to ensure the lines correspond accurately with their specific market hours.
Day of the Week Labels: Each midnight is labeled with the day of the week, aiding in the weekly analysis of price patterns.
This indicator is perfect for traders who need to quickly identify key times and price levels each day. It's easily configurable to suit various trading strategies and assists in enhancing the visual representation of intraday market dynamics.
Advanced Volume Analytics and Distribution IndicatorThe Advanced Volume Analytics and Distribution Indicator is a sophisticated tool designed for financial analysts and traders who seek in-depth insights into market volume dynamics. This Pine Script-based indicator is a comprehensive solution, offering a rich set of features that analyze volume data using various statistical methods and theories. It's tailored for those who require a deeper understanding of market movements and volume distribution.
Key Features:
Volume Distribution Analysis: Utilizes standard deviation and mean calculations to analyze the distribution of trading volume. Employs z-scores to measure the standard deviations of volume from its mean, offering insights into volume anomalies.
Bell Curve Modeling: Constructs a bell curve (normal distribution) based on volume data, enabling users to visualize and assess the distribution of volume in a standard statistical format.
Provides a z-score based bell curve, offering a normalized view of volume deviations.
Exponential Smoothing: Applies exponential smoothing to volume data, giving more weight to recent observations. This feature is crucial for analyzing trending behaviors in volume data.
Stress Metric Calculation: Introduces a unique 'stress' metric, calculated using a custom formula. This metric is designed to evaluate the volatility or variability in the volume data over a specified period.
Central Limit Theorem (CLT) Mean Estimation: Implements CLT for estimating the mean of volume data. The CLT states that the distribution of sample means approximates a normal distribution as the sample size becomes larger.
Variance Point Estimation: Calculates the variance of volume data, providing insights into its variability and consistency over time.
Chi-Squared Test (Commented): Although not active in the initial release, the script includes a framework for a Chi-Squared Test to compare observed and expected volume frequencies, offering potential for future statistical comparisons.
Percentile Calculations and Convolution: Performs percentile calculations on volume data and employs convolution to these percentiles, enabling a more nuanced analysis of volume distribution.
Customizability: Users can input various parameters like anchor period, degrees of freedom, and smoothing preferences, making the tool adaptable to different analysis needs.
Visualization and Plotting: Features multiple plots for easy visualization of volume metrics, including stress, bell curves, point estimators, and smoothed data.
Theoretical Foundations:
This indicator is grounded in established statistical theories and methods, including the Central Limit Theorem, Chi-Squared Test (for future implementations), and convolution techniques. These foundations ensure that the indicator not only provides practical insights but also maintains a high standard of statistical rigor.
Intended Users:
This indicator is ideal for technical analysts, traders, and financial professionals who require a deep and statistically sound understanding of market volume behavior.
Release Notes:
This tool is designed a theoretical test of established statistical models and requires familiarity with Pine Script for customization. Future updates may include activation and expansion of the Chi-Squared Test functionality and additional statistical modules based on user feedback. It should be noted that it is advisable to use a logarithmic-inverted scale; when combined, these scales can provide a unique perspective that neither could offer alone. This combination might be particularly useful in highlighting exponential growth or decay trends, or in cases where the most significant data points are in the lower range of the dataset.
Notes of Stress Calculations:
The "stress metric" in the script is a custom-designed feature intended to measure the level of variability or volatility in the volume data over a given time period. This metric is calculated using a novel approach with concepts similar to those used in the field of engineering , particularly in stress analysis and finite element analysis (FEA).
Segmentation of Time Frame:
The script divides the given time frame (timeFrame) into smaller segments based on a specified number of units (units). This segmentation essentially breaks down the entire period into smaller, more manageable intervals for analysis. For each segment, the script calculates a 'stress' value. This involves iterating through each segment and performing calculations based on the source data (src), the default src is the volume data.
Calculation per Segment:
For each segment, the script identifies two points: the starting point (x1) and the ending point (x2). It then retrieves the corresponding values of the source data at these points (y1 and y2).
It calculates the difference in the x-axis (delta_x, the length of the segment) and the difference in the y-axis (delta_y, the change in volume over that segment).
Stress Calculation:
The script then calculates the 'stress' for each segment as the ratio of delta_y to delta_x. This ratio gives a measure of how much the volume has changed per unit of time within each segment. The stress values for each segment are then summed up to provide a cumulative measure of stress over the entire time frame.
The stress metric is essentially a measure of the volatility or variability in volume data. High stress values indicate larger changes in volume over shorter periods, suggesting more volatile market conditions. For traders and analysts, understanding the level of volatility is crucial. It can inform decision-making processes, risk management strategies, and provide insights into market sentiment. By comparing stress levels across different time frames or different securities, analysts can gain insights into relative market dynamics.
Buy and hold visualiserThis indicator shows the historical performance of a buy and hold portfolio. The purpose of the indicator is to show
1. the effect of the hold time (time between buying and selling a number of instruments) and
2. the effect of investing all capital at once (lump sum) versus dividing the investment over a number of months or years (cost averaging).
The indicator shows four lines:
- a dotted line at 0 (dollar or any other currency),
- a dotted line at the level of initial investment,
- a blue line that shows the amount of capital after selling at the end of the investment period after a lump sum investment,
- a green line that shows the amount of capital after selling at the end of the investment period after an investment that was done in chunks (cost averaging)
When 'chunks' is set to 1, the green line will match the blue line.
When 'investment' is set to 1, the blue and green lines will show the factor by which the initial investment was multiplied at the end of the investment period.
The effect of the hold time can be easily seen in the following example: Choose SPX (CBOE) as the active instrument, set 'chunks' to 1 and 'months' to 12. Depending on when you bought your portfolio, selling it a year later is like tossing a coin. Set 'months' to 360 and it becomes clear that it doesn't matter when you buy, the value of your portfolio will likely multiply considerably in 30 years, even if you bought everything all at once just before a bear market. It shows that with a long time horizon, you don't have to worry about timing the market.
Continue the example above and set 'chunks' to 12, thus spreading the initial investment over 12 months. The green line shows the cost averaging performance. The blue lump sum line is above the green line most of the time. Increase the chunks to 60 and the difference increases.
Modern Portfolio TheoryModern Portfolio Theory
The indicator is designed to apply the principles of Modern Portfolio Theory, a financial theory developed by Harry Markowitz. MPT aims to maximize portfolio returns for a given level of risk by diversifying investments.
User Inputs:
Users can customize various parameters, including the bar scale, risk-free rate, and the start year for the portfolio. Additionally, users can assign weights to different assets (symbols) in the portfolio.
Asset Selection:
Users can choose up to 10 different symbols (assets) for the portfolio. The script supports a variety of symbols, including cryptocurrencies such as BTCUSD and ETHUSD.
Weights and Allocation:
Users can assign weights to each selected asset, determining its percentage allocation in the portfolio. The script calculates the total portfolio weight to ensure it equals 100%. If total portfolio weight is lower then 100% you will see orange color with additional cash % bellow
If total portfolio weight is bigger then 100% you will see red big % warning.
Warning: (Total Weight must be 100%)
Cash Mode:
Risk and Return Calculation:
The script calculates the daily returns and standard deviation for each selected asset. These metrics are essential for assessing the risk and return of each asset, as well as the overall portfolio.
Scatter Plot Visualization:
The indicator includes a scatter plot that visualizes the risk-return profile of each asset. Each point on the plot represents an asset, and its position is determined by its risk (X-axis) and return (Y-axis).
Portfolio Optimization:
The script calculates the risk and return of the overall portfolio based on the selected assets and their weights. Based on the selected assets and their weights user can create optimal portfolio with preferable risk and return.
It then plots the portfolio point on the scatter plot, indicating its risk-return profile.
Additional Information:
The indicator provides a table displaying information about each selected asset, including its symbol, weight, and total portfolio weight. The table also shows the total portfolio weight and, if applicable, the percentage allocated to cash.
Visualization and Legend:
The script includes visual elements such as a legend, capital allocation line (CAL), and labels for risk-free rate and key information. This enhances the overall understanding of the portfolio's risk and return characteristics.
User Guidance:
The script provides informative labels and comments to guide users through the interpretation of the scatter plot, risk-return axes, and other key elements.
Interactivity:
Users can interact with the indicator on the TradingView platform, exploring different asset combinations and weightings to observe the resulting changes in the portfolio's risk and return.
In summary, this Pine Script serves as a comprehensive tool for traders and investors interested in applying Modern Portfolio Theory principles to optimize their portfolio allocations based on individual asset characteristics, risk preferences, and return
itradesize /\ Silver Bullet x Macro x KillzoneThis indicator shows the best way to annotate ICT Killzones, Silver Bullet and Macro times on the chart. With the help of a new pane, it will not distract your chart and will not cause any distractions to your eye, or brain but you can see when will they happen.
The indicator also draws everything beforehand when a proper new day starts.
You can customize them how you want to show up.
Collapsed or full view?
You can hide any of them and keep only the ones you would like to.
All the colors can be customized, texts & sizes or just use shortened texts and you are also able to hide those drawings which are older than the actual day.
You should minimize the pane where the script has been automatically drawn to therefore you will have the best experience and not show any distractions.
The script automatically shows the time-based boxes, based on the New York timezone.
Killzone Time windows ( for indices ):
London KZ 02:00 - 05:00
New York AM KZ 07:00 - 10:00
New York PM KZ 13:30 - 16:00
Silver Bullet times:
03:00 - 04:00
10:00 - 11:00
14:00 - 15:00
Macro times:
02:33 - 03:00
04:03 - 04:30
08:50 - 0910
09:50 - 10:10
10:50 - 11:10
11:50 - 12:50
Envelope and Moving Average**Description:**
- This script creates an indicator that combines an envelope and a simple moving average (MA).
- The envelope is constructed using a specified length, percentage deviation, and source price (close by default).
- The moving average is calculated based on a specified length and source price.
**Inputs:**
1. Envelope:
- Length: Number of periods used for the envelope calculation (default is 20).
- Percentage Deviation: Percentage above and below the envelope basis (default is 10%).
- Source: The price used for the envelope calculation (default is close).
- Exponential MA: Option to use exponential moving average for the envelope basis (default is false).
2. Moving Average:
- Length: Number of periods used for the moving average calculation (default is 20).
- Source: The price used for the moving average calculation (default is close).
**Plotting:**
- The script plots the envelope basis, upper envelope line, and lower envelope line.
- The area between the upper and lower envelope lines is filled with a semi-transparent color for better visualization.
- The moving average is plotted on the chart with a specified color and line width.
**How to Use in a Strategy:**
1. **Envelope Crossovers:**
- Go Long (Buy): When the close price crosses above the upper envelope line.
- Go Short (Sell): When the close price crosses below the lower envelope line.
2. **Moving Average Crossovers:**
- Go Long (Buy): When the close price crosses above the moving average.
- Go Short (Sell): When the close price crosses below the moving average.
3. **Confirmation:**
- Consider additional confirmation signals or filters to improve the robustness of your strategy.
- For example, you might require a certain amount of price momentum or use other technical indicators in conjunction with envelope and moving average signals.
4. **Optimization:**
- Experiment with different parameter values (e.g., envelope length, percentage deviation, moving average length) to optimize the strategy for specific market conditions.
5. **Risk Management:**
- Implement proper risk management techniques, such as setting stop-loss orders and position sizing, to control risk.
Remember to thoroughly backtest any strategy before deploying it in a live trading environment. Additionally, consider the current market conditions and adapt your strategy accordingly.
Leveraged Share Decay Tracker [SS]Releasing this utility tool for leveraged share traders and investors.
It is very difficult to track the amount of decay and efficiency that is associated with leveraged shares and since not all leveraged shares are created equally, I developed this tool to help investors/traders ascertain:
1. The general risk, in $$, per share associated with investing in a particular leveraged ETF
2. The ability of a leveraged share to match what it purports to do (i.e. if it is a 3X Bull share, is it actually returning consistently 3X the underlying or is there a large variance?)
3. The general decay at various timepoints expressed in $$$
How to use:
You need to be opened on the chart of the underlying. In the example above, the chart is on DIA, the leveraged share being tracked is UDOW (3X bull share of the DOW).
Once you are on the chart of the underlying, you then put in the leveraged share of interest. The indicator will perform two major assessments:
1. An analysis of the standard error between the underlying and the leveraged share. This is accomplished through linear regression, but instead of creating a linreg equation, it simply uses the results to ascertain the degree of error associated at various time points (the time points are 10, 20, 30, 40, 50, 100, 252).
2. An analysis of the variance of returns. The indicator requires you to put in the leverage amount. So if the leverage amount is 3% (i.e. SPXL or UPRO is 3 X SPY), be sure that you are putting that factor in the settings. It will then modify the underlying to match the leverage amount, and perform an assessment of variance over 10, 20, 30, 40, 50, 100, 252 days to ensure stability. This will verify whether the leveraged ETF is actually consistently performing how it purports to perform.
Here are some examples, and some tales of caution so you can see, for yourself, how not all leveraged shares are created equal.
SPY and SPXL:
SPY and UPRO:
XBI and LABU (3 x bull share):
XBI and LABD (3 x bear share):
SOX and SOXL:
AAPL and AAPU:
It is VERY pivotal you remember to check and adjust the Leveraged % factor.
For example, AAPU is leveraged 1.5%. You can see above it tracks this well. However, if you accidently leave it at 3%, you will get an erroneous result:
You can also see how some can fail to track the quoted leveraged amount, but still produce relatively lower risk decay.
And, as a final example, let's take a look at the worst leveraged share of life, BOIL:
Trainwreck that one. Stay far away from it!
The chart:
The chart will show you the drift (money value over time) and the variance (% variance between the expected and actual returns) over time. From here, you can ascertain the general length you feel comfortable holding a leveraged share. In general, for most stable shares, <= 50 trading days tends to be the sweet spot, but always check the chart.
There are also options to plot the variances and the drifts so you can see them visually.
And that is the indicator! Kind of boring, but there are absolutely 0 resources out there for doing this job, so hopefully you see the use for it!
Safe trades everyone!
[Suitable Hope] Crypto Marketcap Dominance OverviewThe Crypto Marketcap Dominance Overview indicator is a simple yet very useful indicator that aims at helping traders identify where the crypto liquidity is flowing. The indicator uses Cryptocap's real time crypto marketcap dominance data (in %) between several key categories:
- Bitcoin
- True total 2 (altcoins and Ethereum excluding the top 3 biggest stablecoins)
- True total 3 (altcoins excl. Ethereum and the top 3 biggest stablecoins)
- Ethereum
- Stablecoins
- Defi.
The indicator works across all timeframes but is best used on the default daily timeframe to identify changes in liquidity trends between the different categories. More categories can be expected to be added in the future; depending on Cryptocap's available data.
Traders or users of this indicator have a selections of options:
- Choose a dedicated timeframe
- Turn on/off the individual categories they wish to use
- Turn on/off labels
- Change global colour coding of each category and label
- Activate or deactive the 0 to 100% bands
Although there are a couple of similar indicators trying to do something similar, I tend to find them lacking clarity. I coded this indicator to provide a more simple and clearer view of the crypto marketcap dominance. I hope you find this indicator helpful.
Happy trading and good luck!
Bias DailyThis indicator shows in a different way how to evaluate the BIAS Daily.
Evaluate yesterday's closed candle and that of the day before yesterday
The conditions are:
LONG BIAS =
Candle closed above High Candle [2 ]
- In this condition a long continuation can be considered
SHORT BIAS =
The candle closed below the low candle [2 ]
- In this condition a short continuation can be considered
IN THE RANGE =
The candle did not close below or above the Low and High candle
- In this condition it is better not to risk it
The user has the possibility to:
- Choose to show high or low BIAS levels
- Shows the Table in which the BIAS D is marked
The indicator should be used as TTrades shows in its videos, it can also be implemented in ICT strategies.
The indicator takes into consideration the last 2 candles already closed, so on the candle that is forming you can expect reactions in the Pd Array of the Candle Range , below I show examples of how to use it in Multitimeframe
BIAS LONG =
BIAS SHORT =
HL range by durgaThe script we've been working on is an indicator designed to display the high-low range of the last candlestick on a TradingView chart. It does so by plotting two lines: one for the high and another for the low of the last completed candlestick.
Additionally, the script includes a label that shows the numerical value of the high-low range. This label is positioned between the plotted lines, showing the difference between the high and low prices of the last candlestick.
The script operates in real-time, updating dynamically as new candlesticks form. Furthermore, it automatically removes the label after the close of the candlestick, maintaining a clean and clutter-free chart.
This indicator can help traders quickly visualize and assess the range of the last completed candlestick, aiding in their analysis of price action.
Bubble Risk IndicatorThe Bubble Risk Indicator is a sophisticated tool designed to assess the potential risk level of a trading instrument by measuring its deviation from a 20-week Simple Moving Average (SMA). This dynamic indicator visually represents the deviation with a color-changing line, indicating the degree of risk based on the distance from the SMA.
🔷 Calculation
The indicator calculates the deviation from the 20-week SMA and expresses it as a percentage extension:
20-Week SMA : Averages the closing prices over the past 20 periods, providing a consistent measure of the long-term trend.
Deviation Percentage : Measures the percentage difference between the current closing price and the 20-week SMA.
🔷 Color Coding
The line changes color based on the deviation level to represent different risk levels. Users can customize these colors as per their preferences. However, the following are the default recommended settings:
Extreme Low Risk (Below 0) : Blue
Low Risk (Below 0) : Light Blue
Low Risk (Above 0) : Light Purple
Medium Risk : Orange
High Risk : Red
Colors transition smoothly to reflect the increasing or decreasing risk based on the deviation from the SMA.
🔷 Customization
Users have the flexibility to change the colors representing each risk level through the indicator settings. While the default colors are recommended for a standard view, users comfortable with custom color schemes can adjust according to their preference.
🔷 Usage
This indicator is beneficial for gauging the relative risk associated with current price movements compared to a historical average. It's most effective when used in conjunction with other technical analysis tools and market knowledge.
🔷 Limitations
While the Bubble Risk Indicator provides valuable insights, it should form part of a broader trading strategy. It assesses risk levels based on historical data and does not predict future market directions.
🔷 Conclusion
The Bubble Risk Indicator offers a nuanced and visually intuitive way to understand market risk levels, providing traders with an additional tool for informed decision-making.
🔷 Risk Disclaimer
Trading involves significant risk and is not suitable for every investor. The value of investments can fluctuate. Past performance is not indicative of future results. Always consider your circumstances and seek independent advice before making financial decisions. This indicator is provided for informational purposes only and is not intended as financial advice.
Mean Reversion with Incremental Entry by HedgerLabsThe "Mean Reversion with Incremental Entry" strategy, designed by HedgerLabs, is an advanced TradingView strategy script focusing on the mean reversion technique in financial markets. This strategy is engineered for traders who prefer a systematic approach with an emphasis on incremental entries based on price movements relative to a moving average.
Key Features:
Moving Average Based Strategy: Central to this strategy is the simple moving average (SMA), around which all trade entries and exits revolve. Traders can customize the MA length, making it flexible for various trading styles and timeframes.
Incremental Entry Mechanism: Unique to this strategy is the incremental entry system. The strategy initiates an initial trade when the price deviates from the MA by a specified percentage. Subsequent entries are made at incremental steps, defined by the trader, as the price moves further away from the MA. This method can potentially capitalize on increasing market volatility.
Dynamic Position Management: The strategy intelligently manages positions by entering long when the price is below the MA and short when above, allowing for adaptive positioning in different market conditions.
Automated Exit Logic: Exit points are determined when the price touches the MA, aiming to close positions at potential reversal points for optimized trade outcomes.
Continuous Market Analysis: With 'calc_on_every_tick' enabled, the strategy constantly evaluates market conditions, ensuring prompt reaction to price movements.
Usage Scenario:
This strategy is particularly beneficial in markets exhibiting mean-reverting behavior. It is suitable for traders focusing on swing trading or those who prefer to scale into positions during periods of high volatility.
Disclaimer:
Please remember that this strategy is for informational and educational purposes only and is not intended as financial or investment advice. Trading in financial markets carries risks, including the potential loss of capital. We advise doing your own research and consulting with a financial expert before making any investment decisions.
Mean Reversion with Incremental Entry Alerts by HedgerLabsThe "Mean Reversion with Incremental Entry Alerts" is a sophisticated TradingView indicator designed by HedgerLabs. It's built on the concept of mean reversion, a fundamental trading strategy in financial markets. This indicator is tailored for traders seeking systematic and disciplined entry points in volatile markets.
Key Features:
Moving Average (MA) Based: At its core, the indicator utilizes a simple moving average (SMA) as the baseline for mean reversion. You can customize the length of the MA according to your trading style.
Initial Entry Conditions: The script generates initial buy and sell alerts based on a defined percentage deviation from the moving average. This approach allows traders to enter trades at points where the price significantly deviates from its mean, potentially signaling a reversion opportunity.
Buy and Sell Signals: Clear visual cues are provided for buy and sell positions, making it easy to interpret and act upon the signals.
Close Conditions: In addition to entry signals, the indicator also plots closing signals (green and red crosses) when the price touches the moving average. This feature assists in timely exits from positions, aiming to optimize trade outcomes.
Alert System: Integrated alert conditions notify you when a new buy or sell order condition is met, as well as when to close existing positions. This ensures you never miss an opportunity or an exit point.
Usage Scenario:
This indicator is particularly useful in markets where prices tend to revert to a mean value over time. It's ideal for day traders who focus on asset price volatility.
Disclaimer:
Please note that this tool is for informational and educational purposes only and should not be considered as financial or investment advice. Trading involves substantial risk, including the potential loss of principal. We recommend conducting your research and consulting with a financial expert before making any investment decisions.