Example - Switching LineExample of manipulating a float series to:
• switch from one source to another
• maintain a level by referencing itself
This script publication is intended for:
• Educational Purposes
Who is it for?
Anyone who wants to learn how to change the position or state of an active float series.
Support and Resistance
FIBS S/R IndicatorHello,
I've decided to publish a new script. The previous version of this script was removed by admins for breaking community rules.
So I present to you the Fibonacci Support / Resistance.
1. How does it work
Ratio plots
I first take the input of pivot look back and search for pivots high and low.
And then it takes a second look back to search highest high and lowest low to establish the top bottom range.
Then using the top and bottom I plot ratios provided as input. Defaults to most relevant 5 ratios I've found (Fibonacci):
Ratio 0 = 0 - can't be changed
Ratio 1 = 0.5
Ratio 2 = 0.618
Ratio 3 = 1
Ratio 4 = 1.618
Ratio 5 = 2.618
Any changes done to these ratios should be in order, otherwise conditions could get messed up. So R1 needs to the lowest and R5 the highest.
Also the same ratios are used in reverse as negative ratios.
There is a option to plot all ratios but gets really confusing for me but maybe for you it works. By default there are certain conditions set so that as we go up new resistance ratio get displayed and as we go down we see new resistance plots.
Trendlines
I've also added some automatic trendline plots with breakout warning labels based on the pivots high and low. Start and end for trendlines can be changed via inputs.
Labels can be deactivated via input. On a older version the trendlines and labels where not removed from the chart but I felt like there was to much information.
Overcooked/Undercooked
I've also added some fills and background colors that indicate if the price action is over R5 or under Negative R5 ratios. This usually indicates some "overcooking" or "undecooking".
I've notices that after "crossunder"/"crossover" top bottom ratios it goes in consolidation or it dumps. So then I plot a bgcolor to signal that.
2. How to use it
Using plot lines we can determine where we have support and resistance. I found that the best way to use the default ratios values is on the 1H chart. Very good for trading on crypto because of current situation in the market where there is a lot of new people entering the space and volatility and sentiment make swings respect the Fibonacci ratios.
3. Examples
For instance lets look at BINANCE:BTCUSDT .
On the left we see that the price action between 20 and 21 February was "overcooked". So after we got the signal that we "crossunder" the R5 the signal was triggered and we got a small red candle followed by a small dip and after that we got a small bounce and a dump.
If we also look at MF-RSI we can also see we got multiple bear divs.
Lets entertain the idea that we went short at ~57.1k as soon as we get signaled and it starts dumping.
Where does it stop ?
We can see it went all the way down to Negative R5 ratio. Normally that should signal "undercooking" but this was not triggered as it did not close under it (signaled in green).
We can also see that previous support now becomes resistance (signaled in red).
If we take a look at BINANCE:ETHUSDT , we do see that the "undercooking" was triggered here.
I will be publishing a more detailed Idea with examples of using this on the BINANCE:BTCUSDT chart in combination with Volume and other technical analysis.
Use with caution, this is not 100% signal indicator as the markets do what they want. But by using this in combination with other indicators like MF-RSI, EMAs and regular patterns we can get some targets for Support/Resistance.
I'm trying to create a strategy based on this indicator but I'm not getting very good results. Best results were on the 15 min chart with gross profits around ~50%.
Please try to play around with the inputs and let me know if you find something interesting, maybe I can incorporate new features in the indicator.
You can find the MF-RSI indicator here
HTF Highs Lows [JV]█ OVERVIEW
This script presents a label with an overview of higher timeframe highs and lows. This can be useful information as we all know that price likes to revisit previous highs and lows area, specially on the higher timeframe.
█ CONCEPTS
This information can be relevant and valuable for various reasons:
Finding horizontal Support and Resistance
Get a better view on Market Structure
Provide some information about Order Flow
TrendLines
...
█ FEATURES
Plots
This script provides the option to show information about 3 timeframes
Each timeframe can be separately shown or hidden
The Y position of the info label can be user defined, based on high or low of the chosen timeframe
The X offset of the info label can be adjusted to the user's liking and the chart resolution
The label color and text color can be user defined
The info label's size can be user defined
█ NOTES
Caveat
The timeframes must be chosen in order of size. Meaning that the highest timeframe should be on top. This is title as such on the info label, but I want to mention it again as it's something to pay attention to.
Repainting
The question that pops up all the time is: Does it repaint ?
I will quote PineCoders on this:
We're pretty sure Wilder was not asked very often if RSI repainted. Why? Because it wasn't in fashion—and largely unnecessary—to ask that sort of question in the 80's. Many traders back then used daily charts only, and indicator values were calculated at the day's close, so everybody knew what they were getting. Additionally, indicator values were calculated by generally reputable outfits or traders themselves, so data was pretty reliable. Today, almost anybody can write a simple indicator, and the programming languages used to write them are complex enough for some coders lacking the caution, know-how or ethics of the best professional coders, to get in over their heads and produce code that does not work the way they think it does.
Briefly: yes, it repaints and no it does not matter.
Simple because we are working with highs and lows on a higher timeframe. So if we get a new high or low within a certain time frame, we want this new high or low to be displayed and, for me, it's not relevant if this information appears when it happens or when the candle closes.
Questions & Suggestions
Questions, suggestions or even a word of thanks are always welcomed in the comments section. I usually answer within the same day.
█ THANKS
A word of thanks to, and I hope I am allowed to use hyperlinks here, LonesomeTheBlue for being an inspiration on coding style and his work on arrays in Pine Script and to lmatl for his support, words of advice and letting me borrow his brain now and then.
coates moving averages (cma)This indicator uses three moving averages:
2 period low simple ma
2 period high simple ma
9 period least squares ma
The trend is determined by the angle of the moving averages, current close relative the the 9 least squares ma (lsm) and the current close relative to the prior two periods high and low.
When there are consecutive closes inside the prior two candles high and low then a range is signaled:
In ranges the buy zone is between the lowest low and the lowest close of the current range. The sell zone is between the highest high and the highest close. The zones are adjusted as long as the new close is within the prior two candles range:
When price closes above the 2 high ma and the 9 lsm then a bull trend is signaled if all moving averages are angled upward (as seen at #4 in the chart above and #1 the chart below ). If the 9 lsm and / or the 2 low ma continue to angle downward, following a close above the 2 high ma and 9 lsm, then a prolonged range or reversal is expected (#2 in the chart below):
During a bull trend the buy zone is between the 2 low ma and the 9 lsm. The profit target is the 2 high ma:
During dip buying opportunities price should resist closing below the 9 lsm. If there is one close below the 9 lsm then it is a canary in the coalmine that tells us to proceed with caution. This will often signal a range, based on the conditions outlined above. To avoid a prolonged range, or reversal, price needs to immediately react in the direction of the prevailing trend:
If the moving averages are angled down and the most recent close is below the 2 low ma and 9 lsm then trend is fully bearish:
During a bear trend the short zone is between the 2 high ma and 9 lsm. The profit target is the 2 low ma:
When the 2 high ma angles down and the 2 low ma angles up while price closes inside both mas then it indicates a cma squeeze:
Volatility is expected in the direction of the breakout following the squeeze. In this situation traps / shakeouts are common. If there is a wick outside the cma, with a close inside, then it indicates a trap / shakeout. If there is a close outside the 2 high / low ma then it signals a breakout.
A trend is considered balanced when the 9 lsm is roughly equidistant from the 2 low and 2 high mas. If the 9 lsm crosses the 2 high or 2 low ma then it signals exhaustion / imbalance.
For a stop loss I use the prior three periods low, for bull trends, and the prior three periods high for bear trends. I would expect other reliable stops, such as the parabolic sar or bill williams fractal, to be effective as well. The default moving averages should be very effective on all timeframes and assets classes, however this indicator was developed for bitcoin with a focus on higher timeframes such as the 4h, daily and weekly.
As with any other technical indicator there will be bad signals. Proceed with caution and never risk more than you are willing to lose.
Simple Fibonacci Candles + LevelsThis is a simpler alternative to the auto-fibonacci indicators. Calculates the fibonacci levels based on the all-time high and all-time low prices. Candles are then colored based on the current closing price's relation to the 5 levels.
ICMCBased on basic Nimblr TA, Momentum Candles combined with Breakout/Breakdown can detect a change in trend direction.
Nimblr mainly categorizes candlesticks into Momentum (Body > 50%) and Indecision (Body < 50%) candlesticks.
⁕ shows Momentum Candles, others are Indecision Candles
↑ shows Breakout
↓ shows Breakdown
Yellow lines show the current Indecision candle and white lines the past Indecision candle.
Automated Quarters Theory With BTC and ETHThis is based on "Automatic Quarters Theory Lines" by monzakaamera. Added calculations for BTC and ETH and fixed script to work on the weekends.
pivot semaphore support&resistance levels [LM]Hello Traders,
I would like to introduce you pivot semaphore support&resistance levels. The idea is the same as the zigzag script of mine to spot the importance of support&resistence
The Semafor is used to spot future multi-level Supports and Resistance zones.
It is also useful to spot HL or LL or HH or LH zones at different Depth settings.
The red zones are the extreme places where the market has a higher chance of reversing while the green zones have the lowest setting with lower chances of the market reversal
The lines can be extended like so
The lines also can just stop extending when price will reach it
Enjoy!
ACD - Layers 1 & 2An implementation of layers 1 & 2 of ACD strategy of Mark Fisher, based on the book "The Logical Trader".
This implementation contains:
- OR lines
- A lines
- C lines
- Daily pivot range
- N days pivot range
- Customizable trading session
Strategy summary (This implementation):
There is 3 main concepts, each of which represented as two price levels.
1) OR (Opening Range) is the range of the first bar of the day. In other words, it's just "high - low" of the first resolution (usually 15min.) bar of the day. So, OR lines (Aqua color) visualize this range for each trading session.
As stated by Mark Fisher in his book, this range is meant to be a statistically significant range such that when price breaks the range in one direction, This is UNUSUAL to infiltrate it again AND break through the other side. So we can consider it as a potential enter signal (long or short).
2) A lines (Blue color) are drawn above and below OR lines with difference of 10% 0f 10 days ATR. The ATR period and the A multiplier (usually 10%) is customizable.
3) C lines (Gray color) are drawn above and below OR lines at 15% of 10 Days ATR difference. These lines help detecting AND confirming that UNUSUAL situation.
These concepts form the layer 1, which you can spot potential opportunities with it.
There is also two ranges to show support and resistance levels based on price action of previous days. Pivot ranges are rolling ranges that calculated and last for each day separately. They only differ in calculation period - the first one is daily (yellow color area) and the other one (red color area) is customizable, but is usually 3 or 5 days.
Each range consists of two price levels, valid for the current trading session. One of theme is HL2 , and the other one is "HLC3 + abs(HLC3 - HL2 )".
These two ranges, "Daily pivot range" and "N days pivot range", form the layer 2, which you can see them as two dynamic support/resistance ranges - one for daily, and the other for N days. They help filtering opportunities spotted from layer 1.
There is 2 more layers in the ACD strategy, which is omitted in this free implementation.
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!
Previous Period Levels - X Alerts====== ABOUT THIS INDICATOR
- A simple but highly customisable display of previous higher time-frame
OHLC values, drawn using line.new and label.new. Nothing fancy but...
- Customised resolution input which excludes time frames lower than 1 hour
while extending the common higher reference inputs to include:
• 6, and 12 Hour
• 5 Day
• 3, and 6 Month
• 1 Year
- Alert conditions using an adjustable SMA to help reduce false positive
spam.
- Full visual customisation options for (almost) every aspect, so it can be
tuned to suit most individual preferences.
- In line with the miriad visual customisation options is the ability to
change the display format of the Labels, to show more or less information,
or disable them altogether.
====== REASON FOR STUDY
- To practice advanced user input option handling to allow for a full visual
customisation experience without stepping outside of, or interfering with,
the intended function of the indicator.
- Provide reasonably clear code commenting and structure in order to be
useful as a potential learning aid for others, and future reference for
myself.
====== DISCLAIMER
Any trade decisions you make are entirely your own responsibility.
I've made an effort to squash all the bugs, but you never know!
Rectangular ATR LevelsHelpful in forming Support resistance Judgements
Rectangular ATR Levels
is calculated using multipliers of the ATR value at the Previous Day's Close and plotting them on current day price movements as levels
Enjoy!
NSDT Daily Key LevelsSimple script to show key levels of current day and previous day. Labels can be turned on and off as needed. Line colors, thickness and style can be changed. Modified the "M/W/D Level" script from paaax. Credit for original code goes to him. Link to script and profile posted in code of this script.
Grid Bot SimulatorThis script is a grid bot simulator for ranging/choppy markets. Prices are divided into grids, or trade zones, that will trigger signals each time a new zone is entered. During ranging markets, each transaction is followed by a “take profit.” As the market starts to trend, transactions are stacked (compare to DCA), until the market consolidates. No signals are triggered above the Upper Limit or Below the Lower Limit.
Settings overview:
Upper Limit/Lower Limit : Highest and Lowest values for entire grid.
Number of Grids : Number of trade zones.
Show Grids : Show or hide all gridlines.
Show Only Current Grids : Only display the grids just above and just below the current trade zone.
High/Low for signals : If enabled, signals are triggered as soon as the price touches the next zone. If disabled, signals are triggered after bar closes. Enable this for “Once Per Bar alerts. Disable for “Once Per Bar Close” alerts.
Highlight Trade Zones
The grid bot should work well during ranging/choppy markets. Each zone will have only one trade, and then will immediately take profit in the next zone.
Ranging/Choppy Market
However, trending markets can produce multiple signals in rapid succession:
Trending Market
If the gridlines are compressing the chart space, enable the “Show Only Current Grids” in settings.
Show Only Current Grids disabled
Show Only Current Grids enabled
When changing symbols, adjust the Upper and Lower Limits to accommodate the new symbol. Otherwise, the chart will look compressed.
XBTUSD chart with ETHUSDT settings
The bot is a proof-of-concept and is considered experimental . Possible future updates will include Fibonacci grids and “smart entry/exits,” depending on the current trend. Comments and suggestions are encouraged.
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
UNI Top Cap [jcray]Top cap indicator for UNI, the Uniswap Protocol token. Modified from BTC Top Cap by aamonkey
Pre and Market OpeningsPre and Market Openings is to enable you to quickly visualize the opening markets and how they could influence trading.
The below script has used the market time data from the below links:
Tokyo/Asia www.tradinghours.com
London www.tradinghours.com
New York www.tradinghours.com
The below script aims to plot:
Daily Asia Open
Weekly Asia Open
Daily London Open
Weekly London Open
Daily New York Open
Weekly New York Open
Using background colour it also shows market sessions (pre-market) for London and New York and regular for London, New York and Asia.
There is also plotted text for days of the week and sessions.
As you can see from the picture below that these market openings can act as support and resistance:
BTC
ETH
Realtime All-Time High and All-Time Low Tracker [WIP]This is a study intended to port the work of /u/QuantNomad's "Kozlod - All-time high/low alerts" to pine version 4 without giving any alerts. It is intended to capture the most extreme points on any given price chart in real time, the absolute high and absolute low points. Ideally, the plotted lines would strictly diverge from one another in opposite directions and widen with new highs or lows on a hypothetical "all-time" resolution.
Most of the original code was replaced and I'm trying to resolve a bug where the script fails to register new highs or lows while at the same time making sure that earlier data is plotted correctly. If applied to an asset that has not yet recovered , is just too new, or has not achieved a lower low than its opening price, this indicator ceases to function correctly. This would not be an issue if pine script was more general purpose and had something similar to Python's max(list) function.
Any and all suggestions are welcome. This is simply to serve as a springboard for any programmers trying to design algorithms or strategies that use these variables on any price chart.
Happy Hunting!
- Patch Hemlock
ETH Top Cap [jamesray]This script is modified from Top Cap , as published here.
Historically it matches market tops for ETH
Bridge Bands [joecat808]Bridge Bands are an implementation of the work done by Joe Catanzaro (joecat808) to produce a risk range for a security.
The basic idea is to calculate Mandelbrot's "Bridge Range". (Pg. 179 of Misbehavior of Markets)
It then calculates Bollinger Bands.
Then next step is to calculate the Hurst Exponent.
The last step is to merge the Bridge Range and the Bollinger Bands. The basic concept is if H = .5 we use the Bollinger Bands and the farther away we move from .5 in either direction the Bridge Range takes more precedent.
There is a Trend value that is the mid-point of a 3 month Donchian Channel. If price is above we're bullish, if price is below we're bearish.
Lastly, there is also an option info box with data regarding the underlying's position within the range, as well as an experimental position size calculation.
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