On Balance Volume FieldsThe On Balance Volume (OBV) indicator was developed by Joseph E. Granville and published first in his book "New key to stock market profits" in 1963. It uses volume to determine momentum of an asset. The base concept of OBV is - in simple terms - you take a running total of the volume and either add or subtract the current timeframe volume if the market goes up or down. The simplest use cases only use the line build that way to confirm direction of price, but the possibilities and applications of OBV go far beyond that and are (at least to my knowledge) not found in existing indicators available on this platform.
If you are interested to get a deeper understanding of OBV, I recommend the lecture of the above mentioned book by Granville. All the features described below are taken directly from the book or are inspired by it (deviations will be marked accordingly). If you have no prior experience with OBV, I recommend to start simple and read an easy introduction (e.g. On-Balance Volume (OBV) Definition from Investopedia) and start applying the basic concepts first before heading into the more advanced analysis of OBV fields and trends.
Markets and Timeframes
As the OBV is "just" a momentum indicator, it should be applicable to any market and timeframe.
As a long term investor, my experience is limited to the longer timeframes (primarily daily), which is also how Granville applies it. But that is most likely due to the time it was developed and the lack of lower timeframe data at that point in time. I don't see why it wouldn't be applicable to any timeframe, but cannot speak from experience here so do your own research and let me know. Likewise, I invest in the crypto markets almost exclusively and hence this is where my experience with this indicator comes from.
Feature List
As a general note before starting into the description of the individual features: I use the colors and values of the default settings of the indicator to describe it. The general look and feel obviously can be customized (and I highly recommend doing so, as this is a very visual representation of volume, and it should suit your way of looking at a chart) and I also tried to make the individual features as customizable as possible.
Also, all additions to the OBV itself can be turned off so that you're left with just the OBV line (although if that's what you want, I recommend a version of the indicator with less overhead).
Fields
Fields are defined as successive UPs or DOWNs on the OBV. An UP is any OBV reading above the last high pivot and subsequently a DOWN is any reading below the last low pivot. An UP-field is the time from the first UP after a DOWN-field to the first DOWN (not including). The same goes for a DOWN field but vice versa.
The field serves the same purpose as the OBV itself. To indicate momentum direction. I haven't found much use for the fields themselves other than serving as a more smoothed view on the current momentum. The real power of the fields emerges when starting to determine larger trends of off them (as you will see soon).
Therefor the fields are displayed on the indicator as background colors (UP = green, DOWN = red), but only very faint to not distract too much from the other parts of the indicator.
Major Volume Trend
The major volume trend - from which Granville says, it's the one that tends to precede price - is determined as the succession of the highest highs and lowest lows of UP and DOWN fields. It is represented by the colors of the numbers printed on the highs and lows of the fields.
The trend to be "Rising" is defined as the highest high of an UP field being higher than the highest high of the last UP field and the lowest low of the last DOWN field being higher than the lowest low of the prior DOWN field. And vice versa for a "Falling" trend. If the trend does not have a rising or falling pattern, it is said to be "Doubtful". The colors are indicated as follows:
Rising = green
Falling = red
Doubtful = blue
ZigZag Swing count
The swing count is determined by counting the number of swings within a trend (as described above) and is represented by the numbers above the highs and lows of the fields. It determines the length and thus strength of a trend.
In general there are two ways to determine the count. The first one is by counting the swings between pivots and the second one by counting the swings between highs and lows of fields. This indicator represents the SECOND one as it represents the longer term trend (which I'm more interested in as it denotes a longer term perspective).
However, the ZigZag count has three applications on the OBV. The "simple ZigZag" is a count of three swings which mainly tells you that the shorter term momentum of the market has changed and the current trend is weakening. This doesn't mean it will reverse. A count of three downs is still healthy if it occurs on a strong uptrend (and vice versa) and it should primarily serve as a sign of caution. If the count increases beyond three, the last trend is weakening considerably, and you should probably take action.
The second count to look out for is five swings - the "compound ZigZag". If this goes hand in hand with breaking a major support/resistance on the OBV it can offer a buying/selling opportunity in the direction of the trend. Otherwise, there's a good chance that this is a reversal signal.
The third count is nine. To quote Granville directly: "there is a very strong tendency FOR MAJOR REVERSAL OF REND AFTER THE NINTH SWING" (emphasis by the author). This is something I look out for and get cautious about, although I have found signal to be weak in an overextended market. I have observed counts of 10 and even 12 which did not result in a major reversal and the market trended further after a short period of time. This is still a major sign of caution and should not be taken lightly.
Moving average
Although Granville talks only briefly about averages and the only mention of a specific one is the 10MA, I found moving averages to be a very valuable addition to my analysis of the OBV movements.
The indicator uses three Exponential Moving Averages. A long term one to determine the general direction and two short term ones to determine the momentum of the trend. Especially for the latter two, keep in mind that those are very indirect as they are indicators of an indicator anyway and I they should not necessarily be used as support or resistance (although that might sometimes be helpful). I recommend paying most attention to the longterm average as I've found it to be very accurate when determining the longterm trend of a market (even better than the same indicator on the price).
If the OBV is above the long term average, the space between OBV and average is filled green and filled red if below. The colors and defaults for the averages are:
long term, 144EMA, green
short term 1, 21EMA, blue
short term 2, 55EMA, red
Divergences
This is a very rudimentary adaption of the standard TradingView "Divergence Indicator". I find it helpful to have these on the radar, but do not actively use them (as in having a strategy based on OBV/price divergence). This is something that I would eventually pick up in a later version of the indicator if there is any demand for it, or I find the time to look into strategies based on this.
Comparison line
A small but very helpful addition to the indicator is a horizontal line that traces the current OBV value in real time, which makes it very easy to compare the current value of the OBV to historic values (which is a study I can highly recommend).
Breadth Indicators
sDEFI Synthetix ExchangeStudy plotting sDEFI per sips.synthetix.io
Scale on the axis is not correct, it will always show whatever the base asset you open and hide. Use this study only for visual charting.
90% DaysIndicator from the paper "IDENTIFYING BEAR MARKET BOTTOMS AND NEW BULL MARKETS"
This paper was the winner of the prestigious 2002 Charles H. Dow Award. Each year the Market Technicians Association, in alliance with Dow Jones and Company, presents an award for excellence in the field of Technical Analysis. The recipient of that award in 2002 was Paul Desmond, President of Lowry Research Corporation.
"Important market bottoms are preceded by, and result from, important market declines.
And, important market declines are, for the most part, a study in the extremes of human emotion.
The intensity of their emotions can be statistically measured through their purchases and sales. To
clarify, as prices initially begin to weaken, investor psychology slowly shifts from complacency to
concern, resulting in increased selling and an acceleration of the decline. As prices drop more
quickly, and the news becomes more negative, the psychology shifts from concern to fear. Sooner
or later, fear turns to panic, driving prices sharply lower, as investors strive to get out of the market
at any price. It is this panic stage that drives prices down to extreme discounts – often well below
book values – that is needed to set the stage for the next bull market. Thus, if an investor had a
method for identifying and measuring panic selling, at least half the job of spotting major market
bottoms would be at hand.
Over the years, a number of market analysts have attempted to define panic selling (often
referred to as a selling climax, or capitulation) in terms of extreme activity, such as unusually
active volume, a massive number of declining stocks, or a large number of new lows. But, those
definitions do not stand up under critical examination, because panic selling must be measured in
terms of intensity, rather than just activity. To formulate our definition of panic selling, we
reviewed the daily history of both the price changes and the volume of trading for every stock
traded on the New York Stock Exchange over a period of 69 years, from 1933 to present. We
broke the volume of trading down into two parts – Upside (buyers) Volume and Downside (sellers)
Volume. We also compiled the full and fractional dollars of price change for all NYSE-listed
stocks that advanced each day (Points Gained), as well as the full and fractional dollars of price
change for all NYSE-listed stocks that declined each day (Points Lost). These four daily totals –
Upside Volume and Points Gained, Downside Volume and Points Lost – represent the basic
components of Demand and Supply, and have been an integral part of the Lowry Analysis since
1938. (Note: an industrious statistician can compile these totals from the NYSE stock tables in
each day’s Wall Street Journal.)
In reviewing these numbers, we found that almost all periods of significant market decline
in the past 69 years have contained at least one, and usually more than one, day of panic selling in
which Downside Volume equaled 90.0% or more of the total of Upside Volume plus Downside
Volume, and Points Lost equaled 90.0% or more of the total of Points Gained plus Points Lost.
...
But, there is a second key ingredient to every major market bottom. It is essential to
recognize that days of panic selling cannot, by themselves, produce a market reversal, any more
than simply lowering the sale price on a house will suddenly produce an enthusiastic buyer. As the
Law of Supply and Demand would emphasize, it takes strong Demand, not just a reduction in
Supply, to cause prices to rise substantially. It does not matter how much prices are discounted; if
investors are not attracted to buy, even at deeply depressed levels, sellers will eventually be forced
to discount prices further still, until Demand is eventually rejuvenated. Thus, our 69-year record
shows that declines containing two or more 90% Downside Days usually persist, on a trend basis,
until investors eventually come rushing back in to snap up what they perceive to be the bargains of
the decade and, in the process, produce a 90% Upside Day (in which Points Gained equal 90.0% or
more of the sum of Points Gained plus Points Lost, and on which Upside Volume equals 90.0% or
more of the sum of Upside plus Downside Volume). These two events – panic selling (one or more
90% Downside Days) and panic buying (a 90% Upside Day, or on rare occasions, two back-toback 80% Upside Days)
– produce very powerful probabilities that a major trend reversal has
begun, and that the market’s Sweet Spot is ready to be savored."
Includes an option to display 90% days for NASDAQ, but these are much rarer and, oddly, there are no Upside Days.
*Includes an option for repainting -- default value is true, meaning the script will repaint the current bar.
False = Not Repainting = Value for the current bar is not repainted, but all past values are offset by 1 bar.
True = Repainting = Value for the current bar is repainted, but all past values are correct and not offset by 1 bar.
In both cases, all of the historical values are correct, it is just a matter of whether you prefer the current bar to be realistically painted and the historical bars offset by 1, or the current bar to be repainted and the historical data to match their respective price bars.
As explained by TradingView,`f_security()` is for coders who want to offer their users a repainting/no-repainting version of the HTF data.
Market Traffic LightThis indicator visualizes warning and panic signs, which are shown separately.
1. Section (Fear & Greed)
Approximation of the CNN Money Fear & Greed index based on code of user MagicEins. The index shows values between 0 (extreme fear, red) and 100 (extreme greed, green).
2. Section (warning signs)
VIX: Values above 20 are red and below green. The legend shows the value of the current bar including the change from the bar before. The average VIX is about 16. Values over 20 are a sign of stressed market.
Distribution days: A distribution day (loss to the day before > 0,2 % and higher volume) is marked with a yellow dot. In case there are more than four distributions days within 25 markets days the dot is orange. When big players redistribute their investments distribution days can occur. If this is done often (more than four times within 25 market days) it is possible that the markets changes or that a sector rotation occurs. For calculation distribution days futures of S&P 500 (ES1!) and NASDAQ (NQ1!) are used because the volume for this calculation is needed. TradingView does not support volumes for S&P 500 or NASDAQ directly.
Markets: A green/red dot signals that the market is above/below its 25-Daily-EMA. A green/red square signals that the market is above/below its 25-Weekly-EMA. Markets can give as a feeling about where investors store their money. E.g. when markets are falling but DUX (Down Jones Utility Average) is rising this means that investors put their money into save haven. This can be a sign that the markets will fall more.
3. Section (panic signs, = signs of reaching a low within a correction of a crash)
VIX-Reversion: A VIX reversion day (VIX > 20 & VIX high > VIX high of the day before & VIX high – VIX close > 3) is marked as a yellow dot
VVIX: A value equal or above 140 is marked with a yellow dot and shows absolute panic.
PCR Intra max: A value equal or above 1.4 is marked with a yellow dot.
New high/lows: New highs/lows are shown for AMEX, NYSE and NASDAQ. A yellow dot is shown if the ratio is less or equal than 0.01.
Down-Day: Down days are shown for AMEX, NYSE and NASDA. A yellow dot is shown if at least 90 % of the whole volume (up and down) is a down volume.
In Addition to the warning signs in the second section a check of the Advance Decline Line (NYSE and NASDAQ) for bullish and bearish divergences is useful. The whole set-up can be seen in the screenshot.
Only one signal normally does not give us a good prediction. Therefore we need to see these indication as a bundle. TradingView gives us the opportunity to check some striking market situations in the past. So feel free to test this indication for building up your own opinion.
Please feel free to comment in case of failures, improvements or experiences (good or bad).
Pure Volume Divergence [NeoButane]PVD: MACD with volume as source.
Options to configure:
OBV, PVT, or MFI as source
Display PVD or a faux zero-based oscillating CVD
Tweezers and Kangaroo TailHello Traders,
Here Tweezers and Kangaroo Tail script is in your service. The script searches for Tweezer / Kangaroo Tail candlestick patterns and shows them as T (Tweezer) and K (Kangaroo Tail). Thanks to RorschachT who game me the idea and some details while working on this script.
What are these candlestick patterns?
Tweezers :
- A tweezers pattern occurs when the highs/Lows of two candlesticks occur at almost exactly the same level
- Both candles must have wicks
- Bigger Wick / Smaller Wick rate should not be greater than 150% ( 150% by default and you have option to change it)
- First Candle must be highest/lowest for last 5 candles (5 by default and you have option to change it)
- The level of High for Top, Low for Bottom must be almost lower than 20% of the bigger wick of tweezer candles (20% by default and you have option to change it)
- The Candles can be right next to each other or apart but not more than 12 candles apart (12 by default and you have option to change it)
- You will see that Tweezers pattern occurs frequently
Kangaroo Tail:
- Looks almost like a Hammer or Inverted Hammer candle
- They have both its open and close in the top or bottom third of the candle
- There must be some space/room on the left of the kangaroo tail
- The open and close of the Kangaroo Tail candle must be inside the range of the previous candlestick
- The next candle should create a new high or new low
- You have several options to set details about the "Room" that should be on the left and also options for Wick/Body rates
- You can see example below
You have option to enable/disable any of these patterns.
as far as I have tested they are strong reversal patterns but none of the indicators or patterns may not be enough alone. so you should confirm the signals using other indicators or tools
If you need more information you can find a lot of info on the net ;)
Example: Tweezers - Aparted
Example: Kangaroo Tail - Bullish
Enjoy!
Donchian Channel - Pivot High-LowCombining Pivot High Low and Donchian Channel - both of which are useful indicators for trend following.
Donchian Channel shows highest and lowest prices for X number of bars.
Pivot High-Low identifies when price made new Highs and Lows
Applying Donchian Channel on Pivot High-Low channel, we are plotting highest and lowest pivots formed in X bars.
In this indicator, we have 3 options for Channel Base :
Price : This is regular Donchian channel based on High-Low Price
Pivots : This is Donchian channel based on pivot points.
Combined : Combines both. Takes highest of Price and Pivots for plotting high, lowest of Price and Pivots for plotting low
MinMax, The big pictureSee the boundaries of the price movement. The big picture.
The yellow boundaries are over 2 weeks.
The purple boundaries are over 2 months.
If a coin is below the lowest purple boundary than it means that it is sinking and it cannot be traded.
If a coin is below 50 weeks average (thick red line) than it is not ripe enough for trading also.
Currency Conversion for Dual Listed Stocks
This is a small tool for automatic currency conversion for dual listed stocks that trade in different currencies, i.e. Biontec: BNTX (USD) / 22UA (EUR).
- The label shows the converted price and the underlying's currency.
- Base currency is set to EUR.
- Automatically detects the underlying currency via syminfo.currency and converts it.
HTF Trend FilterTrend filter based on higher timeframe candles. Can be used as entry filters.
Checks if last 3 higher timeframe candles are in fully ascending order or fully descending order. Additionally you can also check if close price is above min of last two highs or below max of last two lows.
Lime and Orange candles imply partial trend in higher timeframe. (only last 3 candles align)
Green and Red candles imply complete trend. (last 3 candles align along with current close price).
Just an experiment. Can be further improved,
Percentage Distance From Moving AverageThis indicator shows the percentage that an asset price is above or below its 50-period simple moving average.
You can change the 50-period moving average to whatever you'd like in the settings of the indicator.
There are other versions of this indicator that are currently public, but they all use the exponential moving average instead of the simple moving average.
DIX Two Symbols Delta and Cumulative DeltaJust a simple script to subtract the DIX of any two symbols give the Delta and Cumulative Delta. The default symbols are QQQ and IWM. There are a lot of possibilities with this, and it could easily be expanded to accommodate more symbols, but there are limitations to how many symbols I can add to this.
Subtract any Two Symbols and calculate the Cumulative DeltaJust a simple script to subtract any two symbols giving a delta of the values, and then getting a cumulative sum of each bars delta value. The two default symbols are the Value of All Trades on Upticks for US Stocks, and the Value of all Trades on Downticks for US Stocks. There are a lot of possibilities with this. Delta is turned off by default, to turn it on you have to select "Show Delta" in the inputs.
Multitimeframe Pivot HiLoPivot High/Low for multi timeframes.
Could be great entry filter to include multi time frame pivots in trend trading strategies.
Rabbit HoleHow deep is the Rabbit hole? Interesting experiment that finds the RISING HIGHS and FALLING LOWS and place the difference between the highs and lows into separate arrays.
== Calculations ==
In case current high is higher than previous high, we calculate the value by subtracting the current highest high with the previous High (lowest high) into array A,
same method for the lows just in Array B.
Since we subtract highs and lows it means velocity is taken into consideration with the plotting.
After adding a new value we remove the oldest value if the array is bigger than the Look back length. This is done for both lows and highs array.
Afterwards we sum up the lows and highs array (separately) and plot them separately, We can also smooth them a bit with Moving averages like HMA, JMA, KAMA and more.
== RULES ==
When High Lines crosses the Low Line we get a GREEN tunnel.
When Low Lines crosses the High line we get the RED tunnel.
The Greenish the stronger the up trend.
The Redish the stronger the downtrend.
== NOTES ==
Bars are not colored by default.
Better for higher time frames, 1 hour and above.
Enjoy and like if you like!
Follow up for new scripts: www.tradingview.com
Year/Quarter/Month/Week/Day breaksUse this script very effectively to create completely customisable breaks ranging from :
YEAR
QUARTER
MONTH
WEEK
DAY
High Low Rate Of ChangeAn experimental indicator using Pine Script Arrays. The indicators measures the rate of change of the highest highs and lowest lows. I call it the "High Low Rate of Change".
The H/L Rate of Change indicator finds the delta between the current highest high and previous highest high and after some filtering places these values into an array.
Same goes for the lowest lows.
In the end Sum it all up into the Histogram with optional smoothing using Exponential moving average (EMA).
==Colors==
Green: Up Trending.
Light Green: Weakening up trend.
Red: Down Trending.
Light Red Weakening Down Trending.
==Notes==
Bar colors are disabled by default.
Supports EMA smoothing (enabled by default).
Like if you Like and Enjoy!
Follow up for upcoming indicators: www.tradingview.com
vivander_BWAShows the percentage of the body of the candle in relation to the total size of the candle (including wicks)
[A618] Liquidity Levels Based OBV SR with KAMAWe all know OBV plays a very important role in figuring out price volume divergences and it can help anyone analyse the directivity force of the market and has a very good tradeoff if applied correctly
In this Experiment i have derived liquidity levels for OBV using volume jumps inside the market
A volume jump is classified as:
Good Volume Jump = 1.618 times the Average Volume (WMA or 2pole ButterWorth's Filter of Volume)
Great Volume Jump = 2 times the Average Volume (WMA or 2pole ButterWorth's Filter of Volume)
Extreme Volume Jump = 3 times the Average Volume (WMA or 2pole ButterWorth's Filter of Volume)
So the horizontal levels which you see on the indicator (colored in red/ blue / gray lines) are the derived Liquidity Levels for OBV in the Market, these are the levels where OBV is most likely to perform a movement or come back
Also I have applied KAMA indicator on top of OBV for better Directive guidance, as of my experiments KAMA seems to be most stable and consistence of all the other moving averages,
KAMA's Length inculde:
KAMA - 8
KAMA - 34
KAMA - 200
Hope this Script help you guys!
Thanks to Tradingview for providing such an awesome platform
##Note for Credits ::
The Ehlers 2 pole butterworth Filter function is derived from @cheatcountry script ()
ZigZag with Fibonacci LevelsHello Traders,
This is " ZigZag with Fibonacci Levels " script. It finds the ZigZag, draw Fibonacci lines and put labels accordingly. I get many requests for this script, so here it is.
You can set ZigZag period as you wish. Bigger numbers (such 20, 30) may give better perspective and result.
It draws Fibonacci levels between 0%-100% and If the price goes higher/lower than 100% level than the script draws Fibonacci Levels accordingly. This means it draws Fibonacci levels until this levels get higher/lower than the price.
As an example:
if you don't want to see ZigZag Lines then you have option to disable it and see only Fibonacci levels:
You have coloring options for Zigzag, Fibonacci lines and texts:
Enjoy!
Machine Learning / Longs [Experimental]Hello Traders/Programmers,
For long time I thought that if it's possible to make a script that has own memory and criterias in Pine. it would learn and find patterns as images according to given criterias. after we have arrays of strings, lines, labels I tried and made this experimental script. The script works only for Long positions.
Now lets look at how it works:
On each candle it creates an image of last 8 candles. before the image is created it finds highest/lowest levels of 8 candles, and creates a string with the lengths 64 (8 * 8). and for each square, it checks if it contains wick, green or red body, green or red body with wicks. see the following picture:
Each square gets the value:
0: nothing in it
1: only wick in it
2: only red body in it
3. only green body in it
4: red body and wick in it
5: green body and wick in it
And then it checks if price went up equal or higher than user-defined profit. if yes then it adds the image to the memory/array. and I call this part as Learning Part.
what I mean by image is:
if there is 1 or more element in the memory, it creates image for current 8 candles and checks the memory if there is a similar images. If the image has similarity higher than user-defined similarty level then if show the label "Matched" and similarity rate and the image in the memory. if it find any with the similarity rate is equal/greater than user-defined level then it stop searching more.
As an example matched image:
and then price increased and you got the profit :)
Options:
Period: if there is possible profit higher than user-defined minimum profit in that period, it checks the images from 2. to X. bars.
Min Profit: you need to set the minimum expected profit accordingly. for example in 1m chart don't enter %10 as min profit :)
Similarity Rate: as told above, you can set minimum similarity rate, higher similarity rate means better results but if you set higher rates, number of images will decrease. set it wisely :)
Max Memory Size: you can set number of images (that gives the profit equal/higher than you set) to be saved that in memory
Change Bar Color: optionally it can change bar colors if current image is found in the memory
Current version of the script doesn't check if the price reach the minimum profit target, so no statistics.
This is completely experimental work and I made it for fun. No one or no script can predict the future. and you should not try to predict the future.
P.S. it starts searching on last bar, it doesn't check historical bars. if you want you should check it in replay mode :)
if you get calculation time out error then hide/unhide the script. ;)
Enjoy!
Equity chart [LM]Hey Guys,
I have created draft version of chart where you can put your position amount and position price and position date for each entry and it will chart your equity as candle stick chart. There are currently possible to include 4 positions but you can add as many you like by modyfing the code.
It will calculate your average entry based on your input and in date where you add other entry it will create gap. I have already plan to include there also leverage on each position. The idea is that you should trade your equity and with this indicator you will be able to create your custom indicator based on equity chart and not price chart.
!! Unless you will enter position nothing will be rendered
Indicator is under breadth indicator because didn't know where to put it.
I release this script for collaboration and improving the idea with new features
Cheers,
Lukas