Dynamic Market Correlation Analyzer (DMCA) v1.0Description
The Dynamic Market Correlation Analyzer (DMCA) is an advanced TradingView indicator designed to provide real-time correlation analysis between multiple assets. It offers a comprehensive view of market relationships through correlation coefficients, technical indicators, and visual representations.
Key Features
- Multi-asset correlation tracking (up to 5 symbols)
- Dynamic correlation strength categorization
- Integrated technical indicators (RSI, MACD, DX)
- Customizable visualization options
- Real-time price change monitoring
- Flexible timeframe selection
## Use Cases
1. **Portfolio Diversification**
- Identify highly correlated assets to avoid concentration risk
- Find negatively correlated assets for hedging strategies
- Monitor correlation changes during market events
2. Pairs Trading
- Detect correlation breakdowns for potential trading opportunities
- Track correlation strength for pair selection
- Monitor technical indicators for trade timing
3. Risk Management
- Assess portfolio correlation risk in real-time
- Monitor correlation shifts during market stress
- Identify potential portfolio vulnerabilities
4. **Market Analysis**
- Study sector relationships and rotations
- Analyze cross-asset correlations (e.g., stocks vs. commodities)
- Track market regime changes through correlation patterns
Components
Input Parameters
- **Timeframe**: Custom timeframe selection for analysis
- **Length**: Correlation calculation period (default: 20)
- **Source**: Price data source selection
- **Symbol Selection**: Up to 5 customizable symbols
- **Display Options**: Table position, text color, and size settings
Technical Indicators
1. **Correlation Coefficient**
- Range: -1 to +1
- Strength categories: Strong/Moderate/Weak (Positive/Negative)
2. **RSI (Relative Strength Index)**
- 14-period default setting
- Momentum comparison across assets
3. **MACD (Moving Average Convergence Divergence)**
- Standard settings (12, 26, 9)
- Trend direction indicator
4. **DX (Directional Index)**
- Trend strength measurement
- Based on DMI calculations
Visual Components
1. **Correlation Table**
- Symbol identifiers
- Correlation coefficients
- Correlation strength descriptions
- Price change percentages
- Technical indicator values
2. **Correlation Plot**
- Real-time correlation visualization
- Multiple correlation lines
- Reference levels at -1, 0, and +1
- Color-coded for easy identification
Installation and Setup
1. Load the indicator on TradingView
2. Configure desired symbols (up to 5)
3. Adjust timeframe and calculation length
4. Customize display settings
5. Enable/disable desired components (table, plot, RSI)
Best Practices
1. **Symbol Selection**
- Choose related but distinct assets
- Include a mix of asset classes
- Consider market cap and liquidity
2. **Timeframe Selection**
- Match timeframe to trading strategy
- Consider longer timeframes for strategic analysis
- Use shorter timeframes for tactical decisions
3. **Interpretation**
- Monitor correlation changes over time
- Consider multiple timeframes
- Combine with other technical analysis tools
- Account for market conditions and volatility
Performance Notes
- Calculations update in real-time
- Resource usage scales with number of active symbols
- Historical data availability may affect initial calculations
Version History
- v1.0: Initial release with core functionality
- Multi-symbol correlation analysis
- Technical indicator integration
- Customizable display options
Future Enhancements (Planned)
- Additional technical indicators
- Advanced correlation algorithms
- Enhanced visualization options
- Custom alert conditions
- Statistical significance testing
Portfolio
Portfolio SnapShot v0.3Here is a Tradingview Pinescript that I call "Portfolio Snapshot". It is based on two other separate scripts that I combined, modified and simplified - shoutout to RedKTrader (Portfolio Tracker - Table Version) and FriendOfTheTrend (Portfolio Tracker For Stocks & Crypto) for their inspiration and code. I was using both of these scripts, and decided to combine the two and increase the number of stocks to 20. I was looking for an easy way to track my entire portfolio (scattered across 5 accounts) PnL on a total and stock basis. PnL - that's it, very simple by design. The features are:
1) Track PnL across multiple accounts, from inception and current day.
2) PnL is reported in two tables, at the portfolio level and individual stock level
3) Both tables can be turned on/off and placed anywhere on the chart.
4) Input up to 20 assets (stocks, crypto, ETFs)
The user has to manually calculate total shares and average basis for stocks in multiple accounts, and then inputs this in the user input dialog. I update mine as each trade is made, or you can just update once a week or so.
I've pre-loaded it with the major indices and sector ETFs, plus URA, GLD, SLV. 100 shares of each, and prices are based on the close Jan 2 2024. So if you don't want to track your portfolio, you can use it to track other things you find interesting, such as annual performance of each sector.
Average Down CalculatorAverage Down Calculator is an indicator for investors looking to manage their portfolio. It aids in calculating the average share price, providing insights into optimizing investment strategies. Averaging down is a strategy investors use when the price of a security they own goes down. Instead of selling at a loss, they buy more shares at the lower price to reduce the average cost per share.
There are situations where a stock's price moves contrary to your expectations. The market moves downward. Despite this, your faith in the stock persists. This indicator allowing you to strategically add more stocks to lower the average price. But You must remember, it’s not without risks, as it involves investing more money in a losing position.
This Indicator allowing you to quickly understand your new position and make informed decisions. It’s designed for easy use, regardless of your experience level with investing.
Steps to use it:
1.put buy fee from your securitas
2.next put the price of the emiten from your portofolio
3.and how many lot you have
4.next is the the taget of percentage you want it become.
5 the last you can choose, the price that you want to buy for average.
this calculator is designed to help you navigate your investment better, choose it wisely.Be aware of the risks of investing more in a declining asset and consider diversification to manage potential losses.
Portfolio Index Generator [By MUQWISHI]▋ INTRODUCTION:
The “Portfolio Index Generator” simplifies the process of building a custom portfolio management index, allowing investors to input a list of preferred holdings from global securities and customize the initial investment weight of each security. Furthermore, it includes an option for rebalancing by adjusting the weights of assets to maintain a desired level of asset allocation. The tool serves as a comprehensive approach for tracking portfolio performance, conducting research, and analyzing specific aspects of portfolio investment. The output includes an index value, a table of holdings, and chart plotting, providing a deeper understanding of the portfolio's historical movement.
_______________________
▋ OVERVIEW:
The image can be taken as an example of building a custom portfolio index. I created this index and named it “My Portfolio Performance”, which comprises several global companies and crypto assets.
_______________________
▋ OUTPUTS:
The output can be divided into 4 sections:
1. Portfolio Index Title (Name & Value).
2. Portfolio Specifications.
3. Portfolio Holdings.
4. Portfolio Index Chart.
1. Portfolio Index Title, displays the index name at the top, and at the bottom, it shows the index value, along with the chart timeframe, e.g., daily change in points and percentage.
2. Portfolio Specifications, displays the essential information on portfolio performance, including the investment date range, initial capital, returns, assets, and equity.
3. Portfolio Holdings, a list of the holding securities inside a table that contains the ticker, average entry price, last price, return percentage of the portfolio's initial capital, and customized weighted percentage of the portfolio. Additionally, a tooltip appears when the user passes the cursor over a ticker's cell, showing brief information about the company, such as the company's name, exchange market, country, sector, and industry.
4. Index Chart, display a plot of the historical movement of the index in the form of a bar, candle, or line chart.
_______________________
▋ INDICATOR SETTINGS:
Section(1): Style Settings
(1) Naming the index.
(2) Table location on the chart and cell size.
(3) Sorting Holdings Table. By securities’ {Return(%) Portfolio, Weight(%) Portfolio, or Ticker Alphabetical} order.
(4) Choose the type of index: {Equity or Return (%)}, and the plot type for the index: {Candle, Bar, or Line}.
(5) Positive/Negative colors.
(6) Table Colors (Title, Cell, and Text).
(7) To show/hide any indicator’s components.
Section(2): Performance Settings
(1) Calculation window period: from DateTime to DateTime.
(2) Initial Capital and specifying currency.
(3) Option to enable portfolio rebalancing in {Monthly, Quarterly, or Yearly} intervals.
Section(3): Portfolio Holdings
(1) Enable and count security in the investment portfolio.
(2) Initial weight of security. For example, if the initial capital is $100,000 and the weight of XYZ stock is 4%, the initial value of the shares would be $4,000.
(3) Select and add up to 30 symbols that interested in.
Please let me know if you have any questions.
Equity CurveAn equity curve is a graphical representation of the change in the value of a trading account over a time period. The equity curve is a direct reflection of a trading strategy's effectiveness. A consistently upward-trending equity curve indicates a successful strategy, while a flat or declining curve may signal the need for adjustment.
This indicator takes traders daily account values as a comma separated list, and creates an equity curve and simple moving average of the equity curve. This serves as a mirror reflecting the outcome of past actions and decisions, guiding traders in fine-tuning their strategies, managing risk more effectively, and ultimately striving towards a consistently profitable trading journey.
New equity values should be added to the end of the current list. A space or no space after the comma has no effect.
Importance of the Equity Curve
Strategy Evaluation: The equity curve is a direct reflection of a trading strategy's effectiveness over time. A consistently upward-trending equity curve indicates a successful strategy, while a flat or declining curve may signal the need for adjustment.
Risk Management: Monitoring the equity curve helps traders to see the impact of their risk management practices. Sudden drops in equity could highlight instances of excessive risk-taking or inadequate stop-loss settings.
Performance Benchmarks: Comparing the equity curve against benchmarks or desired performance goals allows traders to assess if they are meeting, exceeding, or falling short of their trading objectives.
Psychology: Trading is as much about psychology as it is about strategy. A visual representation of one's equity curve helps maintain discipline, encouraging adherence to a trading plan during downturns and preventing overconfidence during upswings.
Having this data visually allows traders to see which category of trader they fall into.
Unprofitable
Boom or Bust
Profitable
Statistical Data
The indicator not only plots the equity curve and moving average, but includes the option to display the highest value reached by the equity curve, the percentage difference from the peak, and performance over selected periods (All Time, YTD, QTD, MTD, WTD).
Historical Analysis
The Equity Curve Indicator is not just a tool for real-time monitoring of trading performance; it also serves as a powerful instrument for conducting historical analysis. By analyzing the equity curve in conjunction with historical market conditions, traders can identify patterns or triggers that resulted in significant gains or losses.
For example, the chart below shows the equity curve overlaid on periods of net new highs / lows. The equity curve experienced declines while the market was showing net new lows or choppy periods (represented by a red or white background), while most of the equity gains were made while net new highs were present (green background).
This retrospective analysis helps in understanding how different market conditions impact trading strategies and performance.
Trading the Equity Curve
All trading strategies produce an equity curve that has winning and losing periods. In the example above, the trader could introduce a simple rule to lighten up on long positions or move to cash during periods of net new lows.
Another simple rule could be introduced to stop trading if the equity curve falls below the moving average, until favorable market conditions return again.
This indicator is intended to be used on the daily timeframe.
Test - Most correlated assetThis is a simple test to find the most and least correlated assets in a list.
BetaBeta , also known as the Beta coefficient, is a measure that compares the volatility of an individual underlying or portfolio to the volatility of the entire market, typically represented by a market index like the S&P 500 or an investible product such as the SPY ETF (SPDR S&P 500 ETF Trust). A Beta value provides insight into how an asset's returns are expected to respond to market swings.
Interpretation of Beta Values
Beta = 1: The asset's volatility is in line with the market. If the market rises or falls, the asset is expected to move correspondingly.
Beta > 1: The asset is more volatile than the market. If the market rises or falls, the asset's price is expected to rise or fall more significantly.
Beta < 1 but > 0: The asset is less volatile than the market. It still moves in the same direction as the market but with less magnitude.
Beta = 0: The asset's returns are not correlated with the market's returns.
Beta < 0: The asset moves in the opposite direction to the market.
Example
A beta of 1.20 relative to the S&P 500 Index or SPY implies that if the S&P's return increases by 1%, the portfolio is expected to increase by 12.0%.
A beta of -0.10 relative to the S&P 500 Index or SPY implies that if the S&P's return increases by 1%, the portfolio is expected to decrease by 0.1%. In practical terms, this implies that the portfolio is expected to be predominantly 'market neutral' .
Calculation & Default Values
The Beta of an asset is calculated by dividing the covariance of the asset's returns with the market's returns by the variance of the market's returns over a certain period (standard period: 1 years, 250 trading days). Hint: It's noteworthy to mention that Beta can also be derived through linear regression analysis, although this technique is not employed in this Beta Indicator.
Formula: Beta = Covariance(Asset Returns, Market Returns) / Variance(Market Returns)
Reference Market: Essentially any reference market index or product can be used. The default reference is the SPY (SPDR S&P 500 ETF Trust), primarily due to its investable nature and broad representation of the market. However, it's crucial to note that Beta can also be calculated by comparing specific underlyings, such as two different stocks or commodities, instead of comparing an asset to the broader market. This flexibility allows for a more tailored analysis of volatility and correlation, depending on the user's specific trading or investment focus.
Look-back Period: The standard look-back period is typically 1-5 years (250-1250 trading days), but this can be adjusted based on the user's preference and the specifics of the trading strategy. For robust estimations, use at least 250 trading days.
Option Delta: An optional feature in the Beta Indicator is the ability to select a specific Delta value if options are written on the underlying asset with Deltas less than 1, providing an estimation of the beta-weighted delta of the position. It involves multiplying the beta of the underlying asset by the delta of the option. This addition allows for a more precise assessment of the underlying asset's correspondence with the overall market in case you are an options trader. The default Delta value is set to 1, representing scenarios where no options on the underlying asset are being analyzed. This default setting aligns with analyzing the direct relationship between the asset itself and the market, without the layer of complexity introduced by options.
Calculation: Simple or Log Returns: In the calculation of Beta, users have the option to choose between using simple returns or log returns for both the asset and the market. The default setting is 'Simple Returns'.
Advantages of Using Beta
Risk Management: Beta provides a clear metric for understanding and managing the risk of a portfolio in relation to market movements.
Portfolio Diversification: By knowing the beta of various assets, investors can create a balanced portfolio that aligns with their risk tolerance and investment goals.
Performance Benchmarking: Beta allows investors to compare an asset's risk-adjusted performance against the market or other benchmarks.
Beta-Weighted Deltas for Options Traders
For options traders, understanding the beta-weighted delta is crucial. It involves multiplying the beta of the underlying asset by the delta of the option. This provides a more nuanced view of the option's risk relative to the overall market. However, it's important to note that the delta of an option is dynamic, changing with the asset's price, time to expiration, and other factors.
Portfolio TableA tool to manage your invested assets (stocks, crypto currencies, ...).
- Show profit of every asset as well as the total profit.
- Show/hide a bought price line on the chart if the current selected ticker is on your portfolio.
Dividend Calendar (Zeiierman)█ Overview
The Dividend Calendar is a financial tool designed for investors and analysts in the stock market. Its primary function is to provide a schedule of expected dividend payouts from various companies.
Dividends, which are portions of a company's earnings distributed to shareholders, represent a return on their investment. This calendar is particularly crucial for investors who prioritize dividend income, as it enables them to plan and manage their investment strategies with greater effectiveness. By offering a comprehensive overview of when dividends are due, the Dividend Calendar aids in informed decision-making, allowing investors to time their purchases and sales of stocks to optimize their dividend income. Additionally, it can be a valuable tool for forecasting cash flow and assessing the financial health and dividend-paying consistency of different companies.
█ How to Use
Dividend Yield Analysis:
By tracking dividend growth and payouts, traders can identify stocks with attractive dividend yields. This is particularly useful for income-focused investors who prioritize steady cash flow from their investments.
Income Planning:
For those relying on dividends as a source of income, the calendar helps in forecasting income.
Trend Identification:
Analyzing the growth rates of dividends helps in identifying long-term trends in a company's financial health. Consistently increasing dividends can be a sign of a company's strong financial position, while decreasing dividends might signal potential issues.
Portfolio Diversification:
The tool can assist in diversifying a portfolio by identifying a range of dividend-paying stocks across different sectors. This can help mitigate risk as different sectors may react differently to market conditions.
Timing Investments:
For those who follow a dividend capture strategy, this indicator can be invaluable. It can help in timing the buying and selling of stocks around their ex-dividend dates to maximize dividend income.
█ How it Works
This script is a comprehensive tool for tracking and analyzing stock dividend data. It calculates growth rates, monthly and yearly totals, and allows for custom date handling. Structured to be visually informative, it provides tables and alerts for the easy monitoring of dividend-paying stocks.
Data Retrieval and Estimation: It fetches dividend payout times and amounts for a list of stocks. The script also estimates future values based on historical data.
Growth Analysis: It calculates the average growth rate of dividend payments for each stock, providing insights into dividend consistency and growth over time.
Summation and Aggregation: The script sums up dividends on a monthly and yearly basis, allowing for a clear view of total payouts.
Customization and Alerts: Users can input custom months for dividend tracking. The script also generates alerts for upcoming or current dividend payouts.
Visualization: It produces various tables and visual representations, including full calendar views and income tables, to display the dividend data in an easily understandable format.
█ Settings
Overview:
Currency:
Description: This setting allows the user to specify the currency in which dividend values are displayed. By default, it's set to USD, but users can change it to their local currency.
Impact: Changing this value alters the currency denomination for all dividend values displayed by the script.
Ex-Date or Pay-Date:
Description: Users can select whether to show the Ex-dividend day or the Actual Payout day.
Impact: This changes the reference date for dividend data, affecting the timing of when dividends are shown as due or paid.
Estimate Forward:
Description: Enables traders to predict future dividends based on historical data.
Impact: When enabled, the script estimates future dividend payments, providing a forward-looking view of potential income.
Dividend Table Design:
Description: Choose between viewing the full dividend calendar, just the cumulative monthly dividend, or a summary view.
Impact: This alters the format and extent of the dividend data displayed, catering to different levels of detail a user might require.
Show Dividend Growth:
Description: Users can enable dividend growth tracking over a specified number of years.
Impact: When enabled, the script displays the growth rate of dividends over the selected number of years, providing insight into dividend trends.
Customize Stocks & User Inputs:
This setting allows users to customize the stocks they track, the number of shares they hold, the dividend payout amount, and the payout months.
Impact: Users can tailor the script to their specific portfolio, making the dividend data more relevant and personalized to their investments.
-----------------
Disclaimer
The information contained in my Scripts/Indicators/Ideas/Algos/Systems does not constitute financial advice or a solicitation to buy or sell any securities of any type. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
My Scripts/Indicators/Ideas/Algos/Systems are only for educational purposes!
Portfolio PnL Tracker
This is a personal portfolio tracker that helps you track your daily profits and losses. You can track up to 64 stocks or cryptocurrencies. You can set them by specifying the symbol and average price.
FEATURES
- Set up to 64 stock or crypto symbols.
- Shows the average price line
- Show profit or loss as a percentage
- Shows only when on the chart that matches the symbol settings.
HOW TO USE
1. Double click the PnL Tracker indicator at the top left of the chart
2. Enter your symbol and average cost
The average cost line shows your current position.
PnL is calculated based on the average cost you input.
The Profit and Loss (PnL) box and the average cost line will only be displayed when your input symbol matches the chart you are currently viewing.
Modern Portfolio Management IndicatorAfter weeks of grueling over this indicator, I am excited to be releasing it!
Intro:
This is not a sexy, technical or math based indicator that will give you buy and sell signals or anything fancy, but it is an indicator that I created in hopes to bridge a gap I have noticed. That gap is the lack of indicators and technical resources for those who also like to plan their investments. This indicator is tailored to those who are either established investors and to those who are looking to get into investing but don't really know where to start.
The premise of this indicator is based on Modern Portfolio Theory (MPT). Before we get into the indicator itself, I think its important to provide a quick synopsis of MPT.
About MPT:
Modern Portfolio Theory (MPT) is an investment framework that was developed by Harry Markowitz in the 1950s. It is based on the idea that an investor can optimize their investment portfolio by considering the trade-off between risk and return. MPT emphasizes diversification and holds that the risk of an individual asset should be assessed in the context of its contribution to the overall portfolio's risk. The theory suggests that by diversifying investments across different asset classes with varying levels of risk, an investor can achieve a more efficient portfolio that maximizes returns for a given level of risk or minimizes risk for a desired level of return. MPT also introduced the concept of the efficient frontier, which represents the set of portfolios that offer the highest expected return for a given level of risk. MPT has been widely adopted and used by investors, financial advisors, and portfolio managers to construct and manage portfolios.
So how does this indicator help with MPT?
The thinking and theory that went behind this indicator was this: I wanted an indicator, or really just a "way" to test and back-test ticker performance over time and under various circumstances and help manage risk.
Over the last 3 years we have seen a massive bull market, followed by a pretty huge bear market, followed by a very unexpected bull market. We have been and continue to be plagued with economic and political uncertainty that seems to constantly be looming over everyone with each waking day. Some people have liquidated their retirement investments, while others are fomoing in to catch this current bull run. But which tickers are sound and how tickers and funds have compared amongst each other remains somewhat difficult to ascertain, absent manually reviewing and calculating each ticker individually.
That is where this indicator comes in. This indicator permits the user to define up to 5 equities that they are potentially interested in investing in, or are already invested in. The user can then select a specific period in time, say from the beginning of 2022 till now. The user can then define how much they want to invest in each company by number of shares, so if they want to buy 1 share a week, or 2 shares a month, they can input these variables into the indicator to draw conclusions. As many brokers are also now permitting fractional share trading, this ability is also integrated into the indicator. So for shares, you can put in, say, 0.25 shares of SPY and the indicator will accept this and account for this fractional share.
The indicator will then show you a portfolio summary of what your earnings and returns would be for the defined period. It will provide a percent return as well as the projected P&L based on your desired investment amount and frequency.
But it goes beyond just that, you can also have the indicator display a simple forecasting projection of the portfolio. It will show the projected P&L and % Return over various periods in time on each of the ticker (see image below):
The indicator will also break down your portfolio allocation, it will show where the majority of your holdings are and where the majority of your P&L in coming from (best performers will show a green fill and worst will show a red fill, see image below):
This colour coding also extends to the portfolio breakdown itself.
Dollar cost averaging (DCA) is incorporated into the indicator itself, by assuming ongoing contributions. If you want to stop contributions at a certain point, you just select your end time for contributions at the point in which you would stop contributing.
The indicator also provides some basic fundamental information about the company tickers (if applicable). Simply select the "Fundamental" chart and it will display a breakdown of the fundamentals, including dividends paid, market cap and earnings yield:
The indicator also provides a correlation assessment of each holding against each other holding. This emphasizes the profound role of diversification on portfolios. The less correlation you have in your portfolio among your holdings, the better diversified you are. As well, if you have holdings that are perfectly inverse other holdings, you have a pseudo hedge against the downturn of one of your holdings. This is even more helpful if the inverse is a company with solid fundamentals.
In the below example you will see NASDAQ:IRDM in the portfolio. You will be able to see that NASDAQ:IRDM has a slight inverse relationship to SPY:
Yet IRDM has solid fundamentals and is performing well fundamentally. Thus, this makes IRDIM a solid addition to your portfolio as it can potentially hedge against a downturn for SPY and is less risky than simply holding an inverse leveraged share on SPY which is most likely just going to cost you money than make you money.
Concluding remarks:
There are many fun and interesting things you can do with this indicator and I encourage you to try it out and have fun with it! The overall objective with the indicator is to help you plan for your portfolio and not necessarily to manage your portfolio. If you have a few stocks you are looking at and contemplating investing in, this will help you run some theoretical scenarios with this stock based on historical performance and also help give you a feel of how it will perform in the future based on past behaviour.
It is important to remember that past behaviour does not indicate future behaviour, but the indicator provides you with tools to get a feel for how a stock has performed under various circumstances and get a general feel of the fundamentals of the company you could potentially be investing in.
Please note, this indicator is not meant to replace full, fundamental analyses of individual companies. It is simply meant to give you a "gist" of how companies are fundamentally and how they have performed historically.
I hope you enjoy it!
Safe trades everyone!
Consensio Allocation ToolOriginally created and taught by Taylor Jenks, this indicator provides portfolio allocation suggestions based on the behaviour of price and 3 simple moving averages (4/10/40 by default)
(ie. when short & medium term SMAs are above the long term then allocation is to be 100%).
This percentage allocated to the stock/commodity is to be reduced as it passes below the SMA's, particularly as each moving average crosses.
Consensio is useful for scaling in and out of a position as the portfolio allocation will change according to the momentum of the asset.
The rules below are my own based on understanding of the trading system developed by Jenks and his online content.
This script has the following rules:
if fastAboveSlowMA and not mediumAboveSlowMA
allocation := 30.0
else if longAboveFastMA
allocation := 0.0
else if fastAboveMediumMA and fastAboveSlowMA
allocation := 100.0
else if not fastAboveMediumMA and fastAboveSlowMA
allocation := 80.0
else if not fastAboveMediumMA and not fastAboveSlowMA
allocation := 50.0
else if not mediumAboveSlowMA and fastAboveSlowMA
allocation := 50.0
// Calculate adjusted allocation percentage based on crossing moving averages
allocation := allocation + (priceAboveFastMA ? 10.0 : -10.0)
allocation := allocation + (priceAboveMediumMA ? 10.0 : -10.0)
Metrics using Alternative Portfolio TheoryLibrary "APT_Metrics"
Portfolio metrics using alternative portfolio theory
metrics(init, cur, start, end, alpha)
Calculates APT metrics
Parameters:
init (float) : Starting Equity (strategy.initial)
cur (float)
start (int) : Start date (UNIX)
end (int) : End Date (UNIX)
alpha (float) : Confidence interval for DaR/CDaR. Defval = 0.05
Returns: Plots table with APT metrics
The metrics are shown in the bottom pane being applied to a buy-and-hold strategy.
PLEASE NOTE: This is the first draft of the library. Some calculations may be incorrect. If you spot any mistakes then please let me know and I will correct them as soon as possible. I am also open to suggestions on how to improve this.
At the moment this only works on the daily timeframe until I can find a way to universally calculate annualized volatility.
Average Cost (Costo Promedio)ENGLISH
This 'Average Cost' script allows the user to input and visualize profit or loss for different stocks (up to 50) with average cost and quantity data on a single chart. This is useful for tracking the profit or loss of each stock in real-time.
To use this script, the user should follow these steps:
1. Add the 'Average Cost' script to your TradingView chart.
2. In the script's configuration window, input the tickers, average costs, and quantity of shares for each ticker you want to monitor.
3. Click 'Accept' to apply the changes.
This script is primarily designed for stock markets, but can also be useful in other financial markets where the user is interested in tracking the performance of multiple assets.
ESPAÑOL
Este script de "Costo Promedio" permite al usuario ingresar y visualizar si hay ganancia o perdida para diferentes acciones (hasta 50) con los datos de costos promedio y cantidad de acciones en un solo gráfico. Esto es útil para realizar un seguimiento de la ganancia o pérdida de cada acción en tiempo real.
Para utilizar este script, el usuario debe seguir estos pasos:
1. Agregue el script "Costo Promedio" a su gráfico en TradingView.
2. En la ventana de configuración del script, ingrese los tickers, costos promedio y cantidad de acciones para cada ticker que desee monitorear.
3. Haga clic en "Aceptar" para aplicar los cambios.
Este script está diseñado principalmente para los mercados de acciones, pero también puede ser útil en otros mercados financieros donde el usuario esté interesado en rastrear el rendimiento de múltiples activos.
Live Portfolio ScreenerThe live portfolio screener indicator is a tool that help users to track the performance of their investments in real-time. The indicator provides a detailed breakdown of the user's portfolio, including the current profit and loss (P&L) for each stock that is invested in. This allows users to quickly and easily see how their portfolio is performing and make informed decisions about their investments on charts. Overall, this tool is an essential tool for anyone looking to stay on top of their investments and make data-driven decisions.
This indicator can load any symbol globally usable.
How to use this indicator ?
in this indicator firstly
you have add script name. (For example if you want to add symbol you have add in 's01 ' means the first symbol)
after that
you have to add price for each (For example if you want to add buy price for the first symbol then add the buy price in ' Bp01 ')
then the quantity comes in picture which is below price list and named here as Bq01 which means 'Buy quantity for first symbol'
Portfolio Chart by fonotoFeatures:
If you are looking for a chart that can project your portfolio value as a whole over time instead of individual stocks, this can be it. This is an indicator overlaid on the main chart of your index/stock selection allowing you to compare your portfolio performance against the main index/stock visually in chart form.
UI:
The settings has UI to input your portfolio stocks and quantities. The setting also has a divide factor which you can set to divide the portfolio value by this value so Y-Axis is offset to show main index/stock chart and your portfolio chart relatively closer. Portfolio chart works on any chosen timeframe. Colors can be customized in the UI.
Limitations:
1. Number of portfolio stocks is limited to 10.
2. Chart Type is limited to Candle.
3. Exponential Moving Averages are limited to 21, 50, 100, 200 & 500.
Portfolio Tracker For Stocks & CryptoThis is a portfolio tracker that will track individual, overall and daily profit/loss for up to 12 assets. You can set the size of your buys and price of your buys for accurate, up to date profit and loss data right on your chart. It works on all markets and timeframes.
HOW TO USE
Go into the indicator settings and you will see all of the available settings. The first is the ability to turn the tracker info table on or off from the chart, so it saves your portfolio info but let’s you remove it from the chart while trading. Second is the option to move the position of the info table to suit your preference.
Next we get into setting up your portfolio tickers, order size and price. Each ticker lets you set which stock/crypto you bought, then set how much you purchased and then what price you purchased them at.
Go through and set up all of your assets and then turn off any tickers that you don’t need. Once that is all done, your portfolio will be shown on the chart with all the data.
FEATURES
Top Section
The portfolio tracker has 2 sections. The top section shows each ticker in your portfolio individually with the following data:
- Ticker Name
- Weight of that asset compared to your total portfolio in %
- Current value of that position in $
- Profit or loss value from purchase price in %
- Todays change in value from yesterday’s close in %
The $ Value, PnL % and Today % will all change colors from green to red depending if they are in profit or not.
Bottom Section
The bottom section of the tracker will give you info for your portfolio as a whole. It has the following data:
- Total cost of your entire portfolio in $
- Current value of your entire portfolio in $
- Current profit or loss of your entire portfolio in $
- Current profit or loss of your entire portfolio in %
- Todays change of your entire portfolio value compared to yesterday’s close in %
The $ Value, PnL $, PnL % and Today % will all change colors from green to red depending if they are in profit or not.
Dollar Cost Averaging (Portfolio)
You can use it in daily, weekly and monthly candles. It can be used on multiple assets(10). All assets must have data and make sure they all use the same currency. See style in settings for plot titles If you are interested in passive investing, I hope it helps.
------------------
Günlük, haftalık, aylık mumlarda kullabilirsiniz. Birden fazla varlıkta kullanılabilir. Çoklu kullanım için hepsinin verisi olmalı ve aynı para birimini kullanmalı. Ayarlardan stilde grafik başlıklarını bulabilirsiniz. Pasif yatırım ile ilgiyseniz umarım yardımcı olur.
Portfolio PerformanceThis indicators will help you to compute portfolio performance and display results with a stats table and a nice monthly chart.
In this script you can do following:
Compose portfolio with up to 15 instruments
Change Initial capital / date range / rebalancing period
Compare portfolio performance with a benchmark
Compute basic stats
Compute instruments contribution
Display monthly performance of portfolio and benchmark
Change style for almost everything you see on your chart
Hope it will be useful for you!
Thanks to @MUQWISHI for helping me coding it.
Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as well as in historical backtesting.
This post and the script don’t provide any financial advice.
Crypto Portfolio ManagementCrypto Portfolio Management
This is an indicator not like the other ones that you regularly see in tradingview. The main difference is that this indicator does not plot a value for each candle bar like you would see with RSI or MACD. Actually it is table and it just uses tradingview great database of assets to plot some valuebale information that can not be found elsewhere easily. These metrics are some basic one that is used by portfolio managers to decide what they want to hold in their portfolio. The basic idea is that you should hold assets in your basket that are less correlated to the benchmark.
Benchmark in traditional context refers to main market indices like S&P 500 of US market. But they already have a lot of tools available. My effort was for crypto investors who are trying to rebalance their portfolio every month or week to have some good metrics to make decision. Because of this I used Bitcoin as crypto market benchmark. So, everything is compared to bitcoin in this script. I’m gonna explain the terms that is used in the table’s columns below.
MAKE SURE YOU PUT YOUR CHART AT DAILY AND AT THE MAXIMUM AVAILABLE DATA EXCHANGE.
Y-Exp
This is yearly expected return of the asset. It is simply the mean of the yearly returns of the asset. (these calculations are not typical in Tradingview because mainly we calculate on each bar and give value at the same bar but here this value to change once a year). Remember that the higher this value is the better it is because historically the asset have shown good returns but there is a tip: Always check the available historical data in any asset that you are adding if you add an asset that has only 1 year of data available or you use an exchange data that recently added the coin you will get unsignificant results and the results can not be trusted. You should always selects coins and market (coins can be changed in setting) that have the largest data available.
Y-SDev
This is a little bit complicated than the previous. This is the standard deviation of the yearly returns. This is a classic measure of RISK in financial markets. The higher the value, the more risk is involved with the asset that you have added. If you added two assets that have same returns but different Standard deviations, the rational thinker should choose the asset with lower Standard deviation.
The standard deviation is a good place to start but there are some considerations to have -it is getting complicated and average user should not be involved with these terms and can ignore the next phrases- standard deviation and mean of the yearly returns are random variables, these variables have a theoretical probability density function and these functions are not gaussian normal distribution. Because of this in the professional usage these returns should be transformed to a normal distribution and have all these terms calculated there and then transform back to its own normal state and then be used for any serious investment decision. I think these calculations can be done on Tradingview but I need you support to do this in the form of like and share of my scripts and ideas.
M-Exp and M-SDev
These terms are like the previous ones but it is calculated on monthly returns. As it goes for yearly return, the monthly returns change once a monthly candle closes. So be patient to use this indicator.
I highly recommend not to make decisions on monthly data due to a lot of noise involved with this market but in long run it is ok. So go with yearly returns and wait at least for 3 years to see your results.
CorToBTC
Basically you want to buy something that is less correalted with the benchmark. this is the correlation of the asset to bitcoin.
Sharpe Ratio
This is one of the most used metric as a risk adjusted return measurment. you can google it for more information. The higher this value the better. remmeber with any invenstment it is important to understand risks associated with the assets that you are buying.
DownFromATH
This metric that I didn't see anywhere in the tradingview and is familiar in the platforms like coinmarketcap. this is a real calculation of precentage down from ATH (All Time High). it means how much percentage a coin is down from the maximum price that the asset has experienced until now.
***
Remember you can change all the asset except main asset. If you like this script to 500 I will update this continuously.
Investing - Correlation Table This correlation tables idea is nothing new, many sites provides it.
However, I couldn't find any simple correlation indicator on TradingView despite how simple this indicator is.
This indicator works as its called. Calculating the correlation between 2 projects (can be used in stocks as well) using the 'ta.correlation' feature built into pinescript.
When it comes to investing, we do not want our stocks / crypto project to be heavily correlated to each other.
If they are heavily correlated to each other, then there isn't much point in diversifying.
That being said, it can be useful for traders who trade multiple pairs.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
In this indicator, consist of 5 primary input and 15 secondary input (Symbol List).
Correlation Source:
This input options allow you to change how the correlation is calculated. By default, it uses 'close'.
Correlation Percentage(%):
This input options allows you configure how many (%) of correlation is considered as 'decoupled'.
This correlation will only move between -100% ~ 100%.
100% refers to it moving together.
-100% refers to it moving the opposite direction.
For example, Project A rises in Price, what is the possibility of Project B following:
A 100% correlation between Project A and Project B, refers to Project B will follow Project A movement.
A 50% correlation between Project A and Project B, refers to there is only 50% chance for Project B to follow Project A movement.
A -20% correlation between Project A and Project B, refers to there is a 20% chance of Project B moving the opposite direction of Project A
(Refers to the table on chart above to better understand what the numbers means. DOT/USD has a 100% correlation to DOT/USD. However. MXCUSDT has a -37.2% correlation to DOT/USD.)
Amounts Bars To Check:
This input options will check the amount of bars since the last bar in the chart.
If you want to know the correlation of the past 100 days in a daily chart, you will enter '100' into this options and it will check only the past 100 days.
Symbol List
This will allow you to input all the project symbol ticker ID to add into the correlation table.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Originally, I wish to use for loop to go through the symbol list to reduce the amount of code required. However, due to limitation of 'request.security' feature, I had to abandon that idea and use hard-coded for requesting security and use a while loop to identify the symbol correlation value in the array set then set the table value accordingly.
If there is any script writer could improve this or any unclear explanation, feel free to drop a comment below.
Diversified Investment EMA Cross Strategy SimulatorThis simulating indicator proves that even if you use a simple strategy, you can reduce your risk by diversifying your investments.
The strategy itself is simple.(only long)
Buy when 50 days EMA crosses over 200 days EMA.
Sell when 50 days EMA crosses under 200 days EMA.
Or, stop loss when the asset falls by 2% (eg).
Using this simple strategy on an asset is just a test of your luck.
However, this capital change graph shows that risk can be reduced by diversifying investment into eight assets rather than one asset.
Options
Total Assets Capital Change represents the sum of capital changes for 8 assets. The gray line is the initial capital.
Each Asset Capital Change represents all eight asset capital changes. In this case, the gray line is displayed as the initial capital divided by 8.
The rest of the options show a graph of capital change for each asset, showing when buys and sells occurred.
And set the start date, initial capital, stop loss %, and commission.
And select the 8 assets you want to invest in and you are ready to go. To effectively reduce risk, uncoupled assets would be better if possible.
The table in the lower right shows the selected asset and color.
Please enjoy the simulation.
NK Sir's SRTFirst of all I would like to thanks Nitish Sir for teaching us the concept of SRT, which proves to be an excellent tool for Investing.
In a year, there are around 248 to 252 trading days .
On dividing the same by 2 we get 124. Even 125 / 126 can be taken.
We get SRT value by dividing Nifty Spot with 124 SMA value & SRT is applicable on Nifty in a Day Chart.
This value ranges in between 0.6 (Low) to 1.38/1.4/1.45/1.5 (High).
Ideal Entry in a stock will be at 0.6, which is very rare. You tend to buy at 0.7/0.8/0.9/1.10.
Exit from a stock will be at 1.3 - 1.5.
However generally we get a value of 0.8/0.9 and we should start investing 20 % of our capital that we have planned to invest. For every 0.1 decrease in SRT Value, we should add 20% to the stock portfolio.
Start Booking Profit if SRT value above 1.35 & book 50 % of the portfolio when SRT value is 1.45.
For Traders, as an when SRT value comes to 0.8/ 0.9. Buy when Hilega Milega gives us a clear BUY signal on Monthly Time Frame.
Stock bought at SRT value of 0.6 tend to double in a year. It generally quite rare to see a SRT Value of 0.6.