Portfolio Performance - 2 AssetsFunction:
- Can be used to evaluate the performance of portfolios containing 2 assets over a set time interval
- Created to evaluate of the performance of portfolios containing different weightings of stocks and bonds over time
- Shows the % return of each portfolio over the time interval defined by the user
- Capable of showing the risk adjusted % return of each portfolio over the time interval defined by the user (setting turned off by default)
Instructions:
- To be used with dividends adjustments turned on
- Add this script to a symbol. e.g. NASDAQ:BND
- Click the chart to define the entry time and the exit time. i.e. the time interval
- Define the second asset to be included in the portfolio. e.g. AMEX:VOO
- The strategy comes pre-populated with 6 portfolios with the most common stock/bond weightings (100% stocks/0% bonds, 80% stocks/20% bonds, 60% stocks/40% bonds, et cetera)
- The 6 lines show the weighted % return of each portfolio over the time period defined by the user
- All asset weights are adjustable via the settings
- Each plot can be turned on and turned off via a tick box in the settings
- There are 6 plots that show the risk adjusted returns of each portfolio (setting turned off by default)
ヒストリカル・ボラティリティ
Live off your portofolio (decumulate)This indicator simulates living off your portofolio consisting of a single security or stock such as the SPY etf or even Bitcoin. The simulation starts at a certain point on the chart (which you input as year and month).
Withrawals from the portofolio are made each month according to the yearly withdrawal rate you enter, such as the 4% SWR. The monthly withdrawal income is calculated in USD at the beginning of the retirement period and then adjusted according to the US inflation (CPI) on 01/01 of each year.
The blue graph represents the USD value of the remaining portofolio.
This indicator is meant to be used on daily, weekly or monthly time frame. It may not work properly (and makes little sense to use) on intraday timeframe or larger time frames such as quarterly (3M).
When withdrawing, the indicator considers that fractional stock values can be used (the portofolio value is kept as a float). This may not be true, as most stock brokers currently don't allow this.
It does not explicitly take into account dividends. In order to do this you will have to enable "Adjust for dividends" by clicking on "adj" in the lower right corner of the screen, or by using the indicator on a Total Return (TR) index such as DAX. Unfortunately SPX does not have dividend data, you will have to use the SPY etf (which doesn't have a long history)
Price Action [Morty]This price action indicator uses the higher timeframe SSL channel to identify trends.
The long entry signal is a bullish candlestick pattern when the price retraces to EMA20 in an uptrend.
The short entry signal is a bearish candlestick pattern when the price retraces to the EMA20 in a downrend.
Currently, this indicator shows engulfing patterns, pin bar patterns, 2 bar reversal patterns and harami patterns.
It also shows a volatility squeeze signal when the Bollinger bands is within the Kelter channels.
The buy and sell signal can also be filter by the ADX indicator greater than a threshold.
You can set your stoploss to the previous low/high when you go long/short.
The risk/reward ratio could be 1 to 1.5.
This indicator can be used in any market.
VixFix RVol + EMAThis indicator plots Realised Volatility (measured using VixFix method) against its long-term exponential moving average.
RVol breaking above its EMA = Sell signal
RVol breaking below its EMA = Buy signal
60-day VixFix look back period and 900 day EMA work well for lower volatility tickers (equity ETFs, megacap stocks). Higher volatility tickers could benefit from shorter look back period and EMA.
Outside DayThis strategy is taken from Perry Kaufman's book "Trading System and Methods".
You can enter on the direction of the candle, or opposite to it. I find that the opposite tends to yield better results in volatile assets, allowing a better reward to risk ratio. There is no stop loss in this strategy, only a fixed take profit and a time limitation.
Average Daily RangeRe-Re-upload!
There are a handful of decent Average Daily Range indicators out there.
Often they are built using Pinescript v2 (severely outdated) or have no customization or are "Closed Source"
In this version, you can select two multipliers to display on chart
Primary Mult - Large Green or Red crosses, by default set to 1 or 100% of ADR
Secondary Mult - Small Aqua or Maroon crosses, by default set to 0.5 or 50% of ADR
Cheers,
EFX
Advanced Forex SessionsEssential for ALL Forex Day Traders!
Don't waste your time trading Forex Sessions with little to no volume or volatility!
The Advanced Forex Sessions tool will search through all 4 sessions, tally up the total volume and ticks moved, and show you which session has the most movement.
It will show you the two best sessions on chart and optionally color the background too.
Configure the position & size of the Infographic table as well as custom Forex Session times and colors.
Forex Trading SessionsThere are a million Forex Trading Session indicators out there, but I couldn't find one with all of the following requirements:
1. Automatically show the Sessions that actually affect the current pair (for instance, Tokyo session doesn't matter when trading EURGBP)
2. Editable colors or at the very least no distracting colors
3. Editable times for each exchange session
4. Unique indication of the start of a session vs the end of a session. (Sometimes, I don't notice a background going from Navy Blue to Black)
This indicator has everything I could ever want in a Sessions Tool:
Subdued default colors
Editable colors
Editable session ranges
Obvious, but not obnoxious indication of start and stop
Automatically hide irrelevant Sessions
Cheers. EFX
Bar StatisticsThis script calculates and displays some bar statistics.
For the bar length statistics, it takes every length of upper or lower movements and calculates their average (with SD), median, and max. That way, you can see whether there is a bias in the market or not.
Eg.: If for 10 bars, the market moved 2 up, then 1 down, then 3 up, then 2 down, and 2 up, the average up bars length would be at 2.33, while the average for the down length would be at 1.5, showing that upper movements last longer than down movements.
For the range statistics, it takes the true range of each bar and calculates where the close of the bar is in relation to the true low of it. So if the closing of the bar is at 10.0, the low is at 9.0, and the high is at 10.2, the candle closed in the upper third of the bar. This process is calculated for every bar and for both closing prices and open prices. It is very useful to locate biasses, and they can you a better view of the market, since for most of the time a bar will open on an extreme and close on another extreme.
Eg.: Here on the DJI, we can see that for most of the time, a month opens at the lower third (near the low) and closes at the upper third (near the high). We can also see that it is very difficult for a month to open or close on the middle of the candle, showing how important the first and the last day are for determining the trend of the rest of the month.
myRangestatCalculates the average daily range as well as the standard deviation of the daily range over a given period.
Adding both values gives you a statistical range (bottom to top or top to bottom) in which price can be expected to move.
pricing_tableThis script helps you evaluate the fair value of an option. It poses the question "if I bought or sold an option under these circumstances in the past, would it have expired in the money, or worthless? What would be its expected value, at expiration, if I opened a position at N standard deviations, given the volatility forecast, with M days to expiration at the close of every previous trading day?"
The default (and only) "hv" volatility forecast is based on the assumption that today's volatility will hold for the next M days.
To use this script, only one step is mandatory. You must first select days to expiration. The script will not do anything until this value is changed from the default (-1). These should be CALENDAR days. The script will convert to these to business days for forecasting and valuation, as trading in most contracts occurs over ~250 business days per year.
Adjust any other variables as desired:
model: the volatility forecasting model
window: the number of periods for a lagged model (e.g. hv)
filter: a filter to remove forecasts from the sample
filter type: "none" (do not use the filter), "less than" (keep forecasts when filter < volatility), "greater than" (keep forecasts when filter > volatility)
filter value: a whole number percentage. see example below
discount rate: to discount the expected value to present value
precision: number of decimals in output
trim outliers: omit upper N % of (generally itm) contracts
The theoretical values are based on history. For example, suppose days to expiration is 30. On every bar, the 30 days ago N deviation forecast value is compared to the present price. If the price is above the forecast value, the contract has expired in the money; otherwise, it has expired worthless. The theoretical value is the average of every such sample. The itm probabilities are calculated the same way.
The default (and only) volatility model is a 20 period EWMA derived historical (realized) volatility. Feel free to extend the script by adding your own.
The filter parameters can be used to remove some forecasts from the sample.
Example A:
filter:
filter type: none
filter value:
Default: the filter is not used; all forecasts are included in the the sample.
Example B:
filter: model
filter type: less than
filter value: 50
If the model is "hv", this will remove all forecasts when the historical volatility is greater than fifty.
Example C:
filter: rank
filter type: greater than
filter value: 75
If the model volatility is in the top 25% of the previous year's range, the forecast will be included in the sample apart from "model" there are some common volatility indexes to choose from, such as Nasdaq (VXN), crude oil (OVX), emerging markets (VXFXI), S&P; (VIX) etc.
Refer to the middle-right table to see the current forecast value, its rank among the last 252 days, and the number of business days until
expiration.
NOTE: This script is meant for the daily chart only.
Average Daily Range Fibonacci LevelsThe Average Daily Range is a simple concept, calculated as the difference between daily highs and lows averaged over some period. This indicator uses that range in conjunction with Fibonacci ratios to create zones centered on the day's open that tends to act as areas of support and resistance.
The thicker White lines are the ADR levels; all other lines are the same value adjusted by the various Fibonacci values.
A simpler version of this concept can be seen in my other script, Average Daily Range Zones, which does not include the Fibonacci ratio zones.
Thanks to @Hank Hill for the original idea and TV for the feedback and support on the use of the security() function.
Also thanks to @GoldenCross for the Fibonacci obsession.
Average Daily Range ZonesThe Average Daily Range is a simple concept, calculated as the difference between daily highs and lows averaged over some period. This range is is overlaid and centered on the day's open, and tends to act as areas of support and resistance . This indicator provides two aggregation periods, creating a range that represents volatility in the ADR; a wider spread indicates greater recent volatility , and vice-versa.
Thanks to @Hank Hill for the original idea and ToS script this is based on, and TV for the feedback and support on the use of the security() function.
tr_volThis indicator shows the annualized volatility, computed using the ewma method. It also uses average true range (ATR) as the daily return, rather than the typical close-to-close percentage change. You can uncomment the "comparison" series to see how it compares to the standard deviation, daily log return method. The standard deviation method weights all periods equally and doesn't account for intra-day ranges, meaning it is less responsive to new information than the ewma method and doesn't weight large intra-day moves as heavily.
The long-run median is also displayed. This feature sometimes fails if there are too many bars.
Volatility IndexThis indicator is based on Historical Volatility (HV) built-in indicator with minor tweaks to match the Bitcoin Volatility Index (from Bybt).
Also, you can select a symbol to compare its volatility with the volatility of the currently selected symbol.
Ultimate Volatility Indicator [CC]The Ultimate Volatility Indicator was created by Richard Poster (Stocks and Commodities July 2021 pg 21) and this is a very simple but effective indicator. The idea behind volatility indicators is that when the indicator rises above a certain threshold then volatility is high enough and you can make a good amount of money riding the trend in the current direction and then exit when volatility drops below the threshold or until the underlying trend changes.
I have included a threshold that you can change from the default but I would recommend trying out different values to see what works best for you. This indicator will let you know as soon as volatility increases and reacts very quickly. I have included strong buy and sell signals in addition to normal ones so darker colors are strong buy and sell signals and lighter colors are normal signals. Buy when the line turns green and sell when it turns red.
Please let me know if you would like to see me publish any other indicators!
Candle PowerThis script shows power of candle during last average candle bodies. useful for detect pullback signals.
CUSTOM intraday volatility chart clockChart clock showing an overview of the day's expected and actual intraday volatility.
In white are only the expected volatility scores. The expected increase or decrease in volatility at any given hour of day compared to the average of the whole day's expected volatility. A 0.5 score two hours from now means that you can expect that hour to be 0.5% more volatile than the average of whole day's volatility.
In blue are the actual or realized volatility scores; the difference between that hour's volatility and what was expected to be its volatility is displayed as a blue bar. If two three hours ago was expected to be a more volatile hour of the day but no movement occurred, a large down bar will print for that hour.
Large swings of daily volatility (i.e. this month is much more or much less volatility than the last) will bias the clock usually only a little higher or lower, although historical volatility peaks/depressions will show the blue realized volatility score to be consistently high/low.
If requested I can change the look of the indicator or add input settings for the input length of clock, which for now is set to 20 bars, which is an approximation of the last month's realized volatility.
Session Volatility CalculatorHey traders!
This script calculates the average volatility of trading sessions.
You specify a start date, an end date, and a session time (eg. market open, Asian session etc)
The script then scans through all the price action on your chart and calculates the average price movement during that specified period.
What Is It For?
I created this script for my own purposes when developing certain strategies and testing certain ideas.
The purpose of this script is to give you an idea of how much price tends to move during certain times of day for certain markets.
You could think of it as a "session's average true range".
In crypto and forex this might be how much price tends to move on certain pairs during the Australian/Asian session, or the European session, or the overnight U.S. session etc.
In stocks this might be how much a symbol tends to move during the first hour of the day or the last hour of the day.
The point of calculating this information is for better understanding how markets move during certain times of day.
It's not a perfect science obviously since some days can be wilder than others depending on what fundamental events are developing, but it's useful information to have for times when there are no expected volatility-inducing events.
This info can help with optimizing targets and stop loss placement for certain day-trading strategies, and just generally getting an idea of what kinds of moves you might reasonably expect out of overnight positions or certain times of day etc - or at least that's what I use it for.
Settings
Hover your mouse over the "i" symbol to get more information on the script's settings, but here's a brief description:
Start Date: The date to begin calculating from (set to 1000 by default so it scans the entire chart).
End Date: The date to stop calculating (set to 2099 by default so it scans the entire chart)
Time Session: This is the time session during the day that you want to analyze.
Color Background: If turned on, this setting changes the background color to highlight the session.
Indicator Values
The indicator outputs a handful of values onto your chart. This is what the colors correspond to:
Top-Right Box: The average price range during the given time of day over historical price action.
Green Number: The recent session's highest price.
Red Number: The recent session's lowest price.
Purple Number: The recent session's price range (high - low).
Orange Number: The recent session's range ÷ the average (outputs a relative % of the average).
Fourth Friday FutureThere seems to be an options contract that comes due on the fourth Friday of every month, causing massive dips in the crypto market; this indicator colors your chart to tell you when this is going to happen.
Previous Day, Week, Month High/Low Line IndicatorMade a line indicator for previous Daily Weekly & Monthly High / Low. You can use all 3 (D,W,M) or just one by editing the settings.
Day and Time HighlightYet another sweet little tool that highlights only specific days and time.
For example, you can highlight only Tuesday's and Friday's from 0930-1600
You can adjust to any day of the week and any time of the day.
You can request more improvements upon this version. Cheers!
Like if you Like and Follow me for upcoming indicators/strategies: www.tradingview.com
Historical Volatility Percentile FilterThis indicator provides a simple market regime filter for Historical Volatility. Depending on the strategy that you are using, it is useful to know how your strategy will perform at different
ranges of volatility, as this can greatly impact your performance. For instance, some of my long-only mean reversion strategies will only take trades where the volatility percentile is not extremely high, as this can often indicate fundamental changes in the security or the start of a big market correction. Some strategies may work better when volatility is higher
Feel free to use the following code along with your strategies to help improve performance and reduce the volatility of your gains in the long term.