Volume Price and FundamentalsVolume Price and Fundamentals indicators contains 4 exponential moving averages based upon Fibonnaci numbers as period (8, 21, 55 & 144) with crossovers and crossunders.
It also contain a table for volume and 50 Day Avg. Volume, Relative volume, Change in Volume, Volume Value, Up-Down Closing Basis days in last 50 days, Volume ratio (U/D Ratio) on last 50-day Up / Down days and along with fundamental analysis table with various Fundamental Analysis parameters and QoQ & YoY comparison basis for better investment decision making.
Analysis
Bull/Bear Candle % Oscillator█ OVERVIEW
This script determines the proportion of bullish and bearish candles in a given sample size. It will produce an oscillator that fluctuates between 100 and -100, where values > 0 indicate more bullish candles in the sample and values < 0 indicate more bearish candles in the sample. Data produced by this oscillator is normalized around the 50% value, meaning that an even 50/50 split between bullish and bearish candles makes this oscillator produce 0; this oscillator indirectly represents the percent proportion of bullish and bearish candles in the sample (see HOW TO USE/INTERPRETATION OF DATA ).
It has two overarching settings: 'classic' and 'range'.
█ CONCEPTS
This script will cover concepts related to candlestick analysis, volumetric analysis, and lower timeframes.
Candlestick Analysis - The idea behind this script is to solely look at the candlesticks themselves and derive information from them in a given sample. It separates candles into two categories, bullish (close > open) and bearish (close < open).
If the indicator's setting is set to 'classic', the size of candles do not matter and all are assigned a value of 1 or 0.
If the indicator's setting is set to 'range', specific candle ranges modify the proportion of bullish/bearish values. Bullish candle values include all bullish candles in the set from their lows to the close, plus the lower wicks of all bearish candles. Bearish candle values include all bearish candles in the set from their highs to the close, plus the upper wicks of all bullish candles.
Volumetric Analysis - One of this script's features allows the user to modify the bullish and bearish candle proportions by its 'weight' determined by its volume compared to the sample set's total volume. Volumetric analysis for the 'range' setting are more complex than 'classic' as described below.
Lower Timeframes - For volumetric analysis to be done on candle wicks, there needed to be a way to determine how much volume had occurred in the wick by itself to find the weight of upper and lower wicks. To accomplish this, I employed PineScrypt's request.security_lower_tf function to grab OHLC values of lower timeframe candles (as well as volume) to determine how much volume had occurred in the wicks of the chart resolution's candle. The default OHLC values used here are the lows for upper wicks and highs for lower wicks. These OHLC values are then compared to the chart resolution candle's close to determine if the volume of that lower timeframe candle should be shifted to the wick weight or stay in the current weight of that candle. The reason 'low' and 'high' are used here is to guarantee that 100% of the volume of a lower timeframe candle had occurred in the wick of the candle at the current resolution (see LIMITATIONS ).
Bullish candles will exclude volume of all lower timeframe candles whose lows were greater than that candle's close. Bearish candles will exclude volume of all lower timeframe candles whose highs were less than that candle's close. These wick volumes are then divided by the volume of the sample set, and wick sizes are then multiplied by this weight before being added to their specific bullish/bearish sums (lower wicks to bullish and upper wicks to bearish).
█ FEATURES
There are 13 inputs for the user to modify the behavior/visual representation of this script.
Sample Length - This determines how many candles are in the sample set to find the proportion of bullish and bearish candles.
Colors and Invert Colors - There are three colors set by the user: a bullish color, neutral color, and bearish color. The oscillator plots two lines, one at 0 and another that represents the proportion of bullish or bearish candles in the sample set (we'll call this the 'signal line'). If the oscillator is above 0, bullish color is used, bearish otherwise. This script generates a gradient to color a filled area between the 0 line and the signal line based on the historical values of the oscillator itself and the signal line. For bullish values, the closer the signal line is to the max (or restricted max described below) that the oscillator has experienced, the more colored toward bullish color the shaded area will be, using the neutral color as a starting point. The same is applied to the bearish values using the bearish color.
There is an additional input to invert the colors so that the bearish color is associated with bullish values and vise-versa.
Calculation Type - This determines the overarching behavior of the oscillator and has two settings:
Classic - The weight of candles are either 1 if they occurred and 0 if not.
Range - The weight of candles is determined by the size of specific sections as described in CONCEPTS - Candlestick Analysis .
Volume Weighted - This enables modifying the weights of candles as described in CONCEPTS - Volumetric Analysis and Lower Timeframes based on which Calculation Type is used.
Wick Slice Resolution - This is the lower timeframe resolution that will be used to slice the chart resolution's candle when determining the volumetric weight of wicks. Lower timeframe resolutions like '1 minute' will yield more precise results as they will give more data points to go off of (see LIMITATIONS ).
Upper/Lower Wick Source - These two inputs allow the user to select which OHLC values to compare against the chart resolution's candle close when determining which lower timeframe candles will have their volumes associated with the wicks of candles being analyzed at the chart's resolution.
Restrict Min/Max Data and Restriction - This will restrict the maximum and minimum values that will be used for the signal line when comparing its value to previous oscillator values and change how the color gradient is generated for the indicator. Restriction is the number of candles back that will determine these maximum and minimum values.
Display Min/Max Guide - This will plot two lines that are colored the corresponding bullish and bearish colors which follow what the maximum and minimum values are currently for the oscillator.
█ HOW TO USE/INTERPRETATION OF DATA
As mentioned in the OVERVIEW section, this oscillator provides an indirect representation of the percent proportion of bullish or bearish candles in a given sample. If the oscillator reads 80, this does not mean that 80% of all candles in the sample were bullish . To find the percentage of candles that were bullish or bearish, the user needs to perform the following:
50% + ((|oscillator value| / 100) * 50)%
If the oscillator value is negative, the value from above will represent the percentage of bearish candles in the sample. If it is positive, this value represents the percentage of bullish candles in the sample.
Example 1 (oscillator value = 80):
50% + ((|80| / 100) * 50)%
50% + ((0.80) * 50)%
50% + 40% = 90%
90% of the candles in the sample were bullish.
Example 2 (oscillator value = -43):
50% + ((|-43| / 100) * 50)%
50% + ((0.43) * 50)%
50% + 21.5% = 71.5%
71.5% of the candles in the sample were bearish.
An example use of this indicator would be to put in a 'buy' order when its value shows a significant proportion of the sampled candles were bearish, and put in a 'sell' order when a significant proportion of candles were bullish. Potential divergences of this oscillator may also be used to plan trades accordingly such as bearish divergence - price continues higher as the oscillator decreases in value and vise-versa.*
* Nothing in this script constitutes any form of financial advice. The user is solely responsible for their trading decisions and I will not be held liable for any losses or gains incurred with the use of this script. Please proceed with caution when using this script to assist with trading decisions.
█ LIMITATIONS
Range Volumetric Weights :
Because of the conditions that must be met in order for volume to be considered part of wicks, it is possible that the default settings and their intended reasoning will not produce reliable results. If all lower timeframe candles have highs or lows that are within the body of the candle at the chart's resolution, the volume for the wicks will effectively be 0, which is not an accurate representation of those wicks. This is one of the reasons why I included the ability to change the source values used for these conditions as certain OHLC values may produce more reliable/intended results under these conditions.
Wick Slice Resolution :
PineScript restricts the number of intrabar references to 100,000 total. This script uses 3 separate request.security_lower_tf calls and has a default resolution of 1 minute. This means that if the user were to set the oscillator to the Range setting, enable volume weighted, and had the Wick Slice Resolution set to 1 minute, this script will exceed this 100,000 reference restriction within 24 days of data and will not produce any results beyond the previous 23.14 days.
Below are example uses of all the different settings of this script, these are done on the 1D chart of COINBASE:BTCUSD :
Default Settings:
Classic - Volume Weighted:
Range - no Volume Weight:
Range - Volume Weighted (1 min slices):
Range - Volume Weighted (1 hour slices):
Display Min/Max Guide - No Restriction:
Display Min/Max Guide - Restriction:
Invert Colors:
Blockchain Fundamentals: 200 Week MA Heatmap [CR]Blockchain Fundamentals: 200 Week MA Heatmap
This is released as a thank you to all my followers who pushed me over the 600 follower mark on twitter. Thanks to all you Kingz and Queenz out there who made it happen. <3
Indicator Overview
In each of its major market cycles, Bitcoin's price historically bottoms out around the 200 week moving average.
This indicator uses a color heatmap based on the % increases of that 200 week moving average. Depending on the rolling cumulative 4 week percent delta of the 200 week moving average, a color is assigned to the price chart. This method clearly highlights the market cycles of bitcoin and can be extremely helpful to use in your forecasts.
How It Can Be Used
The long term Bitcoin investor can monitor the monthly color changes. Historically, when we see orange and red dots assigned to the price chart, this has been a good time to sell Bitcoin as the market overheats. Periods where the price dots are purple and close to the 200 week MA have historically been good times to buy.
Bitcoin Price Prediction Using This Tool
If you are looking to predict the price of Bitcoin or forecast where it may go in the future, the 200WMA heatmap can be a useful tool as it shows on a historical basis whether the current price is overextending (red dots) and may need to cool down. It can also show when Bitcoin price may be good value on a historical basis. This can be when the dots on the chart are purple or blue.
Over more than ten years, $BTC has spent very little time below the 200 week moving average which is also worth noting when thinking about price predictions for Bitcoin or a Bitcoin price forecast.
Notes
1.) If you do not want to view the legend do the following: Indicator options > Style tab > Uncheck "Tables"
2.) I use my custom function to get around the limited historical data for bitcoin. You can check out the explanation of it here:
Intraday Background Time RangesThis simple script was written for studying recurring intraday behaviours of financial instruments. With it, you can highlight up to 13 customizable time ranges on your chart, filling the corresponding background space with colors you prefer. You can then write a note for each range and it will be shown in the optional related table.
The experience shows that every financial instrument has its own personality. With this in mind, the script can be useful to study intraday charts with the purpose of discovering recurring behaviours of specific instruments over a certain time range and under specific circumstances (normal days, earnings days, days with catalysts, etc.) This can help the trader to deeply understand the instrument personality, and therefore also to decide whether to enter or exit the market if its behaviour meets or not his expectations.
Please note that this script only works on minute/hourly charts.
Correlation with Matrix TableCorrelation coefficient is a measure of the strength of the relationship between two values. It can be useful for market analysis, cryptocurrencies, forex and much more.
Since it "describes the degree to which two series tend to deviate from their moving average values" (1), first of all you have to set the length of these moving averages. You can also retrieve the values from another timeframe, and choose whether or not to ignore the gaps.
After selecting the reference ticker, which is not dependent from the chart you are on, you can choose up to eight other tickers to relate to it. The provided matrix table will then give you a deeper insight through all of the correlations between the chosen symbols.
Correlation values are scored on a scale from 1 to -1
A value of 1 means the correlation between the values is perfect.
A value of 0 means that there is no correlation at all.
A value of -1 indicates that the correlation is perfectly opposite.
For a better view at a glance, eight level colors are available and it is possible to modify them at will. You can even change level ranges by setting their threshold values. The background color of the matrix's cells will change accordingly to all of these choices.
The default threshold values, commonly used in statistics, are as follows:
None to weak correlation: 0 - 0.3
Weak to moderate correlation: 0.3 - 0.5
Moderate to high correlation: 0.5 - 0.7
High to perfect correlation: 0.7 - 1
Remember to be careful about spurious correlations, which are strong correlations without a real causal relationship.
(1) www.tradingview.com
VIX - SKEW DivergenceThe CBOE VIX is a well-known index representing market expectations for volatility over the next 30 days.
The CBOE SKEW is an index reflecting the perceived tail risk over the next 30 days.
When the SKEW rises over a certain level (~140/150), that means investors are hedging their exposure with options, because they are worried about an incoming market crash or a "black swan". If that happens when the VIX is very low and apparently there is no uncertainty, this can warn of a sudden change in direction of the market. You will see for yourself that an increasing divergence often anticipates a sharp fall of leading stock indexes, usually within two to four months.
This is probably not very relevant for the short-term trader but mid/long-term traders and market analysts may find it useful to clearly visualize the extent of the distance between the VIX and the SKEW. For that reason, I wrote this highly customizable script with which you can plot the two indexes and fill the space within them with a color gradient to highlight the maximum and minimum divergence. Additionally, you can fill the beneath VIX area with four different colors. It is also possible to plot the divergence value itself, so if you want you can draw trendlines and support/resistance levels on it.
Please note that the divergence per se doesn't predict anything and it's meant to be used synergistically with other technical analysis tools.
More informations here:
www.cboe.com
www.cboe.com
Inflation Adjusted Performance: Ticker/M2 money supplyPlots current ticker / M2 money supply, to give an idea of 'inflation adjusted performance'.
~In the above, see the last decade of bullish equities is not nearly as impressive as it seems when adjusted to account for the FED's money printing.
~Works on all timeframes/ assets; though M2 money supply is daily data release, so not meaningful to plot this on timeframe lower than daily.
~To display on same pane; comment-out line 6 and un-comment line 7; then save, remove and re-add indicator.
~Scale on the right is meaningless; this indicator is just to show/compare the shape of the charts.
Operating Cash Flow on Total Assets RatioThis indicator divides the company's Operating Cash Flow (TTM) by the company's Total Assets (FY). This ratio gives potential investors the amount of operating cash flow generated from every dollar of asset owned and is a measure of financial efficiency.
Strategy BackTest Display Statistics - TraderHalaiThis script was born out of my quest to be able to display strategy back test statistics on charts to allow for easier backtesting on devices that do not natively support backtest engine (such as mobile phones, when I am backtesting from away from my computer). There are already a few good ones on TradingView, but most / many are too complicated for my needs.
Found an excellent display backtest engine by 'The Art of Trading'. This script is a snippet of his hard work, with some very minor tweaks and changes. Much respect to the original author.
Full credit to the original author of this script. It can be found here: www.tradingview.com
I decided to modify the script by simplifying it down and make it easier to integrate into existing strategies, using simple copy and paste, by relying on existing tradingview strategy backtester inputs. I have also added 3 additional performance metrics:
- Max Run Up
- Average Win per trade
- Average Loss per trade
As this is a work in progress, I will look to add in more performance metrics in future, as I further develop this script.
Feel free to use this display panel in your scripts and strategies.
Thanks and enjoy :)
+ Multi-timeframe Multiple Moving Average LinesThis is a pretty simple script that plots lines for various moving averages (what I think are the most commonly used across all markets) of varying lengths of timeframes of the user's choosing. Timeframes range from 5 minutes up to one month, so regardless if you're a scalper or a swing trader there should be something here for you.
There are 8 lines (that can be turned on/off individually), which may seem like a lot, but if you use two averages and want to display four different timeframes for each, you can do that. The nice thing is that because the lines start plotting from the current bar they won't clutter up the screen. And obviously having moving averages from different timeframes on your chart makes price action more difficult to read (I mean sure, you can make them invisible, but who wants to do that all the time).
For each line there are two labels. One with the moving average type, and the other with its specific timeframe. I can't include the moving average length because it's not a string input. If anyone has a workaround for this, let me know, otherwise I would simply recommend setting different colors depending on the length, or if you only use one or two lengths and one or two moving averages this shouldn't be an issue. I had to use two labels because for the label text I couldn't include more than one string input, this is why there is an input for the 'moving average type label distance.'' You will want to adjust this depending on if you are trading crypto, futures, or forex because in some cases there may still be label overlap.
Pretty much everything else is self-explanatory.
I've added alerts. I might need to modify them if I can, because it would be nice for them to state the name and timeframe of the moving average. But I think this will do for now.
Enjoy!
Volume Spread for VSA CustomHey everyone, I have been using volume a lot more lately as price action can sometimes get manipulated but volume shows us the truth!
Anyways, I have enjoyed the Volume Spread for VSA indicator but wished I had the code to change a few settings. This volume indicator includes spread analysis with the ability to customize input values and I'm making it open source so you can do with it as you please.
I have made notes all throughout the code to give suggestions on a few changes or why I have written it in such a way. I have also tried to section everything off to make it easier to see where each piece of the code is used. Overall I think it is a good example of how to code cleanly and how to add useful notes when you are learning Pine for yourself :D
The indicator on the price chart is my Donchian Channel indicator, which you can also find on my profile. This is the one I use every day.
Trend IdentifierTrend Identifier for 1D BTC.USD
It smoothens a closely following moving average into a polynomial like plot.
And assumes 4 stage cycles based on the first and second derivatives.
Green: Bull / Exponential Rise
Yellow: Distribution
Red: Bear / Exponential Drop
Blue: Accumulation
Red --> Blue --> Green: indicates the start of a bull market
Green --> Yellow --> Red: indicates the start of a bear market
Green --> Yellow: Start of a distribution phase, take profits
Red --> Blue: Start of a accumulation phase, DCA
Bitcoin OnChain & Other MetricsHi all,
In these troubled times, going back to fundamentals can sometimes be a good idea 😊
I put this one up using data retrieved from “Nasdaq Data Link” and their “Blockchain.com” database.
Here is a good place to analyses some Bitcoin data “outside” its price action with 25 different data sets.
Just go to the settings menu and display the ones you are interested in.
If you want me to add more metrics, feel free to DM or comment below!
Hope you enjoy 😉
Ichimoku PeeksThis indicator uses the Ichimoku Tenkan / Kijun trend line formulas to predict what those values will be in the future if current price action does not violate the period highs and lows.
Because of the way Ichimoku formulates the trend, it contains (but does not visualize) this predictive information in a way that moving averages do not.
Sharp chart readers can infer upcoming changes by counting back candles, but the process can be automated, as I've shown here.
This description does not seem to be editable so implementation details and usage will be covered in code commentary.
MACD Scalper AnalysisThis is a scalper analysis movement designed around MACD and 200 EMA
The rules are simple:
For long we check if the close of the candle is above the ema200 and we have a crossover between macd and signal
Once this happens we analyse the next candle, if its close higher than open , we can consider it a win and if its close lower than open we consider a lose.
For short we check if the close of the candle is below the ema200 and we have a crossunder between macd and signal
Once this happens we analyse the next candle, if its close higher than open , we can consider it a loss and if its close lower than open we consider a win.
Once we have all of this we analyse the average percentage movement and establish if the specific asset or timeframe is worthy for us.
At the same time it can give a good idea if we can go with a divergence strategy, like for example we have a short entry, but we will actually go long and viceversa.
If you have any questions let me know !
Determine Consecutive Candles█ OVERVIEW
This is a simple script that will plot labels over or under candles to show where there had been consecutive candles that closed in a similar fashion. This script was inspired by a Tweet about Bitcoin experiencing its first 7th-consecutive weekly black candle and I sought out to test that.
█ INPUTS
There are three inputs for this script.
"offset" ( integer ) - (Can be 0 or 1) Allows the user to apply this script at the currently closing candle or the most recently closed candle.
"Number of Candles" ( integer ) - (From 3 to 100*) Allows the user to select how many candles to back test for consecutive-ness.
"Black or White" ( boolean ) - Allows the user to select what kinds of candles to look for in this script. (true - Black , false - White ).
*Publishing open-sourced, this selection was arbitrary and can be modified at will.
█ USAGE
Because I had created this in a little over an hour, this is just a simple experiment that I wanted to share with others. Its applications are unknown to me, but I am interested in hearing how others may find what this script does useful.
[blackcat] L3 Financial Minesweeper: Altman Z ScoreLevel: 3
Background
The Altman Z-score is the output of a credit-strength test that gauges a publicly traded manufacturing company's likelihood of bankruptcy. The Altman Z-score is a formula for determining whether a company, notably in the manufacturing space, is headed for bankruptcy.
Function
The possibility of financial failure or bankruptcy of the enterprise is analyzed and predicted through the comprehensive score. The lower the Z value, the more likely the enterprise will go bankrupt. By calculating the Z value of an enterprise for several consecutive years, we can find out whether the enterprise has signs of financial crisis. Generally speaking, when the Z value is greater than 2.675, it indicates that the financial situation of the enterprise is good, and the possibility of bankruptcy is small; When the value is less than 1.81, it indicates that the enterprise is in a potential bankruptcy crisis; when the Z value is between 1.81 and 2.675, it is called a "gray area, indicating that the financial situation of the enterprise is extremely unstable.
Remarks
STOCKs ONLY which require financial data.
X1~X5 coefficients can be customized for different stock markets.
Compared to TradingView official Altman Z-Score Indicator.
Feedbacks are appreciated.
Volatility Calculator for Daily Top and Bottom RangeWith the usage of ATR, applied on the close of the daily candle, I am calculated the volatility channels for the TOP and BOTTOM
Based on this logic, we can estimate, with a huge confidence factor, where the prices are going to be compressed for the trading day.
Having said that, lets take a look at the data gathered among the most important financial markets:
SPX
TOP CROSSES : 2116
BOT CROSSES : 1954
Total Daily Candles : 18908
Occurance ratio = 0.215
NDX
TOP CROSSES : 1212
BOT CROSSES : 1183
Total Daily Candles : 9386
Occurance ratio = 0.255
DIA
TOP CROSSES : 759
BOT CROSSES : 769
Total Daily Candles : 6109
Occurance ratio = 0.25
DXY
TOP CROSSES : 1597
BOT CROSSES : 1598
Total Daily Candles : 13156
Occurance ratio = 0.243
DAX
TOP CROSSES : 1878
BOT CROSSES : 1848
Total Daily Candles : 13155
Occurance ratio = 0.283
BTC USD
TOP CROSSES : 416
BOT CROSSES : 417
Total Daily Candles : 4290
Occurance ratio = 0.194
ETH USD
TOP CROSSES : 247
BOT CROSSES : 268
Total Daily Candles : 2452
Occurance ratio = 0.21
EUR USD
TOP CROSSES : 820
BOT CROSSES : 805
Total Daily Candles : 7489
Occurance ratio = 0.217
GOLD
TOP CROSSES : 1722
BOT CROSSES : 1569
Total Daily Candles : 13747
Occurance ratio = 0.239
USOIL
TOP CROSSES : 1077
BOT CROSSES : 1089
Total Daily Candles : 10231
Occurance ratio = 0.212
US 10Y
TOP CROSSES : 1302
BOT CROSSES : 1365
Total Daily Candles : 9075
Occurance ratio = 0.294
Based on this, we can assume with a very high confidence ( 70-80%) that the market is going to stay, within the range created from the BOT and TOP ATR points.
Heikin Multi Time Frame// How it Works \\
This script calculates the open and close prices of Heikin Ashi candles across multiple timeframes,
If the candle formed on that timeframe is green it will display in the table a green square, If the candle is red, the square will display red.
// Settings \\
You can change the colours of the plots
You can also Change any of the timeframes which the Heikin Ashi candles are being calculated on
// Use Case \\
Heikin Ashi candles are often used to give a smoother trend direction and help cancel out some of the noice/consolidation.
It can also be use as trend detection for multiple timeframes at once
/ / Suggestions \\
Happy for anyone to make any suggestions on changes which could improve the script,
// Terms \\
Feel free to use the script, If you do use the scrip please just tag me as I am interested to see how people are using it. Good Luck!
IsPullbackPivotRetested experimentThe indicator counts how often a pullback that starts outside the Keltner Channel resolves or fails.
Resolves: the pullback high or low is retested.
Fails: price goes outside the oppositie side of the Keltner Channel.
FunctionPolynomialFitLibrary "FunctionPolynomialFit"
Performs Polynomial Regression fit to data.
In statistics, polynomial regression is a form of regression analysis in which
the relationship between the independent variable x and the dependent variable
y is modelled as an nth degree polynomial in x.
reference:
en.wikipedia.org
www.bragitoff.com
gauss_elimination(A, m, n) Perform Gauss-Elimination and returns the Upper triangular matrix and solution of equations.
Parameters:
A : float matrix, data samples.
m : int, defval=na, number of rows.
n : int, defval=na, number of columns.
Returns: float array with coefficients.
polyfit(X, Y, degree) Fits a polynomial of a degree to (x, y) points.
Parameters:
X : float array, data sample x point.
Y : float array, data sample y point.
degree : int, defval=2, degree of the polynomial.
Returns: float array with coefficients.
note:
p(x) = p * x**deg + ... + p
interpolate(coeffs, x) interpolate the y position at the provided x.
Parameters:
coeffs : float array, coefficients of the polynomial.
x : float, position x to estimate y.
Returns: float.
Key Financials A simple table with up to 9 key financials on your chart.
Simple, easy and configurable.