UNICODE CHEAT SHEETHello fellow coders
This publication is not a indicator or a strategy but rather a quick reference guide for Unicode characters in Pine Code script format. It's purpose is to quickly identify and copy any desired characters to your own scripts.
Hope everyone finds this useful
Educational
Liquidation Longs/Shorts [UAlgo]🔶Description:
The "Liquidation Longs/Shorts " indicator is designed to identify potential liquidation levels for long and short positions. It calculates the distance of the selected price source (close, high, low, or open) from two moving averages (MA) and plots the resulting values on the chart. When the price is at an extreme distance from the moving averages, it suggests a potential liquidation point for either long or short positions.
🔶Key Features:
Liquidation Calculations: The indicator calculates the distance of the selected price source from two moving averages: a simple moving average (SMA) and an exponential moving average (EMA) with customizable lengths.
Color Customization: Users can customize the colors of the plotted columns representing the distance from the moving averages for long and short liquidation levels.
Liquidation Circles: The indicator marks potential liquidation levels with small circles on the chart, with customizable colors for long and short liquidations.
Orange Circles -> Identifies Potential Short Liquidations
Aqua Circles -> Identifies Potential Long Liquidations
Example:
Adaptive Source Selection: Traders can select the price source (close, high, low, or open) for liquidation calculations, allowing flexibility based on their trading strategies.
Dynamic Threshold Calculation: The indicator dynamically adjusts the liquidation threshold based on the selected moving average lengths, providing adaptability to changing market conditions.
Disclaimer:
Use with Caution: This indicator is provided for educational purposes only and should not be considered as financial advice. Users should exercise caution and perform their own analysis before making trading decisions based on the indicator's signals.
Not Financial Advice: The information provided by this indicator does not constitute financial advice, and the creator (UAlgo) shall not be held responsible for any trading losses incurred as a result of using this indicator.
Backtesting Recommended: Traders are encouraged to backtest the indicator thoroughly on historical data before using it in live trading to assess its performance and suitability for their trading strategies.
Risk Management: Trading involves inherent risks, and users should implement proper risk management strategies, including but not limited to stop-loss orders and position sizing, to mitigate potential losses.
No Guarantees: The accuracy and reliability of the indicator's signals cannot be guaranteed, as they are based on historical price data and past performance may not be indicative of future results.
This indicator serves as a tool to assist traders in identifying potential liquidation levels, but it should be used in conjunction with other technical analysis tools and risk management practices for effective trading decision-making.
Time Based Comparison Tool [TFO]The goal of this indicator is to show how multiple assets are trading relative to their Previous Highs and Lows. Many traders have probably seen charts resembling this that may plot how asset prices are trading as a percent change over time, or something similar.
The key difference with this indicator is that all prices are normalized to reflect how they are trading with respect to the previous range of a user-defined timeframe. Without the normalization process, we would simply be observing some percent change from a given point in time; but this does not provide enough information to describe where price is trading relative to our desired frame of reference.
For example, if the timeframe setting was chosen to be 1 day, the indicator would plot the Previous High (PH) and Previous Low (PL) of the current symbol on the daily timeframe, denoted here by the black lines and labels. Then, the adjusted price of all selected symbols would be shown to visualize how each one is moving with respect its own PH and PL, using the current symbol's PH and PL as reference points.
In the above chart, we can see that CL was trading below its PDL from about 10:00-11:00 am EST, then broke above and retested it at around 11:20 am EST, before trading higher. To verify that this comparison works as intended, we can check to see that CL did in fact retest its PDL at this time before trading higher. Note that we are using the close price for this evaluation.
Since limiting the output to close prices can leave out some vital information, we can change the Plot Type setting from "Close" to "High to Low," which will instead show the range of prices from high to low instead of just the close.
We can expand on this by detecting when PH's and PL's have been raided (traded through), by displaying the text PHR (Previous High Raid) or PLR (Previous Low Raid) next to the symbol's label on the right. In this case below, where we're using the 1 week timeframe, we can observe that NQ1! (purple) traded through the PL level and thus its label (right) is updated to indicate a PLR.
Similarly, YM1! traded through its PH level and was updated to indicate a PHR; and ES1! raided both levels, with its label reflecting just that.
Due to the native limitation of output series in a single pine script, alerts have been consolidated to "Any PHR" or "Any PLR," meaning these alerts would fire if any of the selected symbols raided a PH or PL, respectively. If one wanted to be alerted for just a specific symbol, this could be achieved by deselecting all symbols except that which is desired, then setting an alert and adjusting its title for easier user recognition.
Volume Spike IndicatorHello dear traders,
Today we're discussing an indicator I've coded: the Volume Spike Indicator (VSI).
The indicator isn't a groundbreaking invention and certainly not a novelty. Nevertheless, I haven't seen this version of the indicator on TradingView before, so I'd like to introduce it.
1. The Origin of the Idea:
We're all familiar with volume charts: A volume chart visually represents the trading activity for a specific asset over a certain period, indicating the total number of shares or contracts traded.
We also know that volume spikes can significantly impact the market. A volume spike represents an extreme anomaly, a day, week, or month with an extraordinary amount of trading. However, recognizing these spikes in practice isn't always straightforward. What constitutes high volume? How do we define and identify it? The answers to these questions aren't easy.
It's commonly said that a volume spike could be identified if the volume is 25% more than the average of the two weeks prior, but how do you measure this 25%? It's not always easy to calculate, especially in real-time.
This challenge led me to develop the concept into an indicator.
How Does It Work?
Imagine being able to "feel" the market's energy like a surfer feels the ocean. The VSI does something similar by examining trading volume and comparing it to what has been typical over the past few weeks. Here's a quick look at the magic behind it:
Step 1: Establishing the Baseline: We start by establishing a baseline, i.e., the average trading volume over a given period. Let's use the last 10 days as the default setting. We choose 10 days because, in the traditional stock market, 10 days represent two weeks if you subtract weekends. This gives us a fixed line to compare against.
Step 2: Recognizing Peaks: Next, we look for days when the trading volume significantly exceeds this average. The size of the jump is where you have a say. You can set a threshold, such as 25%, to define what you consider a volume spike.
Step 3: The Calculation: This is where the math comes into play. We calculate the percentage change in today's volume compared to the average volume of the last 10 days. For example, if today's volume is 30% above the average and you've set your threshold at 25%, the VSI will recognize this as a spike.
Step 4: Visual Cue: These spikes are then plotted on a graph, with each spike represented as a bar. The height of the bar indicates the spike's percentage size, so you can see at a glance how significant a spike is.
Step 5: Intuitive Color Coding: For quick analysis, the VSI employs a color-coding system. Exceptionally high peaks, such as those exceeding a 100% increase, are highlighted in blue to emphasize their importance. Other peaks are shown in red, creating a visual hierarchy for quick volume data interpretation.
Why This Matters:
Identifying these spikes can help pinpoint the beginning or end of a trend. The idea is that when trading peaks at a certain level, there might be no more buyers or sellers willing to engage at that price level. Volume peaks, and a reversal is likely imminent. It's a simple yet effective concept. Therefore, it's crucial to use this indicator in the context of the trend, as not every spike carries the same significance.
Customizable:
The beauty of the VSI lies in its flexibility. Trading futures? You might want to adjust the averaging period to 14 days to better suit your market. You have full control over the settings to tailor them to your trading style.
Interpreting the Figures:
A positive percentage indicates a volume spike above the average – the higher the percentage, the more significant the spike.
If the percentage exceeds a certain threshold (which you can set, e.g., 25%), it signals a volume spike, indicating increased market activity that could precede significant price movement.
What makes the VSI genuinely adaptable is your ability to tweak the parameters to suit your needs.
Are you trading in a volatile market? Extend the SMA period to smooth out the noise. Trading in a 24-hour market? Adjust the length of your SMA. Seeking finer details? Shorten it. The VSI is yours to adapt to your trading strategy.
---------------------------------------------------------------------------------------------------------------------
As we wrap up this introduction to the Volume Spike Indicator, I hope you're as excited about its potential as I am. This tool, born out of curiosity and a desire for clarity in the vast ocean of market data, is designed to be your ally in navigating the waves of trading activity.
Remember, the true power of the VSI lies not just in its ability to highlight significant volume spikes, but in its adaptability to your unique trading style and needs. Whether you're charting courses through the tumultuous seas of day trading or navigating the broader currents of long-term investments, the VSI is here to offer insights and guidance.
I encourage you to experiment with it, customize it, and see how it can enhance your trading strategy. And as you do, remember that every tool, no matter how powerful, is just one piece of the puzzle. Combine the VSI with your knowledge, experience, and intuition to make informed and strategic trading decisions.
Thank you for taking the time to explore the Volume Spike Indicator with me.
Best Regards,
Karim Subhieh
UP DOWN Indicator 1Title: UP DOWN Indicator based on ADX Strategy - Accurate Signal Provider with Enhanced Success Potential
Description:
The Martingale ADX Indicator is a groundbreaking tool meticulously crafted to offer traders unparalleled precision in signal generation and risk management. Leveraging the power of the Average Directional Index (ADX), this indicator provides 100% non-repaint signals on the current candle, guiding traders to opportune and prepare for trade entry with remarkable accuracy.
With a focus on empowering traders across various financial markets, including Forex and Binary Options, this ADX Strategy-1 Indicator introduces a unique approach to trading dynamics. By seamlessly integrating the renowned Martingale Step-1 risk management strategy, this indicator not only minimizes losses but also enhances the potential for success, even in volatile market conditions.
Key Features:
Non-Repaint Signals: The Martingale ADX Indicator stands as a testament to reliability, offering 100% non-repaint signals. Traders can trust in the consistency and not removing losing Signals which is very important to trust the previous generated signals also, eliminating uncertainties and facilitating confident decision-making.
ADX-Based Precision: Built upon the robust framework of the Average Directional Index (ADX), this indicator delivers precise signals tailored to prevailing market trends and volatility levels. Whether trading in longer timeframes or engaging in Binary Options, traders can rely on the Martingale Step-1 ADX Indicator for superior insights.
Next Candle Trading: Seamlessly integrated into trading strategies, signals from the Martingale ADX Indicator prompt action on the subsequent candle. This real-time approach ensures traders stay ahead of market movements, seizing opportunities as they emerge. Giving Signals Once Candle ahead makes traders to prepare early and decide whether they want to enter the trade on presented Signal or not as per their own experience too. If the trading candle is loss then the very next candle shall be used for taking Martingale Sep-1 to enhance the Accuracy.
Enhanced Success Potential: With Martingale Step-1 risk management, this ADX Indicator offers more than just signal accuracy – it presents the potential for heightened success rates. Through strategic position sizing and leveraging experience and Price Action insights, traders can elevate overall accuracy to levels ranging from 80% to 90%.
Conclusion:
The UP DOWN Strategy-1 Indicator represents a paradigm shift in trading technology, combining precision signal generation with advanced risk management strategies. Whether you're a seasoned trader or just starting your journey, this indicator empowers you to navigate financial markets with confidence and achieve consistent results.
Experience the difference with the Martingale ADX Indicator – where reliability meets profitability, and success becomes attainable with every trade.
Trade wisely, and may your ventures be marked by prosperity and fulfillment.
Pardon for any descriptive language grammatical error and comment about this indicator and to get my other strategy as well. Happy trading !!
Risk Disclaimer:
Trading in financial markets carries inherent risks and should be approached with caution. It is imperative to exercise sound judgment and trade only with funds that you can afford to lose. We strongly advise against using borrowed funds for trading purposes. First practice on demo for own learning then make decision wisely.
Tops & Bottoms - Day of Week Report█ OVERVIEW
The indicator tracks when the weekly tops and bottoms occur and reports the statistics by the days of the week.
█ CONCEPTS
Not all the days of the week are equal, and the market dynamic can follow through or shift over the trading week. Tops and bottoms are vital when entering a trade, as they will decide if you are catching the train or being straight offside. They are equally crucial when exiting a position, as they will determine if you are closing at the optimal price or seeing your unrealized profits vanish.
This indicator is before all for educational purposes. It aims to make the knowledge available to all traders, facilitate understanding of the various markets, and ultimately get to know your trading pairs by heart (and saving a lot of your time backtesting!).
USDJPY tops and bottoms percentages on any given week.
USDJPY tops and bottoms percentages on up weeks versus down weeks.
█ FEATURES
Custom interval
By default, the indicator uses the weekly interval defined by the symbol (e.g., Monday to Sunday). This option allows you to specify your custom interval.
Weekly interval type filter
Analyze the weekly interval on any weeks, up weeks, or down weeks.
Configurable time range filter
Select the period to report from.
█ NOTES
Trading session
The indicator analyzes the days of the week from the daily chart. The daily trading sessions are defined by the symbol (e.g., 17:00 - 17:00 on EURUSD).
Extended/electronic trading session
The indicator can include the extended hours when activated on the chart, using the 24-hour or 1440-minute timeframe.
█ HOW TO USE
Plot the indicator and navigate on the 1-day or 24-hour timeframe.
Institutions vs. Crypto Whales Spot BuyingBased on analysis from @tedtalksmacro, I have put together a similar tool that helps to visualise whether institutions (Coinbase and Deribit) or native crypto whales (Binance and Bitfinex) are leading the BTC spot buying.
This is plotted as the normalised relative difference (-1 and 1) between the average of Coinbase and Deribit spot price versus Binance and Bitfinex. If positive (i.e. green bar), institutions are trading at a premium; if negative (i.e. red bar), crypto whales are trading at a premium.
For example, if crypto whales are trading at a premium and price is increasing, then they are leading the buying relative to institutions. However, if whales are trading at a premium and price is decreasing, then it is likely institutions are selling off at a more rapid rate relative to the crypto whales buying pressure. This applies to the alternate scenario where institutions are trading at a premium to crypto whales.
In recent times, native crypto whales (largely Binance) drove the push from 40 to 48k, but then also marked the local top with a major sell off at this price. Institutions then took over buying at the most recent lows, driven largely by GBTC outflows slowing down and Blackrock daily inflows exceeding Grayscale outflows for the first time late last week.
Price SextantThe provided Pine Script™ code is for a technical analysis indicator called "Price Sextant." This indicator helps visualize the price position relative to its linear regression and standard deviation levels. Here's a brief description:
Price Sextant Indicator:
Purpose:
The Price Sextant indicator aims to show the current price's deviation from the linear regression line by dividing the price chart into different zones or sextants.
Components:
Linear Regression: The script calculates a linear regression line based on the closing prices over a specified length (default is 50 bars).
Standard Deviation Sections: It then computes standard deviation levels from the linear regression, creating upper and lower sections around the regression line.
Scoring: Each section is assigned a numerical score, and labels with corresponding scores are displayed on the chart.
Arrow and Midline: An arrow is drawn to indicate the current price's position in relation to the regression line and standard deviation bands. It changes color based in what section it is:
orange section shows a ranging price, below orange section -1 arrow turns red and show down trend and if arrow above +1 section it turns green and show strong up trend of price.
A midline is plotted to mark the position of the linear regression line.
Sextant Description:
In navigation, a sextant is an instrument used to measure the angle between two visible objects.
In the context of this indicator, the term "Sextant" is likely used metaphorically to describe the division of the price chart into six sections or zones based on the linear regression and standard deviation bands.
This indicator can help traders identify potential overbought or oversold conditions, as well as assess the strength and direction of the trend.
Please note that the effectiveness of the indicator depends on various factors, and it's advisable to use it in conjunction with other analysis tools for a comprehensive trading strategy.
Bitcoin Price Based On ElectricityThis script Calculates the price of Bitcoin solely on the hashrate and the cost of electricity.
The calculation is quite conservative considering its based on the average cost of electricity globally and we are assuming that everyone is running the latest mining hardware, which is the most efficient and cost effective.
Under both of these assumptions the calculation for bitcoins price is almost identical to the price we are seeing now.
If we change the reward rate to 3.125 (Aprils reward amount) then the price of one bitcoin per cost of work will be around 100k.
I am sure I am missing some important numbers in this calculation, fees, start up costs etc. However, it is very interesting to see that the price of Bitcoin can be calculated almost perfectly based on the hashrate and cost of electricity.
PROOF OF WORK
Candlesticks Patterns [TradingFinder] Pin Bar Hammer Shooting🔵 Introduction
Truly, the title "TradingView" doesn't do justice to this excellent website, and that's why I've written about its crucial aspect. In this indicator, the identification of all candlesticks known as "Pin bars" is explored.
These candlesticks include the following:
- Hammer : A Pin bar formed at the end of a bearish trend, with its body being either bearish or bullish.
- Shooting Star : Formed at the end of a bullish trend, with its body being either bearish or bullish.
- Hanging Man : Formed during an upward trend, characterized by a candle with a lower shadow.
- Inverted Hammer : Formed during a downward trend, characterized by a candle with an upper shadow.
🟣 Important : For ease of use, we refer to these four candlestick patterns as Pin Bars and categorize them into the main friends "Bullish" and "Bearish."
🟣 Important : In all sources, Hanging Man and Inverted Hammer are referred to as "Reversal candles." However, in reality, whenever they appear after breaking a significant area (Break Out), we expect these candles to signal a continuation of the trend and confirmation in the direction of the trend.
🟣 Important : One of the best signs of market manipulation and entry by market giants is the "Ice Berg." So, it provides one of the best trading opportunities.
🔵 Reason for Creation
Many traders, especially volume traders, use Pin bars as confirmation and enter the market after their occurrence. In this indicator, all four patterns are identified and displayed in a colored candle format, using "triangle" and "circle."
When they are evident on the chart, directly or by drawing a horizontal line, they give us good alerts for reversal or continuation areas.
🔵 Information Table
1. Red circle: Pin bars formed in a downtrend.
2. Blue circle: Bullish Pin bars formed in an uptrend.
3. Black triangle: Bearish Pin bar candle in an uptrend.
4. Blue triangle: Bullish Pin bar candle in a downtrend.
🔵 Settings
Trend Detection Period: A special feature that considers smaller or larger fluctuations. If individual price waves need to be considered, use lower numbers; if the overall trend direction is desired, use larger numbers (e.g., 5-7 or higher). This precisely sets the Zigzag or Pivot format, not displayed but considered in the indicator calculation.
Trend Effect : By changing the Trend Effect status to "Off," all Pin bars, whether bullish or bearish, are displayed regardless of the current market trend. If the status remains "On," only Pin bars in the direction of the main market trend are shown.
🟣 Important : Black triangles "Number 3" and blue triangles "Number 4" displayed in the information table section, as explained in the "Information Table" section.
Show Bullish Pin Bar : When set to "Yes," displays bullish Pin bars; when set to "No," does not display them.
Show Bearish Pin Bar : When set to "Yes," allows the display of bearish Pin bars; when set to "No," does not display them.
Bullish Pin Bar Setting : Using the "Ratio Lower Shadow to Body" and "Ratio Lower Shadow to Higher Shadow" settings, you can customize your bullish Pin bar candles. Larger numbers impose stricter conditions for identifying bullish Pin bars.
Bearish Pin Bar Setting : Using the "Ratio Higher Shadow to Body" and "Ratio Higher Shadow to Lower Shadow" settings, you can customize your bearish Pin bar candles. Larger numbers impose stricter conditions for identifying bearish Pin bars.
Show Info Table : Allows the display or non-display of the information table (located at the bottom of the page and on the right side).
🔵 How to Use
At the end of a downtrend, look for "Hammer" candles, easily identified one by one.
To identify the "Shooting Star" candle pattern at the end of an uptrend; expect a price reversal in the downtrend.
For trades in the downward direction, wait for the formation of an "Inverted Hammer" Pin bar.
And finally, in an uptrend, where a "Hanging Man" candle can form.
🔵 Features
For better visualization, triangles and circles are used above the candles, but they can be easily removed. All Pin bars are displayed in color with the following meanings:
- Black-bodied candle: Inverted Hammer
- Turquoise blue candle: Hammer
- Pink candle: Hanging Man
- Red candle: Shooting Star
🟣 Important : The capability to detect the powerful two-candle pattern "Tweezer Top" at the end of an uptrend emerges by forming two "Shooting Star" candles side by side.
Similarly, the two-candle pattern "Tweezer Bottom" is created at the end of a downtrend with the formation of two "Hammer" candles side by side. To identify the "Tweezer" pattern, make sure the settings in the "Trend Effect" section are set to "Off."
🟣 Auxiliary Indicators
During the start of trading sessions such as Asia, London, and New York, where the highest liquidity exists, alongside this indicator, you can use the Trading Sessions indicator.
Sessions
The combination of Order Blocks "-OB" and "+OB" with candles is one of the best trading methods. The indicator that identifies order blocks, along with this indicator, can yield remarkable results in the success of Pin bar candles.
Order Blocks Finder
The trading toolset "TFlab" presents this indicator. To benefit from all indicators, we invite you to visit our page " TFlab Scripts ".
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
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.
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