Webby % Off 52 WeekThis indicator measures a stocks distance from its 52 week high. The concept is based on what Mike Webster shared on his appearance on IBD Live, allowing users to see if a current pullback from the highs is normal compared to historical pullbacks or if more attention is warranted.
It is also important to pay attention to a stocks 52 week high in relation to it's current price to confirm trend, spot potential breakout levels or see if the high acts as an area of resistance.
The indicator has 3 different zones with shaded backgrounds to easily spot the distance off of the high.
Zones
Green Zone - 0 to 8% off highs
Yellow Zone - 8 to 15% off highs
Red Zone - 15 to 25% off highs
Similar Healthy Pullbacks
Possible concern as pullback undercuts previous pullback level
Portfolio management
Currency Conversion ChartReleasing this utility indicator I made for myself and thought others may find it helpful.
It is a simple currency conversion indicator. I personally trade both the TSX and the NYSE and hold both CAD and USD. As such, when I take positions in either or, I like to track how the currency I hold is affecting my position.
What the indicator does:
So, as indicated above, it converts a ticker's candlestick chart into the designated currency. You can either manually set the currency exchange rate, or search the currency exchange chart on Tradingview and it will auto-convert:
Purple arrow: The purple arrow points to the auto-input. You can search the currency you want to convert and it will automatically apply the conversion. It defaults to USD to CAD, but you can do USD to JPY, AUD to CAD, whatever currency you want provided it is available on tradingview. Alternatively, you can select manual conversion and input the manual conversion rate to apply.
Green Arrow: The green arrow refers to the conversion type. The indicator will default to static auto. This will pull the previous daily close. As currency trades at all hours, real-time is not advisable because the currency is in constant flux. Static will provide more stable results. However, you can toggle between the two. You can also just toggle Manual conversion.
Yellow arrow and red arrow: These pertain to position management. The indicator will display the change in the currency price over the designated amount of days. If you want to know how much the currency has changed in price over the last 7 or 20 days, simply put that value in the change input.
When you click manage position, you can fill out the position size variable and put the number of days you have had the position in the change parameter. This is the cost of your position. It can be options or shares. It will then adjust your position cost for the current change in the currency based on the number of days you have held it.
The indicator can be viewed on any timeframe and you can see how the conversion price compares to the listed price.
And that's basically the indicator! Its a simple utility indicator and hopefully some people will find use from it like I do!
Safe trades everyone, take care.
(Simple) Lot Size CalculatorPip Calculator: A Guide for Traders
The Pip Calculator is a powerful tool designed to help traders calculate their lot size based on their account balance, risk percentage, and stop loss in pips. This guide will walk you through using the Pip Calculator script and explain its features.
Features of the Pip Calculator:
User-friendly UI : The Pip Calculator provides a simple and intuitive user interface, making it easy to input your account details and obtain the desired lot size.
Flexible Inputs : The Pip Calculator allows you to enter your account balance, risk percentage, and stop loss in pips. This flexibility enables you to customize the calculation according to your trading strategy.
Dynamic Currency Pair Support : The Pip Calculator supports various currency pairs and their respective pip values. The script automatically detects the currency pair of the chart you're viewing, ensuring accurate calculations.
Real-time Lot Size Display : The Pip Calculator instantly calculates and displays the lot size based on your inputs. The lot size is updated in real-time as you adjust your account balance, risk percentage, or stop loss.
Visual Representation : The Pip Calculator visually presents the calculated lot size on the chart, making it easy to understand and reference during your trading activities.
Using the Pip Calculator:
Install and Apply the Script : To use the Pip Calculator, install it as an extension on your preferred trading platform (such as TradingView). Apply the script to the chart of the desired currency pair.
Enter Account Details : In the script's user interface, enter your account balance, risk percentage, and stop loss in pips. These details are essential for accurate lot size calculation.
Review Currency Pair Support : The Pip Calculator automatically detects the currency pair of the chart. Ensure that the currency pair is supported by checking the "Currency pair not supported" message. Currently, GBPJPY is the supported pair.
Observe Real-time Lot Size : Once you've entered the required information, the script will calculate and display the lot size in real-time. The lot size is adjusted automatically as you modify your inputs.
Visualize the Lot Size : The calculated lot size is displayed on the chart as a label. You can easily view and reference the lot size while analyzing price movements.
Customize the UI : The Pip Calculator allows you to customize the appearance of the lot size label. You can adjust the text color, background color, and choose whether to show or hide the lot size label.
Note: The Pip Calculator script is intended as a tool to assist traders in determining an appropriate lot size based on their account balance, risk percentage, and stop loss. It should be used in conjunction with a comprehensive trading strategy and risk management principles.
Advantages of the Pip Calculator:
Accuracy: The Pip Calculator incorporates accurate pip values for supported currency pairs, ensuring precise lot size calculations.
Simplicity: The user-friendly interface and intuitive design make it easy for traders to calculate their lot size without complex calculations or manual estimations.
Real-time Updates: The Pip Calculator provides instant lot size updates, allowing traders to adapt their position sizing based on changes in account balance, risk percentage, or stop loss.
Visibility: The visual representation of the lot size on the chart helps traders quickly identify their desired position size and monitor it during trading activities.
The Pip Calculator offers a convenient and efficient way to determine lot sizes based on your trading parameters. By using this tool, you can enhance your risk management practices, maintain consistency, and stay aligned with your trading plan.
Disclaimer: The Pip Calculator script is provided for informational purposes only and should not be considered as financial advice. Trading in the financial markets carries inherent risks, and it is essential to perform your own analysis and consult with a qualified financial advisor before making any investment decisions.
Top Tier Position SurveillanceThis is a light-weight position tool I coded after not finding something similar and that lets you enter the inputs in a way you do that also at your CEX.
You enter:
1. ENTRY price of position
2. TAKE PROFIT level
3. STOP LOSS level
4. Amount of USD you put into the position (aka collateral)
5. Your leverage (10x, 100x or whatever)
The tool then checks if that is a short or a long to show you that with a color and to calculate the profit and loss correctly.
It then shows you the current PnL in % and in USD at the label where you opened the position.
This is a tool for long and short position without the complicated stuff with "pips", "lot", "ticks", "risk" and all the things you typically don't need and mostly don't know about when trading at a CEX.
I made it to see my PnL without having to check in the App of the CEX which is pretty annoying.
PRO users might miss things... the intention was to make it easily to surveil your position without the need for a lot of inputs.
If your position goes into the desired direction you can lift the SL above the entry (if you're long for example), and it then renames to "SL-Profit" because you're in profit then and not in loss... I think there's some nice detail work in it which you hopefully will enjoy.
Pullback WarningThe Pullback Warning indicator is a simple indicator that highlights the potential for a market pullback, by measuring distances between certain key moving averages.
John Pocorobba recently shared in his general market updates, research showing that when the distance between the closing price and the 9 day exponential moving average is greater than the distance between the 9 day exponential moving average and the 20 day exponential moving average a pullback is likely.
While this condition occurs frequently, I added sensitivity options to try and filter out the noise. The sensitivity is based on the closing price’s extension from the 50 day simple moving average. Depending on your level of sensitivity, only signals that occur when price is extended either 5, 6, or 7 percent away from the 50 sma will be plotted.
Choose how to see the signal:
Highlight Background
Plot a symbol at desired location
Note this signal works best on indexes, not individual securities.
Forex Risk CalculatorForex Risk Calculator 's logical is bring the differential between Entry price and Stoploss price, your acceptable risk and your account size to calculate the loss size first then convert to the 'Lot size' and have another feature like auto scale static target calculate by your loss size with RRR (Risk Reward Ratio). Give you to get easier to manage your orders.
Key Features:
📈 Real-time Risk Assessment: Enter the amount you are willing to risk, and Forex Risk Calculator will calculate the appropriate position size for your trade in real-time.
🎯 Target Lines and Static Target Prices based on RRR: Set your desired Risk-Reward Ratio (RRR), and let Forex Risk Calculator auto-generate target prices according to your RRR. Additionally, place target lines to visualize the expected profit if the price hits that line.
⚙️ Customizable Parameters: Adjust risk percentage, RRR, and other parameters to tailor the tool to your trading strategy.
👁️ User-Friendly Interface: Forex Risk Calculator features an easy-to-use and intuitive interface for both beginners and seasoned traders.
Usage:
Step 1: Place your entry price
Step 2: Place your stoploss price
Step 3: Place your target price
Step 4: Confirm your account detail
Step 5: Bring the 'Lot size' to use
Parameter:
Initial account size
Risk percent
Entry price
Stop price
Target price
Show your target price
Show static target prices
Number of your static target prices
Table position
Text size
Background color
Text color
Border color
Output:
Chart
Entry price line
Stop loss price line (loss in USD)
Target price line (profit in USD)
Table
Account size
Risk percent
Entry price
Stoploss price
Lot size
Crypto Risk CalculatorCrypto Risk Calculator 's logical is bring the differential between Entry price and Stoploss price, your acceptable risk and your account size to calculate the loss size first then convert to the 'Amount coins' and have another feature like auto scale static target calculate by your loss size with RRR (Risk Reward Ratio). Give you to get easier to manage your orders. *** Create to use for Cryptocurrencies Future market ***
Key Features:
📈 Real-time Risk Assessment: Enter the amount you are willing to risk, and Crypto Risk Calculator will calculate the appropriate position size for your futures trade in real-time.
🎯 Target Lines and Static Target Prices based on RRR: Set your desired Risk-Reward Ratio (RRR), and let Crypto Risk Calculator auto-generate target prices according to your RRR. Additionally, place target lines to visualize the expected profit if the price hits that line.
⚙️ Customizable Parameters: Adjust risk percentage, RRR, and other parameters to tailor the tool to your trading strategy.
👁️ User-Friendly Interface: Crypto Risk Calculator features an easy-to-use and intuitive interface for both beginners and seasoned traders.
Usage:
Step 1: Place your entry price
Step 2: Place your stop loss price
Step 3: Place your target price
Step 4: Confirm your account detail
Step 5: Bring the 'Amount coins' to use
Parameter:
Initial account size
Risk percent
Leverage
Entry price
Stop price
Target price
Show your target price
Show static target prices
Number of your static target prices
Table position
Text size
Background color
Text color
Border color
Data output:
Chart
Entry price line
Stop loss price line (loss in base unit currency)
Target price line (profit in base unit currency)
Table
Account size
Risk percent
Leverage
Margin
Entry price
Stoploss price
Amounts coin
RS Momentum singleThe RS Momentum single Symbol indicator is a custom indicator that compares the performance of a specific symbol to a base symbol and calculates the relative strength (RS) and relative momentum (RM) between them. The indicator is designed to help traders identify the current market phase of the symbol and make informed trading decisions based on the relative performance.
Description:
The indicator calculates the RS and RM values using the following steps:
1. It retrieves the closing prices of the symbol and the base symbol.
2. It calculates the Symbol-to-Base Ratio (SBR) by dividing the closing price of the symbol by the closing price of the base symbol.
3. It calculates two Simple Moving Averages (SMAs) of the SBR with different lengths (RS1 and RS2) and computes the RS value as a percentage difference between these SMAs.
4. It calculates two SMAs of the RS value with different lengths (RM1 and RM2) and computes the RM value as a percentage difference between these SMAs.
5. The indicator plots the RS and RM values on the chart and assigns a market phase label based on their values.
Usage:
The indicator can be used to identify the current market phase of the symbol, which can be one of the following:
1. Leading: The symbol is outperforming the base symbol, and the momentum is positive. This phase indicates a strong bullish trend, and traders might consider entering long positions.
2. Weakening: The symbol is outperforming the base symbol, but the momentum is negative. This phase suggests that the bullish trend is losing strength, and traders might consider taking profits or tightening their stop losses.
3. Lagging: The symbol is underperforming the base symbol, and the momentum is negative. This phase indicates a strong bearish trend, and traders might consider entering short positions.
4. Improving: The symbol is underperforming the base symbol, but the momentum is positive. This phase suggests that the bearish trend is losing strength, and traders might consider closing short positions or looking for potential long entries.
Optimal Settings:
The optimal settings for the indicator depend on the specific market and trading style. However, the default settings (RS1 Length = 10, RS2 Length = 30, RM1 Length = 1, RM2 Length = 9) can be a good starting point. Traders can experiment with different settings find the ones that work best for their trading strategy and market conditions.
It's important to note that this indicator should be used in conjunction with other technical analysis tools and market context to make well-informed trading decisions. No single indicator can guarantee success in trading, and it's crucial to use a combination of tools and techniques to manage risk and maximize potential returns.
Ratio To Average - The Quant ScienceRatio To Average - The Quant Science is a quantitative indicator that calculates the percentage ratio of the market price in relation to a reference average. The indicator allows the calculation of the ratio using four different types of averages: SMA, EMA, WMA, and HMA. The ratio is represented by a series of histograms that highlight periods when the ratio is positive (in green) and periods when the ratio is negative (in red).
What is the Ratio to Average?
The Ratio to Average is a measure that tracks the price movements with one of its averages, calculating how much the price is above or below its own average, in percentage terms.
USER INTERFACE
Lenght: it adjusts the number of bars to include in the calculation of the average.
Moving Average: it allows you to choose the type of average to use.
Color Up/Color Down : it allows you to choose the color of the indicator for positive and negative ratios.
Position Size Calculator (EzAlgo)Upon adding the indicator to the chart, you will be prompted to place entry price lines, stop loss price line, and multiple take profit price lines by clicking at the desired price level on the chart.
Section Summaries
Table Settings: Allows users to select position and font size from drop-down menus. Displays current settings and potential profit/loss values.
Price Points: Users can set their Entry and select whether they want to include a DCA entry, Stop Loss price, Liquidation Buffer %, Take Profit levels and the amount of position to close at each level.
Risk Management: Users fill out their Account Size, set their Risk % (or fixed $ amount) for each Entry, set Manual Leverage, or allow the indicator to automatically choose the leverage based on the Stop Loss price distance from Entry and the Risk % per Entry.
User-Input Descriptions
DCA Price: The price at which users initiate their second, equally sized and leveraged position when using a Dollar-Cost Averaging (DCA) strategy. Upon reaching the DCA Price, the Entry Price adjusts to the Avg Price, calculated as the midpoint between initial and DCA entries.
Liquidation Buffer: A pre-set percentage that determines how close to the Stop Loss a position can get before it's liquidated. This assists the Auto Leverage feature in optimizing the leverage amount according to risk tolerance.
Risk per Entry: The proportion of the account, in % or a fixed dollar amount, that users are willing to risk for each trading position. If DCA is checked, this will assume users are entering with half of the total position size per entry.
Automatic Leverage: Auto Leverage automatically determines the optimal leverage level for a trade based on the user's Stop Loss price distance from the Entry point and the user-defined risk percentage per Entry. It also considers a user-defined Liquidation Buffer, which is a preset percentage determining how close to the Stop Loss a position can get before it's liquidated. This tool allows traders to optimize their leverage amount according to their risk tolerance.
Max Leverage: The highest leverage level users are willing to use, even if the exchange permits higher. This limit applies when the Auto Leverage feature is enabled.
Autocorrelation - The Quant ScienceAutocorrelation - The Quant Science it is an indicator developed to quickly calculate the autocorrelation of a historical series. The objective of this indicator is to plot the autocorrelation values and highlight market moments where the value is positive and exceeds the attention threshold.
This indicator can be used for manual analysis when a trader needs to search for new price patterns within the historical series or to create complex formulas in estimating future prices.
What is autocorrelation?
Autocorrelation in trading is a statistical measure used to determine the presence of a relationship or pattern of dependence between values in a financial time series over time. It represents the correlation of past values in a series with its future values. In other words, autocorrelation in trading aims to identify if there are systematic relationships between the past prices or returns of a security or market and its future prices or returns. This analysis can be helpful in identifying patterns or trends that can be leveraged for informed trading decisions. The presence of autocorrelation may suggest that market prices or returns follow a certain pattern or trend over time.
Limitations of the model
It is important to note that autocorrelation does not necessarily imply a causal relationship between past and future values. Other variables or market factors may influence the dynamics of prices or returns, and therefore autocorrelation could be merely a random coincidence. Therefore, it is essential to carefully evaluate the results of autocorrelation analysis along with other information and trading strategies to make informed decisions.
How to use
The usage is very simple, you just need to add it to the current chart to activate the indicator.
From the user interface, you can manage two important features:
1. Lenght: the delay period applied to the historical series during the autocorrelation calculation can be managed from the user interface. By default, it is set to 20, which means that the autocorrelation ratio within the historical series is calculated with a delay of 20 bars.
2. Threshold: the threshold value that the autocorrelation level must meet can be managed from the user interface. By default, it is set to 0.50, which means that the autocorrelation value must be higher than this threshold to be considered valid and displayed on the chart.
3. Bar color: the color used to display the autocorrelation data and highlight the bars when autocorrelation is valid can be managed from the user interface.
To set up the chart
We recommend disabling the 'wick' and 'border' of the candlesticks from the chart settings for a high-quality user experience.
DCA EMA Simple Bot [Starbots]
This is a simple idea of DCA trading on EMA crosses. Strategy is not repainting.
The difference between this and any other strategy is, that this script allows you to preset DCA buy triggers at desired levels and customize each DCA order size independently. Alerts are working, this strategy is easily used for automatic trading.
I mainly trade on Cryptohopper, Pionex, 3commas. This was created for community, alerts are working and non-repainting. Should work on any other as well.
Trading Condition:
It's buying when Fast EMA crosses up Slow EMA. Set your paramters.
It's selling if EMA's crosses back, signaling a sell. Optional.
DCA:
You can enter DCA on 20 custom levels or layers. It buys DCA when price hits the plotted blue line on the chart that's set by input % triggers. (buy 1st DCA at 2% drop, buy 2nd DCA at 5% drop,...)
Set your Inital Capital and Pyramiding in Properties tab, Initial Order Size and DCA Order Size (lot1,lot2,lot3,..), Order Type are changed in strategy inputs.
-By default you can see that we buy when EMA's cross up and signal a buy for 10% of equity, if market is dropping you will then place a first DCA order ( 20% equity) at 2% drop (lower) from initial order. If market keeps dropping you have more DCA levels where you can buy and average down your holding position. For selling you can use Take profit and Stop Loss targets that averages down multiple open positions, it will sell it once it reaches your desirable Take Profit and close a deal. You can also close your trade if EMA signals a sell.
Pyramiding - number of orders you can open at a time
Your first buy order is pyramiding 1. To allow it to buy 1 DCA or merge one time, set pyramding to 2.
Want to DCA 10 times? Set pyramiding at 11. (+1 always)
More features:
- Profit Calendar
- Show Balance label before every new trade
- DCA table - visualize how much of your investment is used in trades. If a background of the table is green you are okay, if the background color is red - you are using more money for orders than you actually have.
Buy Orders << Strategy Equity/Capital
- Show / Hide DCA lines - if your chart processing is getting slow you should hide some DCA levels to speed it up
- Backtesting Range - for testing the strategy in different time windows
- Alerts
When all trades are closed on your chart, winning rate of the strategy is 100% actually.
Win rate is shown differently as it's actually closing and opening every trade individually by default in TradingView system. We merge positions together and average it down into one big position to later sell for a profit (DCA).
You use this Trading Algorithm at your own risk. Do not trade before testing or invest something you cannot afford to lose on markets.
DZ Strategy ICTThe script presented is a trading strategy called "Breaker Block Strategy with Price Channel". This strategy uses multiple time frames (1 minute, 5 minutes, 15 minutes, 1 hour, and 4 hours) to detect support and resistance areas on the chart.
The strategy uses parameters such as length, deviations, multiplier, Fibonacci level, move lag and volume threshold for each time frame. These parameters are adjustable by the user.
The script then calculates support and resistance levels using the simple moving average (SMA) and standard deviation (STDEV) of closing prices for each time frame.
It also detects "Breaker Blocks" based on price movement from support and resistance levels, as well as trade volume. A Breaker Block occurs when there is a significant breakout of a support or resistance level with high volume.
Buy and sell signals are generated based on the presence of a Breaker Block and price movement from support and resistance levels. When a buy signal is generated, a buy order is placed, and when a sell signal is generated, a sell order is placed.
The script also plots price channels for each time frame, representing resistance and support levels.
Profit limit levels are set for each time range, indicating that the price levels assigned to positions should be closed with a profit. Stop-loss levels are also set to limit losses in the event of canceled price movements.
In summary, this trading strategy uses a combination of Breaker Block detection, support and resistance levels, price channels and profit limit levels to generate buy and sell signals and manage positions on different time ranges.
Simple Dollar Cost AverageThis simple DCS indicator shows:
Invested Amount
Portfolio Value
Profit
Assets
Cost per Share
Fees
You can define:
Starting Investment
Investment per Cycle
Fee Ratio
Cycle Frequency
Start and End Date
Take profit and Stop Loss ATR HL [Tcs] | ALGOThis indicator helps traders set stop loss and take profit levels based on either ATR or High-Low range.
The indicator calculates stop loss and take profit levels for both long and short positions, based on the user's input of ATR length, ATR smoothing method, and multiplier levels for each level. It’s possible to set 3 levels of take profit, for both long and short trades.
The indicator also includes the option to show or hide levels, bands, and labels for the calculated stop loss and take profit levels.
Additionally, the indicator has a function to calculate the user's risk based on their account balance, risk percentage, and broker fees.
Overall, this indicator can be helpful for traders who use stop loss and take profit levels in their trading strategies and want a visual representation of those levels on their charts.
Please note that this indicator is for educational purposes only and should not be used for trading without further testing and analysis.
Lot Size CalculatorThis is a public release of my Lot Size Calculator. I received a request for the code from a user so I am republishing the script so I can make it public (TV doesn't seem to give me the option to simply make it public once published ).
This is a very simple script to use. Simply choose your entry level and stop level on the chart and the indicator will calculate the lots. You can change your account risk and base currency units in the settings along with changing the scaling of the calculation to adjust the results with the lot sizing units of your broker. This allows the calculator to be used with CFDs, forex, Gold, etc.. Hope it helps in your trading it has been the single most useful tool in my trading as it has helped me always keep my risk locked up and on point that is why I released it.
One final quick note: Remember you can save your settings for your own account size and risk so you do not always have to modify the defaults when loading the script. Just a ease of use tip. I only add the script to my chart when I am about to take a trade so it is helpful to have everything set up in advance.
Cobra's CryptoMarket VisualizerCobra's Crypto Market Screener is designed to provide a comprehensive overview of the top 40 marketcap cryptocurrencies in a table\heatmap format. This indicator incorporates essential metrics such as Beta, Alpha, Sharpe Ratio, Sortino Ratio, Omega Ratio, Z-Score, and Average Daily Range (ADR). The table utilizes cell coloring resembling a heatmap, allowing for quick visual analysis and comparison of multiple cryptocurrencies.
The indicator also includes a shortened explanation tooltip of each metric when hovering over it's respected cell. I shall elaborate on each here for anyone interested.
Metric Descriptions:
1. Beta: measures the sensitivity of an asset's returns to the overall market returns. It indicates how much the asset's price is likely to move in relation to a benchmark index. A beta of 1 suggests the asset moves in line with the market, while a beta greater than 1 implies the asset is more volatile, and a beta less than 1 suggests lower volatility.
2. Alpha: is a measure of the excess return generated by an investment compared to its expected return, given its risk (as indicated by its beta). It assesses the performance of an investment after adjusting for market risk. Positive alpha indicates outperformance, while negative alpha suggests underperformance.
3. Sharpe Ratio: measures the risk-adjusted return of an investment or portfolio. It evaluates the excess return earned per unit of risk taken. A higher Sharpe ratio indicates better risk-adjusted performance, as it reflects a higher return for each unit of volatility or risk.
4. Sortino Ratio: is a risk-adjusted measure similar to the Sharpe ratio but focuses only on downside risk. It considers the excess return per unit of downside volatility. The Sortino ratio emphasizes the risk associated with below-target returns and is particularly useful for assessing investments with asymmetric risk profiles.
5. Omega Ratio: measures the ratio of the cumulative average positive returns to the cumulative average negative returns. It assesses the reward-to-risk ratio by considering both upside and downside performance. A higher Omega ratio indicates a higher reward relative to the risk taken.
6. Z-Score: is a statistical measure that represents the number of standard deviations a data point is from the mean of a dataset. In finance, the Z-score is commonly used to assess the financial health or risk of a company. It quantifies the distance of a company's financial ratios from the average and provides insight into its relative position.
7. Average Daily Range: ADR represents the average range of price movement of an asset during a trading day. It measures the average difference between the high and low prices over a specific period. Traders use ADR to gauge the potential price range within which an asset might fluctuate during a typical trading session.
Utility:
Comprehensive Overview: The indicator allows for monitoring up to 40 cryptocurrencies simultaneously, providing a consolidated view of essential metrics in a single table.
Efficient Comparison: The heatmap-like coloring of the cells enables easy visual comparison of different cryptocurrencies, helping identify relative strengths and weaknesses.
Risk Assessment: Metrics such as Beta, Alpha, Sharpe Ratio, Sortino Ratio, and Omega Ratio offer insights into the risk associated with each cryptocurrency, aiding risk assessment and portfolio management decisions.
Performance Evaluation: The Alpha, Sharpe Ratio, and Sortino Ratio provide measures of a cryptocurrency's performance adjusted for risk. This helps assess investment performance over time and across different assets.
Market Analysis: By considering the Z-Score and Average Daily Range (ADR), traders can evaluate the financial health and potential price volatility of cryptocurrencies, aiding in trade selection and risk management.
Features:
Reference period optimization, alpha and ADR in particular
Source calculation
Table sizing and positioning options to fit the user's screen size.
Tooltips
Important Notes -
1. The Sharpe, Sortino and Omega ratios cell coloring threshold might be subjective, I did the best I can to gauge the median value of each to provide more accurate coloring sentiment, it may change in the future.
The median values are : Sharpe -1, Sortino - 1.5, Omega - 20.
2. Limitations - Some cryptos have a Z-Score value of NaN due to their short lifetime, I tried to overcome this issue as with the rest of the metrics as best I can. Moreover, it limits the time horizon for replay mode to somewhere around Q3 of 2021 and that's with using the split option of the top half, to remain with the older cryptos.
3. For the beginner Pine enthusiasts, I recommend scimming through the script as it serves as a prime example of using key features, to name a few : Arrays, User Defined Functions, User Defined Types, For loops, Switches and Tables.
4. Beta and Alpha's benchmark instrument is BTC, due to cryptos volatility I saw no reason to use SPY or any other asset for that matter.
Rainbow IndicatorName of the indicator: Rainbow indicator
A brief description of the indicator:
Using this indicator, you can see the "margin of safety" for opening a position in shares of fundamentally strong companies with an acceptable P/E level, as well as the price range for closing a position.
The background to the creation of the indicator:
I got the idea to create this indicator thanks to the concept of the "margin of safety", which was invented by the father of value investing - Benjamin Graham. According to his idea, it is reasonable to buy shares of a company only when the price offered by the market is lower than the "intrinsic value" calculated on the basis of financial statements. The value of this difference is the "margin of safety”. At the same time, the indicator does not copy Graham's idea but develops it relying on my own methodology.
So, according to Graham, the "margin of safety" is a good discount to the intrinsic value of the company. That is, if a company's stock is trading at prices that are well below the company's intrinsic value (on a per-share basis), it's a good opportunity to consider buying it. In this case, you will have a certain margin of safety in case the company is in financial distress and its stock price goes down. Accordingly, the greater the discount, the better.
When it comes to the intrinsic value of a company, there are many approaches to determining it - from calculating the Price-to-book value financial ratio to the discounted cash flow method. As for my approach, I am not trying to find the cherished intrinsic value, but I am trying to understand how fundamentally strong the company is in front of me, and in how many years the investment in it will pay off. To determine fundamental strength, I use the appropriate Fundamental Strength Indicator . To estimate the payback period, I use the P/E ratio (*). If I am satisfied with both of these indicators, I move on to the Rainbow Indicator.
(*) If you want to learn more about the P/E ratio, I suggest reading my two articles on TradingView:
Price / Earnings: Interpretation #1
Price/Earnings: amazing interpretation #2
Indicator calculation methodology:
The Rainbow indicator starts with a simple moving average of one year (this is the thick red line in the center). Hereinafter a year will mean the last 252 trading days.
Applying a moving average of this length - is a good way to smooth out sharp price fluctuations which can happen during a year as much as possible, keeping the trend direction as much as possible. Thus, the moving average becomes for me the center of fluctuations of the imaginary pendulum of the market price.
Then the deviations are calculated from the center of fluctuations. To do this, a certain amount of earnings per share is subtracted from and added to the moving average. This is the diluted EPS of the last year.
Deviations with a "-" sign form the Lower Rainbow of four colors:
- The blue spectrum of the lower rainbow begins with a deflection of -4 EPS and ends with a deflection of -8 EPS.
- Green spectrum of the lower rainbow begins with a deflection of -8 EPS and ends with a deflection of -16 EPS.
- The orange spectrum of the lower rainbow begins with a deflection of -16 EPS and ends with a deflection of -32 EPS.
- Red spectrum of the lower rainbow begins with a deflection of -32 EPS and goes to infinity.
The Lower Rainbow is used to determine the price ranges that can be considered for buying stocks. It is in the spectra of the Lower Rainbow that the very "margin of safety" according to my methodology is located. The Lower Rainbow has the boundaries between the spectra as a solid line . And only the red spectrum of the Lower Rainbow has only one boundary.
Deviations with a "+" sign form the Upper Rainbow of four similar colors:
- The red spectrum of the upper rainbow begins with a deflection of 0 EPS and ends with a deflection of +4 EPS.
- The orange spectrum of the upper rainbow begins with a deflection of +4 EPS and ends with a deflection of +8 EPS.
- Green spectrum top rainbow begins with a deflection of +8 EPS and ends with a deflection of +16 EPS.
- The blue spectrum of the upper rainbow begins with a deflection of +16 EPS and goes to infinity.
The Upper Rainbow is used to determine the price ranges that can be considered for selling stocks already purchased. The top rainbow has boundaries between the spectra in the form of crosses . And only the blue spectrum of the upper rainbow has only one boundary.
The presence of the Empty Area (the size of 4 EPS) above the Lower Rainbow creates some asymmetry between the two rainbows - the Lower Rainbow looks wider than the Upper Rainbow. This asymmetry is deliberate because the market tends to fall much faster and deeper than it grows . Therefore, a wider Lower Rainbow is conducive to buying stocks at a good discount during a period of massive "sell-offs.
The situation, when the Lower Rainbow is below the center of fluctuations (the thick red line) and the Upper Rainbow, is above the center of fluctuations is called an Obverse . It is only possible to buy a stock in an Obverse situation .
The situation when the Lower Rainbow is above the center of fluctuations and the Upper Rainbow is below the center of fluctuations is called Reverse . In this situation, the stock cannot be considered for purchase , according to my approach.
Selling a previously purchased stock is possible in both situations: Reverse and Obverse. After loading the indicator, you can see a hint next to the closing price - Reverse or Obverse now.
Due to the fact that the size of the deviation from the center of fluctuation depends on the size of the diluted EPS, several important conclusions can be made:
- The Obverse situation is characteristic of companies that show a profit over the last year.
- The Reverse situation is typical for companies that show a loss over the last year.
- An increase in the width of both rainbows in the Obverse situation tells us about an increase in profits for the company.
- A decrease in the width of both rainbows in the Obverse situation tells us about a decrease in the company's profits.
- An increase in the width of both rainbows in the Reverse situation tells us about an increase in the company's losses.
- A decrease in the width of both rainbows in the Reverse situation tells us about a decrease in the company's losses.
- The higher the profit level of the company, the greater your "margin of safety" should be. This will provide the necessary margin of safety in case you go into a cycle of declining financial results. The appropriate width of the Lower Rainbow will just create this "margin".
- Increased profits in the company (after buying its stock) will allow you to stay in position longer by widening the Upper Rainbow.
- A decrease in profits in the company (after buying its stock) will allow you to close your position more quickly by narrowing the Upper Rainbow.
Conditions for opening and closing positions:
So, the Lower Rainbow has four differently colored spectra: blue, green, orange, and red. Each one highlights the desired range of prices acceptable for buying in an Obverse situation. The blue spectrum is upper with respect to the green spectrum, and the green spectrum is lower with respect to the blue spectrum, etc.
- If the current price is in the Blue Spectrum of the Lower Rainbow, that is a reason to consider that company for buying the first portion (*) of the stock.
- If the current price has fallen below (into the Green Spectrum of the Lower Rainbow), that is a reason to consider this company to buy a second portion of the stock.
- If the current price has fallen below (into the Orange Spectrum of the Lower Rainbow), it is a reason to consider this company to buy a third portion of the stock.
- If the current price has fallen below (into the Red Spectrum of the Lower Rainbow), that is a reason to consider that company to buy a fourth portion of the stock.
(*) The logic of the Rainbow Indicator implies that no more than 4 portions of one company's stock can be purchased. One portion refers to the number of shares you can consider buying at the current price (depending on your account size and personal diversification ratio - see information below).
The Upper Rainbow also has four differently colored spectra: blue, green, orange, and red. Each of them highlights the appropriate range of prices acceptable for closing an open position.
- If the current price is in the red spectrum of the Upper Rainbow, I close one portion of an open position bought in the red spectrum of the Lower Rainbow.
- If the current price is in the orange spectrum of the Upper Rainbow, I close one portion of an open position bought in the orange spectrum of the Lower Rainbow.
- If the current price is in the green spectrum of the Upper Rainbow, I close one portion of an open position bought in the green spectrum of the Lower Rainbow.
- If the current price is in the blue spectrum of the Upper Rainbow, I close one portion of an open position bought in the blue spectrum of the Lower Rainbow.
This position-closing logic applies to both the Obverse and Reverse situations. In both cases, the position is closed in portions in four steps. However, there are 3 exceptions to this rule when it is possible to close an entire position in whole rather than in parts:
- If there is a Reverse situation and the current price is above the thick red line.
- If I decide to invest in another company and I do not have enough available cash to purchase the necessary number of portions.
- If I find out about events that pose a real threat to the further existence of the company (for example, a bankruptcy filing), I can close the position earlier, without waiting for the price to hit the corresponding Upper Rainbow spectrum.
So, the basic scenario of opening and closing a position assumes the gradual purchase of shares in 4 stages and their gradual sale in 4 stages. However, there is a situation where one of the stages is skipped in the case of buying shares and in the case of selling them. For example, because the Fundamental Strength Indicator and the P/E ratio became acceptable for me only at a certain stage (spectrum) or the moment was missed for a transaction due to technical reasons. In such cases, I buy or sell more than one portion of a stock in the spectrum I am in. The number of additional portions will depend on the number of missed spectra. For example, if I have no position in the stock of the company in question, all conditions for buying the stock have been met, and the current price is in the orange spectrum of the Lower Rainbow, I can buy three portions of the stock at once (for the blue, green, and orange spectrum). I will sell these three portions in the corresponding Upper Rainbow spectra (orange, green, and blue). However, if for some reason the orange spectrum of the Upper Rainbow was missed, and the current price is in the green spectrum - I will sell two portions of the three (in the green spectrum). I will sell the last, third portion only when the price reaches the blue spectrum of the Upper Rainbow.
The Rainbow Indicator also helps calculate the number of shares that can be considered for purchase at the current price position in the Lower Rainbow spectra. To do this, you need to go to the indicator settings.
+ Cash in - Cash out +/- Closed profit/loss + Dividends - Fees - Taxes
Here I indicate the amount of funds deposited to my account, withdrawn from it, profit/loss on closed positions, dividends credited to the account, and taxes deducted from the account.
Diversification coefficient
The diversification coefficient determines how diversified I want my portfolio to be. For example, a diversification coefficient of 20 means that I plan to buy 20 share portions of different companies, but no more than 4 portions per company (based on the number of Lower Rainbow spectra).
The cost of purchased shares of this company (fees excluded)
Here I specify the amount of already purchased shares of the company in question in the currency of my portfolio. For example, if at this point in time, I have purchased 1000 shares at $300 per share, and my portfolio is expressed in $, I enter - $300,000.
The cost of all purchased shares in the portfolio (fees excluded)
Here I enter the amount of all purchased shares for all companies in the currency of my portfolio (without commissions spent on the purchase). This is necessary to determine the amount of available funds available to purchase shares.
After entering all the necessary data, I go to the checkbox, by checking it I confirm that the company in question has been studied with the Fundamental Strength Indicator and the P/E ratio, and their values are satisfactory to me. No calculation is performed without the checkbox checked. This is done intentionally because the application of the Rainbow Indicator for stock acquisition purposes is possible only after studying the Fundamental Strength of the company and an acceptable P/E value.
Next, I click "Ok" and get the calculation in the form of a table on the left.
Free cash in the portfolio
This is the amount of free cash available to purchase stocks. Please note that the price of the stock and the funds in your portfolio must be denominated in the same currency. On TradingView, you can choose which currency to display the stock price in.
Cash amount for one portion
The amount of cash needed to buy one portion of a stock. Depends on the diversification ratio entered.
Potential portions amount
Number of portions, available for purchase at the current price. Can be a fractional number.
Cash amount to buy
The amount of cash needed to buy portions available for purchase at the current price.
Shares amount to buy
Number of shares in portions available for purchase at the current price.
The table also contains additional information in the form of the current value of the company's market capitalization and P/E ratio.
Mandatory requirements for using the indicator:
- works only on a daily timeframe;
- the indicator is only applicable to shares of public companies;
- quarterly income statements for the last year are required;
- an acceptable for you P/E ratio is required to consider the company's stock for purchase;
- the Rainbow Indicator only applies in tandem with the Fundamental Strength Indicator. To consider a company's stock for purchase, you need confirmation that the company is fundamentally strong.
What is the value of the Rainbow Indicator?
- clearly demonstrates a company's profit and loss dynamics;
- shows the price ranges that can be used to open and close a position;
- takes into account the principle of gradual increase and decrease of a position;
- allows calculating the number of shares to be purchased;
- shows the current value of the P/E ratio;
- shows the current capitalization of the company.
Example:
As an example, consider the situation with NVIDIA Corporation stock (ticker - NVDA).
September 02, 2022:
Fundamental Strength Indicator - 11.46 (fundamentally strong company).
P/E - 39.58 (acceptable to me).
Current Price - $136.47 (is in the Orange Spectrum of the Lower Rainbow).
Situation - Obverse.
The basic conditions for buying this company's stock are met. The Rainbow Indicator settings are filled out as follows:
The table to the left of the Rainbow Indicator shows how many shares are possible to buy in the Orange Spectrum of Lower Rainbow at the current price = 10 shares. This corresponds to 2.73 portions.
To give you an example, I buy 10 shares of NVDA at $136.47 per share.
October 14, 2022:
NVDA's stock price has moved into the red spectrum of the Lower Rainbow.
The Fundamental Strength Indicator is 10.81 (fundamentally strong company).
P/E is 35.80 (an acceptable level for me).
Current Price - $112.27 (is in the Red Spectrum of the Lower Rainbow).
Situation - Obverse.
The basic conditions for buying this company's stock are still met. The Rainbow Indicator settings are populated as follows:
The table to the left of the Rainbow Indicator shows how many shares are possible to buy in the Lower Rainbow Red Spectrum at the current price (5 shares). This corresponds to 1.12 portions.
To give you an example, I buy 5 shares of NVDA at $112.27 per share. A total of 3.85 portions were purchased, which is the maximum possible number of portions at the current price level. The remainder in the form of 0.15 portions can be purchased only at a price level below $75 per share.
January 23, 2023:
The price of NVDA stock passes through the red spectrum of the Upper Rainbow and stops in the orange spectrum. As an example, I sell 5 shares bought in the red spectrum of the Lower Rainbow, for example at $180 per share (+60%). And also a third of the shares bought in the orange spectrum, 3 shares out of 10, for example at $190 a share (+39%). That leaves me with 7 shares.
January 27, 2023:
NVDA's stock price has continued to rise and has moved into the green spectrum of the Upper Rainbow. This is a reason to close some of the remaining 7 shares. I divide the 7 shares by 2 and round up to a whole number - that's 4 shares. For my example, I sell 4 shares at $199 a share (+46%). Now I am left with 3 shares of stock.
February 02, 2023:
The price of NVDA stock moves into the blue spectrum of the Upper Rainbow, and I close the remaining 3 shares, for example, at $216 per share (+58%). The entire position in NVDA stock is closed.
As you can see, the Fundamental Strength Indicator and the P/E ratio were not used in the process of closing the position. Decisions were made only on the basis of the Rainbow Indicator.
As another example, let's look at the situation with the shares of Papa Johns International, Inc. (ticker PZZA).
November 01, 2017:
Fundamental Strength Indicator - 13.22 points (fundamentally strong company).
P/E - 21.64 (acceptable to me).
Current Price - $62.26 (is in the blue spectrum of the Lower Rainbow).
Situation - Obverse.
The basic conditions for buying shares of this company are met. The settings of the Rainbow Indicator are filled as follows:
The table to the left of the Rainbow Indicator shows how many shares are possible to buy in the Lower Rainbow Blue Spectrum at the current price - 8 shares. This corresponds to 1 portion.
To give you an example, I buy 8 shares of PZZA at a price of $62.26.
August 8, 2018:
PZZA's share price has moved into the green spectrum of the Lower Rainbow.
The Fundamental Strength Indicator is a 9.83 (fundamentally strong company).
P/E is 16.07 (an acceptable level for me).
Current Price - $38.94 (is in the green spectrum of the Lower Rainbow).
Situation - Obverse.
The basic conditions for buying shares of this company are still met. The Rainbow Indicator settings are populated as follows:
The table to the left of the Rainbow Indicator shows how many shares are possible to buy in the Lower Rainbow Green Spectrum at the current price - 12 shares. This corresponds to 0.93 portions.
To give you an example, I buy 12 shares of PZZA at a price of $38.94. A total of 1.93 portions were purchased.
October 31, 2018:
PZZA's stock price moves into the Upper Rainbow red spectrum and is $54.54 per share. Since I did not have any portions purchased in the Lower Rainbow red spectrum, there is no closing part of the position.
February 01, 2019:
After a significant decline, PZZA's stock price moves into the orange spectrum of the Lower Rainbow at $38.51 per share. However, I am not taking any action because the company's Fundamental Strength on this day is 5.02 (a fundamentally mediocre company).
March 27, 2019:
PZZA's stock price passes the green and blue spectrum of the Upper Rainbow. This allowed to close the previously purchased 12 shares, for example, at $50 a share (+28%) and 8 shares at $50.38 a share (-19%).
Closing the entire position at once was facilitated by a significant narrowing in both rainbows. As we now know, this indicates a decline in earnings at the company.
Risk disclaimer:
When working with the Rainbow Indicator, keep in mind that the release of the Income statement (from which diluted EPS is derived) occurs some time after the end of the fiscal quarter. This means that the new relevant data for the calculation will only appear after the publication of the new statement. In this regard, there may be a significant change in the Rainbow Indicator after the publication of the new statement. The magnitude of this change will depend on both the content of the new statement and the number of days between the end of the financial quarter and the publication date of the statement. Prior to the publication date of the new statement, the latest actual data will be used for the calculations. Also, once again, please note that the Rainbow Indicator can only be used in tandem with the Fundamental Strength Indicator and the P/E ratio. Without these additional filters, the Rainbow Indicator loses its intended meaning.
The Rainbow Indicator allows you to determine the price ranges for opening and closing a position gradually, based on available data and the methodology I created. You can also use it to calculate the number of shares you can consider buying taking into account the position you already have. However, this Indicator and/or its description and examples cannot be used as the sole reason for buying or selling stocks or for any other action or inaction related to stocks.
Limit Order + ATR Stop-Loss [TANHEF]This indicator enables interactive placement of limit or stop-limit orders with a trailing ATR stop-loss and optional profit target (with alerts). Refer to the images below for further clarification.
Why use a trailing stop-loss?
A trailing stop-loss serves as an exit strategy when price moves against you, while also allowing you to adjust the exit point further into profit when price moves favorably. The ATR (Average True Range), a reliable measure of volatility, acts as an effective risk management tool, functioning as a trailing stop-loss.
Indicator Explanation
Initial indicator placement: Select Long Limit or Long-Stop Limit order.
Change Entry Type: Switch between Long and Short within settings.
Modify entry price: Drag circle, adjust in settings, or re-add indicator to chart.
Optional Profit Target: Use Risk/Reward ratio or specify price.
Entry anticipation: Estimated ATR stop-loss and profit target as blue circles (fluctuates with volatility changes).
Entry triggered: Actual ATR stop-loss and profit target plotted.
Exit conditions: Stop-loss or profit target hit, exit entry.
Update Frequency: Continuously, Bar Open, or Bar Open on entry then continuously.
ATR Overlap: no entry occurs if the ATR overlaps with price (stop-loss 'hit' already on entry bar)
Table: Displays input settings selected.
Show Only On Ticker: Ability to hide indicator on other tickers.
Long Limit
Long Stop-Limit
Short Limit
Short Stop-Limit
Alerts
1. 'Check' alerts to use within indicator settings (entry, trailing stop hit, profit target hit, and failed entry).
2. Select 'Create Alert'
3. Set the condition to 'Limit Order + ATR Stop-Loss''
4. Select create.
Additional details can be added to the alert message using these words in between Curly (Brace) Brackets:
{{trail}} = ATR trailing stop-loss (price)
{{target}} = Price target (price)
{{type}} = Long or Short stop-loss (word)
{{traildistance}} = Trailing Distance (%)
{{targetdistance}} = Target Distance (%)
{{starttime}} = Start time of position (day:hr:min)
{{maxdrawdown}} = max loss
{{maxprofit}} = max profit
{{update}} = stoploss update frequency
{{entrysource}} = entry as 1st bar source (yes/no)
{{triggerentry}} = Wick/Close Trigger entry input
{{triggerexit}} = Wick/Close Trigger exit input
{{triggertarget}} = Wick/Close Trigger target input
{{atrlength}} = ATR length input
{{atrmultiplier}} = ATR multiplier input
{{atrtype}} = ATR type input
{{ticker}} = Ticker of chart (word)
{{exchange}} = Exchange of chart (word)
{{description}} = Description of ticker (words)
{{close}} = Bar close (price)
{{open}} = Bar open (price)
{{high}} = Bar high (price)
{{low}} = Bar low (price)
{{hl2}} = Bar HL2 (price)
{{volume}} = Bar volume (value)
{{time}} = Current time (day:hr:min)
{{interval}} = Chart timeframe
{{newline}} = New line for text
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)
Crypto Correlation MatrixA crypto correlation matrix or table is a tool that displays the correlation between different cryptocurrencies and other financial assets. The matrix provides an overview of the degree to which various cryptocurrencies move in tandem or independently of each other. Each cell represents the correlation between the row and column assets respectively.
The correlation matrix can be useful for traders and investors in several ways:
First, it allows them to identify trends and patterns in the behavior of different cryptocurrencies. By looking at the correlations between different assets, traders can gain insight into the intra-relationships of the crypto market and make more informed trading decisions. For example, if two cryptocurrencies have a high positive correlation, meaning that they tend to move in the same direction, a trader may want to diversify their portfolio by choosing to invest in only one of the two assets.
Additionally, the correlation matrix can help traders and investors to manage risk. By analyzing the correlations between different assets, traders can identify opportunities to hedge their positions or limit their exposure to particular risks. For example, if a trader holds a portfolio of cryptocurrencies that are highly correlated with each other, they may be at greater risk of losses if the market moves against them. By diversifying their portfolio with assets that are less correlated with each other, they can reduce their overall risk.
Some of the unique properties for this specific script are the correlation strength levels in conjunction with the color gradient of cells, intended for clearer readability.
Features:
Supports up to 64 different crypto assets.
Dark/Light mode.
Correlation strength levels and cell coloring.
Adjustable positioning on the chart.
Alerts at the close of a bar. (Daily timeframe or higher recommended)
Manual PnL (Profit and Loss) % Tracker - spot long only
This is a manual profit and loss tracker. It takes the user's manual input of total cost and quantity, and then outputs a table on the bottom right of the chart showing the profit or loss %, average purchase price, gross profit or loss, and market value.
Instructions:
1. Double click the indicator title at the top left of the chart
2. Select the "Inputs" tab and click the empty field next to "Symbol" to enter the traded symbol+exchange. This entry MUST be the same as the chart you are on, for example BTCUSDT/BINANCE (indicator will not display otherwise)
3. Enter the Total Cost and Qty of shares/coins owned
4. Optional - change positive or negative colors
5. Optional - under the "Style" tab, change the color of the average price (AVG) line
Note that for the average price (AVG) line to be shown/hidden you must enable/disable "Indicator and financials labels" in the scales settings.
For crypto or other tickers that have prices in many decimal places I would suggest, for the sake of accuracy, adjusting the decimal places in the code so that for prices under $1 you will display more info.
For example let's say you purchase x number of crypto at a price of 0.031558 you should change the code displaying "0.00" on line 44 to "0.000000"
This will ensure that the output table and plotted line will calculate an average price with the same number of decimals.
Recessions & crises shading (custom dates & stats)Shades your chart background to flag events such as crises or recessions, in similar fashion to what you see on FRED charts. The advantage of this indicator over others is that you can quickly input custom event dates as text in the menu to analyse their impact for your specific symbol. The script automatically labels, calculates and displays the peak to through percentage corrections on your current chart.
By default the indicator is configured to show the last 6 US recessions. If you have custom events which will benefit others, just paste the input string in the comments below so one can simply copy/paste in their indicator.
Example event input (No spaces allowed except for the label name. Enter dates as YYYY-MM-DD.)
2020-02-01,2020-03-31,COVID-19
2007-12-01,2009-05-31,Subprime mortgages
2001-03-01,2001-10-30,Dot-com bubble
1990-07-01,1991-03-01,Oil shock
1981-07-01,1982-11-01,US unemployment
1980-01-01,1980-07-01,Volker
1973-11-01,1975-03-01,OPEC