Cumulative Pivot HighLowThis indicator counts number of higher highs/lows and number of lower highs/lows and calculates trend based on that.
Indicator line shows (sum of higher highs/lows - sum of lower highs/lows) derived from last loopback periods. Indicator is green if last two consecutive highs/lows formed are on higher side. Red if on lower side. (Consecutive numbers can be controlled by parameter direction_threshold )
combineHighsAndLows if unselected shows not cumulative version but last consecutive highs and lows marked in red or green according to the trend.
Breadth Indicators
Shares Risk (Long)Ever struggle to know how many shares you should be placing your order with? Risk is different for every person and every stock. This can help.
In the example above, I've added this indicator the the chart.
I then specified:
Risk Amount ($) = $500. (The max amount I'm willing to risk.)
Risk Source = (another indicator) Lower Limit 3 . (See Lower Limits for more details)
Source Risk (%) = 0.0 (The default is 5.0 expecting the Risk Source to be the close.**)
Based upon how much I'm willing to risk, and the price difference between the close and Risk Source , this indicator will show the number of shares to purchase such that if the price drops to the stop level specified, my value loss should be limited to the Risk Amount .
333 shares is the value calculated for this example (latest bar). You can easily see how many shares you need to purchase for the lastest bar as well as track the previous values on the chart and the indicator cursor data.
---
** WARNING: There's no magic here. It's just math. So if you specify another indicator as the source, the values could get a bit strange and if the price is very close to the stop level, the number of shares could be unreasonably high. To help avoid this you can increase the minimum percent.
Multi Time Frame Candles with Volume Info / 3DHello Traders,
This is my second Multi Time Frame Candles script but with this new one, you will have some new features such volume info, remaining time to close of higher time frame candle and also developed using new features of Pine such array of lines. also I tried to make it 3D for better visualization ;) also it shows new highs/lows / breakouts.
I tried to make many things optional, so you can change almost everything using options.
What you can change using options:
- Higher time frame
- Number of Candles
- Candle Colors Up/Down
- Wick Color
- Volume colors Up/Down
- Text color of Remaining Time
- Shadow Color
- Background color
- Start bar of the candles (so you can see many higher times frame candles in same window)
- 3D effect, by default it's enables but you can disable 3D view
Lets see some examples:
Remaining time:
Breakouts:
You can combine different higher time frames:
if you don't want 3D view then combining different higher time frames:
You can change background color:
Enjoy!
Daily High & Low BoundaryDisplays the day's progressive high and low of the day colorized by the day of the week.
US10Y / DXY - 10 Yield correlated This oscillator tracks the US and US10Y , Script is based in SPX/US oscillator by @someguy
Local LimitsDisplays recent higher highs, lower highs, lower lows, and higher lows as a collection of local limit indicators.
In its simplicity is a lot more powerful than might appear at first glance.
Does not rely on volatility calculation.
Can be linked together to create an objective view of recent support and resistance levels.
Makes current trends more visible.
Excellent for use as a trailing stop algorithm.
Parameters
Single Bar Sensitivity: True (default) reacts to individual bars. False only responds to the alignment of 2 bars.
Margin (1-5): Adds extra distance from higher lows and lower highs to reduce the sensitivity of broken trends.
Single indicators with configurable sources:
Local Limit Higher
Local Limit Lower
FCMS - Arrays Exercise - High Low with Arrays - StudyThis is just a script to exercise the use of arrays on pine script.
I think we could say that every for loop we had in pine script before the arrays, is eligible to become an array.
Our script will get more efficient and more reliable.
As every "if" case is elegible to became a function
I confess I was addicted to use if, else if, else in my codes, but recently i've been updating my scripts and it's became more efficient
I couldn't find an array function that insert an value removing the oldest one, so I'm using this condition to "shift" the first value.
I'll update as soon as I find a better way to do it.
In any case, for this specific goal, we already have an built in function, as I let on script
Hariz Hazwan 5 line indicatordetermining the risks by looking for the divergence of price from moving averages support line
All-time high and percentage dropsThis script calculates the ATH of whichever chart you use and plots it in blue
There is also an option to display the following ATH percentages: 90, 80, 70, 60, 50, 40 and 30 in white
1st Hour High and Low ISRDaily Range :
1st Hour High and Low From Market Start Time
ISR = Initial Support Resistance
Local Limit UpperDisplays recent higher and lower highs.
In it's simplicity is a lot more powerful than might appear at first glance.
Does not rely on volatility calculation.
Can be linked together to create an objective view of recent resistance levels.
Makes current trends more visible.
Excellent as a trailing stop (short) algorithm.
Can be used with its sibling: Local Limit Lower
Local Limit LowerDisplays recent higher and lower lows.
In it's simplicity is a lot more powerful than might appear at first glance.
Does not rely on volatility calculation.
Can be linked together to create an objective view of recent support levels.
Makes current trends more visible.
Excellent as a trailing stop algorithm.
Can be used with its sibling: Local Limit Upper
Initial Balance & extensions Custom session time and IB durationThe indicator will plot Initial Balance levels and extensions. The session start and end times are configurable depending on instrument, as well as the Initial Balance end time. The session times must be entered in the underlying instrument's timezone, for example:
ES-futures (Chicago Timezone)
Session Start: 0830
Initial Balance End: 0930
Session End: 1515
US-Stocks (New York Timezone)
Session Start: 0930
Initial Balance End: 1030
Session End: 1600
Europe Futures (Madrid Timezone)
Session Start: 0800
Initial balance End: 0900
Session End: 2200
Colors and linewidths are also customisable.
Better OBVOBV with William C. Garrett's Approximation
In the classical OBV (On-Balance Volume) indicator, it simply takes the idea from traditional tape reading - treat the "up tick" as Buy, "down tick" as Sell, and it assumes no change in price as neutral* (*which is not the case in tape reading).
When it comes to interpret the daily volume as such, errors will add up cumulatively. For example, there are days when a Doji Star with high volume just merely one cent higher than yesterday price and the whole day volume would be taken as a BUY Volume....
Here is a gentlemen, William C. Garrett, attempted to break down the daily volume into two parts in his book - "Torque Analysis of Stock Market Cycle".
Published indicator has two modes: Cumulative and Time Segmented. Time Segmented Volume (TSV) - performs a MACD operation on the Garrett Money Flow.
Note on Divergence:
When using a indicator as Time Segmented Money Flow, divergence would surely occur on and off. This is where Wyckoff 3rd principle comes into play - "Effort vs Result" that is not matching. Meaning that the cumulation of shares goes in one direction while the price goes another direction.
FIN NIFTY Adv/Dec1) FIN NIFTY Index Advance-Decline count
2) Each session, it reads the number of stock is +Ve or -Ve
3) Whichever the side +Ve or -Ve side moving stock is more than count will be plotted
4) at +/- 11 drawn a dotted line if Count is > = +/-11 FIN Nifty is moving in a strong army
Eg:-
in the current session, 11 Stock is moving in +Ve direction & 9 are in -Ve direction
11 count will be plotted in the chart
Previous OHLCThe scripts places horizontal levels on your charts indicating the previous Daily, Weekly or Monthly OHLC values over the current timeframe.
Slightly modified version of Nanda86's "Previous OHLC" script. I corrected a couple of bugs and added more control over colors and labels in general. I also removed the hourly OHLCs.
Pivot OBV Reset [LM]Hi traders,
I woud like to introduce new script of obv indicator that resets on creation of new pivot high or low. Note that it resets when it's known that it is a pivot. On the reset candle adds accumulated value from previous candles defined by i_right input.
It has following settings:
pivot setting - here you can infulence pivot detection
obv setting - here you can influence whether it should be multiplied by price or not, if it should show when the reset happen
Hope you'll enjoy it
ZigZag Multi Time Frame with Fibonacci RetracementHello Traders,
This is ZigZag Multi Time Frame with Fibonacci Retracement script. It calculates the ZigZag using Higher Time Frame, draw Fibonacci Retracement lines and put labels accordingly. I already published Zigzag with Fibonacci Levels script but this one is Multi Time Frame and I didn't want to change/update it.
You can set ZigZag Period and Resolution as you wish. Zigzag is calculated using higher time frames (ex: 1day) so you better choose small numbers as Zigzag Period, such 2, 3 etc. you should choose higher time frame wisely, meaning that you should not set 1Day while chart resolution is 1min ;)
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.
"Show Zig Zag" is not enabled by default, you can enable it if you want to see ZigZag as well.
You have options to set Text Color, Line Color, Zigzag Up Color and Zigzag Down Color.
You can set the location of the Fibonnaci Levels -> Left or Right
You also have option to enable/disable following Fibonnaci Levels:
---> 0.236
---> 0.382
---> 0.500
---> 0.618
---> 0.786
I added "Colorful Fibonacci Levels" for fun. if you enable it then Fibonacci line colors will be different randomly on each move, see it for yourself :)
Some Screenshots:
if you enable "Show Zigzag Option":
how the script adjust levels automatically:
if you set Label Location as "Right":
if you enable "Colorful Fibonacci Levels" then Line colors will be changed on each move randomly ;)
Enjoy!
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).
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.