Key Levels SetKey Levels Set allows to set key levels as comma separated values, and to detect breaks to the downside and/or upside, taking into account potential gaps between bars.
This indicator can be very handy if you, like me, rely on some key levels that you identified as potential support/resistance from some technical analysis.
Features
+ It allows for key levels to be set as comma separated values.
+ It draws key levels on chart.
+ On close, it identifies highest key level that has been broken to the upside, if any.
+ On close, it identifies lowest key level that has been broken to the downside, if any.
+ In Cross mode, as bar is printing, it also detects highest/lowest key levels being broken to the upside/downside between bar high and low, if any.
+ It plots and labels breaks with current level and next level information.
+ It includes alerts from breaks on close.
+ It includes turn on/off functionality.
Settings
+ {Prices} checkbox: turns on/off entire functionality
+ {Prices} text field: comma separated values for key levels
+ {Breaks on} checkbox: turns on/off breaks detection functionality
+ {Breaks on} options: selects Close or Cross mode
Support-and-resistance
OrderBlock [kyleAlgo]The principle of this indicator
ATR (Average True Range) Setting: The code uses ATR to help calculate the Supertrend indicator.
Supertrend Trend Direction: Identify bullish and bearish trends with the Supertrend method.
Order Block Recognition: This part of the code recognizes and creates order blocks, visualizing them as boxes on the chart. If the number of blocks exceeds the maximum limit, old blocks will be deleted.
Function to prevent overlapping: check whether the new order block overlaps with the existing order block through the isOverlapping function.
Order block color setting: The code sets the color according to whether the block is bullish or bearish, and whether it breaks above or below. Afterwards the color of the existing order blocks will be updated.
Sensitivity settings: Through the input settings of factor and atrPeriod, the sensitivity of Supertrend and the detection of order blocks can be affected.
Visualization: Use TradingView's box.new function to draw and visualize order blocks on the chart.
Practicality:
Support and Resistance Levels: Order blocks may represent areas of support and resistance in the market. By visualizing these areas, traders can better understand when price reversals are likely to occur.
Trading Signals: Traders may be able to identify trading signals based on the color changes of blocks and price breakouts. For example, if the price breaks above a bullish block, this could be a signal to buy.
Risk Management: By using ATR to adjust the sensitivity of Supertrend, the symbol helps traders to adjust their strategies according to market volatility. This can be used as a risk management tool to help identify stop loss and take profit points.
Multi-timeframe analysis: Although the code itself does not implement multi-timeframe analysis directly, it can be done by applying this indicator on different timeframes. This helps to analyze the market from different angles.
Flexibility and Customization: Through sensitivity settings, traders can customize the indicator according to their needs and trading style.
Reduced screen clutter: By removing overlapping order blocks and limiting the maximum number of order blocks, this code helps reduce clutter on charts, allowing traders to analyze the market more clearly.
Overall, this "Pine Script" can be a powerful analytical tool for trend traders and those looking to improve their trading decisions by visualizing key market areas. It can be used alone or combined with other indicators and trading systems for enhanced functionality.
Divergence-Support/ResistenceAnother script based on zigzag, divergence, and to yield support and resistence levels.
This idea started with below two concepts:
▶ Support and resistence are simply levels where price has rejected to go further down or up. Usually, we can derive this based on pivots. But, if we start looking at every pivot, there will be many of them and may be confusing to understand which one to consider.
▶ Lot of people asked about one of my previous script on divergence detector on how to use it. I believe divergence should be considered as area of support and resistence because, they only amount to temporary weakness in momentum and nothing more. As per my understanding
Trend > Hidden Divergence > Divergence > Oscillator Levels of Overbought and Oversold
⬜ Process
▶ Now combining the above two concepts - what we are trying to do here is draw support resistence lines only on pivots which has observed either divergence or hidden divergence. Continuation and indecision pivots are ignored.
▶ Input requires only few parameters.
Zigzag lengths and oscillator to be used. Oscillator periods are automatically calculated based on zigzag length. Hence no other information required. You can also chose custom oscillator via external source.
▶ Display include horizontal lines of support/resistence which are drawn from the candle from where divergence or hidden divergence is detected.
▶ Support resistence lines are colored based on divergence. Green shades for bullish divergence and bullish hidden divergence whereas red shades for bearish divervence and bearish hidden divergence. Please note, red and green lines does not mean they only provide resistence or support. Any lines which are below the price should be treated as support and any line which are above the price should be treated as resistence.
▶ Divergence symbols are also printed on the bar from where divergence/hidden divergence is detected.
↗ - Bullish Hidden Divergence
↘ - Bearish Hidden Divergence
⤴ - Bullish Divergence
⤵ - Bearish Divergence
▶ Script also demonstrates usage of libraries effectively. I have used following libraries in this code.
import HeWhoMustNotBeNamed/ zigzag /2 as zg
import HeWhoMustNotBeNamed/enhanced_ta/8 as eta
import HeWhoMustNotBeNamed/ supertrend /4 as st
Can be good combination to use it with harmonic patterns.