RSI + FIB HH LL StopLoss Finder/Contrarian TradesThis indicator is a multi-timeframe indicator that works in any timeframe.
It takes a price reading of the highest or lowest bar in the past based on Fibonacci numbers and plots it.
In addition, the RSI smoothed by a 5-day moving average can be used to detect signs that previous highs or lows will be reached in advance.
This gives insight into determining stop-loss values or entering the market in a contrarian manner.
This is an example of BTCUSDT 4Hour Chart
Here is BTCUSDT 1Hour Chart
For scalpers BTCUSDT 15min Chart Example
Fibonacci Number is 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, ...
FIbonacci Ratio is 0.236, 0.382, 0.5, 0.618, 1, 1.618, 2.618, 4.236, ...
Higherhigh
Broadening Formations [QuantVue]Broadening formations are common chart patterns observed by technical traders. A broadening formation is formed when the volatility of an asset increases, thus expanding the range of its price resulting in higher highs and lower lows.
The Broadening Trendline indicator, works by looking for pivot points where a higher high or lower low is made compared to the previous pivot point. If a top and bottom line are detected a broadening formation is formed.
Indicator includes alerts, custom colors and styles, the ability to see previous trendlines, and notifications when a trendline is crossed.
Don't hesitate to reach out with any questions or concerns.
We hope you enjoy!
Cheers.
*Zig Zag Price, % Change w/RSI*With immense help from ©SimpleCryptoLife who reimagined this script for me, and to ©mmoiwgg and ©ocaptain who's ideas led to this updated version 5.
This indicator is fairly straight-forward and visually appealing because you get a running zig zag price, price % change with an added bonus - RSI. However you won't find zig zag lines but the script reacts the same by changing the inputs. The higher the value the less data points you'll see on the screen.
The main objective of this indicator is to be able to spot high and low prices easily with the price % change between the same 2 data sets. Additionally and arguably more importantly, with the RSI values associated with the high and low prices, you can spot divergences easily - meaning the price is making a higher high while conversely the RSI value at the next pop (around the same price as previous high) is lower which can mean that momentum has exhausted for the time being and a reversal could be imminent.
This script is meant only as a tool to try to enrich your trading journey and I hope it helps you become a more consistent and profitable trader. If you find it invaluable drop a like and comment. Good luck!
1 Minute Scalping IndicatorThis is a 1 Minute Scalping Indicator based purely on price action of the current candle compared to the previous candle so there is no lag from using other indicators. It works great on all timeframes, but is designed for getting in and out of positions quickly using the 1 minute chart. The candles will paint according to the direction the price is currently moving in, which is a great way to help reduce anxiety while watching the candles bounce back and forth.
HOW TO USE
It has Scalp Mode and Swing Mode. Both modes use the exact same price action parameters for signals, but Swing Mode will only give signals when the price action parameters are met AND the close is higher than the previous high for bull signals or when the close is lower than the previous low for bear signals.
This scalping indicator will show green up arrows when it detects bullish price action and red down arrows when it detects bearish price action. It will show a yellow arrow if the bullish/bearish price action conditions are met, but it detects a candle pattern that may be a weak signal such as small candle body, large wicks, etc. When this happens, make sure to wait for the next candle to show confirming price action before following the signal. You can also turn the signals off and use only the candle coloring if you prefer cleaner charts.
You can change the candle colors it uses within the input settings, as well as the color of the signal arrows to suit your preferences. You can also turn off the candle coloring if you prefer normal candles. If you are using the indicator’s candle coloring, make sure you go to your chart settings(gear icon top right) and in the symbol tab, turn off body, borders and wick for this to show up properly.
This scalper also includes alerts for bull and bear signals that can be set to alert you on any market and timeframe.
SCANNER
We also made a higher timeframe scanner that uses this same price action formula and shows you if higher timeframes are currently bullish or bearish in real time. It’s titled Higher Timeframe Price Action Scanner and can be found on our profile. I strongly recommend using both of these together to get an idea of the overall trend on longer timeframes. You can also use two of the scanners and set them to two tickers that move together or opposite of each other(like SQQQ and TQQQ) for even more market insight on your ticker's immediate direction.
MARKETS
This 1 Minute Scalping Indicator works well on any market such as stocks, crypto, forex, futures, etc.
TIMEFRAMES
This indicator is designed for scalping on the 1 Minute timeframe, but it works well on all timeframes, since it is using price action to give signals.
TIPS FOR BEST RESULTS
We recommend pairing this indicator with another support & resistance or moving average combo to find great entry areas and use the price action signals as confirmation when price bounces off of those areas. We also recommend using the Higher Timeframe Price Action Scanner with this so you can see the overall trend of higher timeframes on your chart and trade in the direction of the trend.
Scalp Mode
Swing Mode
Candle Coloring Only - No Signals - Scalp Mode
Candle Coloring Only - No Signals - Swing Mode
Close zig-zag labelThis indicator is a beta and is created to indicate the valid high and low close pattern, this isn't a stand alone strategy or reader of the market but can help to read the trend direction.
!ATTENCTION!
this indicator have repainting, don't thrust it until a candle close
some labels have more transparency than other, this is beacause they are lower high or higher low , the duller are the trend extention (friendly reminder, I can find the exact higher or lower close after a pullback, not running)
I don't know if I would implement other stuff in this indicator or if I'm going to remake it better, but for now I have this
Dow Theory Trend Direction VisualizerJapanese below / 日本語説明は下記
Overview
What is difficult for beginner traders is to identify trend occurrence, continuation and reversal.
This indicator visualizes market direction by changing background colors based on Dow Theory so that traders can visually grasp trends.
Sample chart
Functions
1.MTF Higher High/Lower High/Higher Low/Lower Low(HH/LH/HL/LL)
Indicator shows HH/LH/HL/LL of an upper timeframe(MTF) and those of chart’s timeframe at the same time.
As usual, HH/LH/HL/LL of chart’s timeframe can be used to identify trend continuation based on Dow Theory while MTF HH/LH/HL/LL can be used as support/resistance.
Auto and manual mode for MTF
When you select “Auto” mode, then an upper timeframe will be automatically determined as MTF based on chart’s timeframe. If “Manual “ mode selected, then you need to specify MTF timeframe.
MTF HH/LH/HL/LL are displayed only below the selected MTF timeframe so it will not disturb when you open higher timeframe.
For instance, if you select daily timeframe as MTF, then HH/LH/HL/LL of daily timeframe will be shown on 4 hour or below timeframes.
Auto and manual mode for MTF
When you select “Auto” mode, then an upper timeframe will be automatically determined as MTF based on chart’s timeframe. If “Manual “ mode selected, then you need to specify MTF timeframe.
MTF HH/LH/HL/LL are displayed only below the selected MTF timeframe so it will not disturb when you open higher timeframe.
For instance, if you select daily timeframe as MTF, then HH/LH/HL/LL of daily timeframe will be shown on 4 hour or below timeframes.
Sample chart (AUDJPY 4H + Daily timeframe HH/LH/HL/LL )
In this chart, you can see two different timeframe’s trend.
In 4hour timeframe, a new high recorded as HH and in daily timeframe, lows going up from LL to HL and high going up from LH to HH hence daily chart is uptrend.
Also, you can predict that Daily HH would be respected as resistance line.
2.Visualize trends direction with colors based on HH/LH/HL/LL.
Background color will change based on break up/down of HH/LH/HL/LL.
———————
トレードを習得する上で多くの人が苦手意識を持つ「目線付け」。
この目線付けをダウ理論を元に訓練するためのインジケーターを開発しました。
高値·安値の更新状況に応じて相場の方向性を色で可視化するため、視覚的に目線付けをすることが可能です。
サンプルチャート
ダウ理論による目線付けの二つの方法
これは僕の持論ですが、ダウ理論による目線付けの方法には、「トレンドは明確なシグナルが出るまで継続する」という原則を共通の拠り所とする二つの方法があると考えています。
一つは日本人投資家/トレーダーにも良く知られている押し安値·戻り高値を基準とする方法。そしてもう一つは高値·安値の切り上げ·切り下げのみを基準とする方法です。
このインジケーターは後者の方法で目線を可視化します。
(もちろん押し安値·戻り高値と併用した目線判断にも活用可能です。)
機能
1.上位足とチャートの時間軸両方のHigher High/Lower High/Higher Low/Lower Low(HH/LH/HL/LL)の表示(MTF機能)
上位足タイムフレームのHH/LH/HL/LLとチャートタイムフレームのHH/LH/HL/LLを同時に表示することができます。
チャートタイムフレームのHH/LH/HL/LLはダウ理論に基づくトレンドの継続・反転の判断用に、上位足のHH/LH/HL/LLは上位足での高値・安値の切り上げ/切り下げ判断及びレジスタンス・サポートとして使うことができます。
上位足の選択には自動モードとマニュアルモードが選択可能です。自動モードを選択した場合、チャートのタイムフレームに応じて上位足が自動的に決定されます。マニュアルモードの場合は選択した時間軸が上位足タイムフレームとして適用されます。
上位足のHH/LH/HL/LLは選択したタイムフレーム未満でのみ表示されます。例えば上位足のタイムフレームとして日足を選択した場合、日足のHH/LH/HL/LLは日足未満でのみ表示されます。
サンプルチャート (AUDJPY 4H に日足のHH/LH/HL/LL を表示)
このチャートでは二つの異なるタイムフレームの高値・安値更新状況を一度に把握することができます。
4Hでは高値の切り上げが発生しているため、安値を更新しなければ上昇トレンド確定です。一方日足では安値がLLからHLへ(赤の矢印)、高値がLHからHHへと切り上がり(緑の矢印)、上昇トレンドであることがわかります。
また、この場面では上位足のHHがレジスタンスとして機能する可能性も予測できます。
2.目線の方向を色で可視化
HH/LH/HL/LLの更新状況から目線を判断し、背景色とともに可視化します。
Higher High/Lower High/Higher Low/Lower Lowとは何か?
日本人投資家/トレーダーの中にはあまり馴染みのない方もいるかと思いますので、定義を記載します。
Higher High(HH)
切り上がった高値を意味します。当インジケーターでは一つ前の高値(HH/LH)から切り上がった場合にHHとしています。
Lower High(LH)
切り下がった高値を意味します。Lower Highなのでより低い方の高値という意味です。当インジケーターでは一つ前の高値(HH/LH)から切り下がった場合にLHとしています。
Higher Low(HL)
切り上がった安値を意味します。Higher Lowなのでより高い方の安値という意味です。当インジケーターでは一つ前の安値(HL/LL)から切り上がった場合にHLとしています。
Lower Low(LL)
切り下がった安値を意味します。当インジケーターでは一つ前の安値(HL/LL)から切り下がった場合にLLとしています。
使い方
高値·安値の切り上げ·切り下げの判断及びトレンド継続·転換の判断に活用
VWAP Bands - Event Based [LuxAlgo]This indicator returns VWAP bands with a degree of smoothness resetting based on various user-selected events. The bands are constructed using a VWAP based naive standard deviation.
The indicator can be anchored or start from the first bar and can be used as trailing support/resistance, in a moving average crossover system, or as source for external indicators.
Settings
Start: VWAP anchor point
Start At First Bar: Display the VWAP from the first bar instead of a specified anchor point
VWAP
Length: Controls certain characteristics of the user-selected event
Mult: Multiplicative factor for the VWAP standard deviation
Source: Price source of the indicator
Event
Event: Determines the event resetting the degree of smoothness of the VWAP
External Cross/Event: Input source used for external crosses/events
Further details about the available events are given below.
Details
Various event conditions are available to the users. When the selected event occurs, the VWAP equals the current closing price.
By default, the event is periodic, that is the VWAP resets periodically, with a period determined by the Length setting.
The Higher High event resets the VWAP when a new higher high occurs.
The Lower Low event resets the VWAP when a new lower low occurs.
The Trend Change event is similar however resets the VWAP only once a higher high or lower low occurs. Higher highs and lower lows are given by Donchian channels with a period determined by the Length setting.
The Start event reset the VWAP at the selected anchor point (or first bar if the "Start At First Bar" setting is selected). This can be useful if one only needs a regular anchored VWAP band indicator.
The External Cross event resets the VWAP when the Source price crosses the series selected in the External Cross/Event setting. In the image above the VWAP resets when the price crosses the volatility stop indicator.
The External Event resets the indicator when a series selected in the External Cross/Event setting is not equal to 0. This allows using a custom event in order to reset the VWAP. In the above example the VWAP is reset during a new session due to the External Session indicator.
SequenceSee the highs and lows easily!
Up sequence:
The close of each candle is higher from the low of the previous candle.
* The reference will always be to the low of the highest candle in the up sequence
Down sequence:
The close of each candle is lower from the high of the previous candle.
* The reference will always be to the high of the lowest candle in the down sequence
TradiKator 09 HH HL LH LL & Linear Regression
TradiKator 09 HH HL LH LL & Linear Regression indicates whether current price movement exceed the trend or not.
Here, we use Higher High,Higher low, Lower High, Lower Low to identify a possible change of trend.
Also we use 2 Linear Regression Channels (short term & long term) to identify a price trend.
I hope this indicator can help traders to estimate trend change in the essential trading behavior.
1)Higher High,Higher low, Lower High, Lower Low
Higher High and Higher Low indicates a Bull trend
Lower High and Lower Low indicates a Bear trend
Those high low pivot points is a verg good mark to judge if current trend keeps going on or not.
Setting :
Left pivot length
Right pivot length
The longer pivot length is , the less sensetive and more delay you signal will be, especially the right privot
2)Linear Regression Channels
Linear Regression Line – is a line drawn according to the least-squares statistical method which produces a best fit line
The resulting can be used to predict price trend from the same system.
Setting :
Count ---> the length of the Linear Regression, remember more data in interest = less accuracy and bigger sigma
The End bar of Linear Regression ---> If you don't want latest K bar in the Linear Regression interest (they are not in the same trend), then you can move the Linear Regression to earlier bar
This indicator is inspired by GDT who is a great coder.
Known issue:
Not yet.
LH-LL/HL-HH Confirmation Trend LineBased on Dow Theory, a series of successive higher highs (HH) and higher lows (HL) is the sign of an uptrend (bull trend) and a series of successive lower highs (LH) and lower lows (LL) is the sign of a downtrend (bear trend).
So this script indicates the trends using the concept and draws corresponding trend lines.
It took some effort to make it possible for users to see as many trend lines as they wish. Eventually the user could set the number alongside some other options in the indicator settings.
Use the script and send me your thoughts!
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
Higher vs Lower Pivots overlayA simple script that I made that draws lines between the high and low pivots. The color of the line define if the pivot is higher or lower than the previous pivot. The main thing to tune is the pivot look back vs look ahead, which are the same params used by the tradingview pivot indicator. There are several other params you can tweaks to get the look you want.
Trend Regularity Adaptive Moving Average [LuxAlgo]The following moving average adapt to the average number of highest high/lowest low made over a specific period, thus adapting to trend strength. Interesting results can be obtained when using the moving average in a MA crossover system or as a trailing support/resistance.
Settings
Length : Period of the indicator, with higher values returning smoother results.
Src : Source input of the indicator.
Usage
The trend regularity adaptive moving average (TRAMA) can be used like most moving averages, with the advantage of being smoother during ranging markets.
Notice how the moving closer to the price the longer a trend last, such effect can be practical to have early entry points when using the moving average in a MA crossover system, such effect is due to the increasing number of average highest high/lowest low made during longer trends. Note that in the case of a significant uptrend followed by a downtrend, the moving average might penalize the start of the downtrend (and vice versa).
The moving average can also act as an interesting trailing support/resistance.
Details
The moving average is calculated using exponential averaging, using as smoothing factor the squared simple moving average of the number of highest high/lowest low previously made, highest high/lowest low are calculated using rolling maximums/minimums.
Using higher values of length will return fewer highest high/lowest low which explains why the moving average is smoother for higher length values. Squaring allows the moving average to penalize lower values, thus appearing more stationary during ranging markets, it also allows to have some consistency regarding the length setting.
🧙 this moving average would not be possible without the existence of corn syrup 🦎
Counting Support & Resistance LevelsA script I am working on to count higher highs and lower lows of levels. Still in progress...
Once it's working it will add a shape or a new colored line when a target number of higher highs has been achieved.
Price MovementPrice indicator that shows the trend based on price movement.
The indicator determinants when an asset price is getting higher or lower by comparing the previous price highs and lows to the current price.
==Explanation==
In case current HL2 exceeds the previous HL2 HIGH then the columns will turn green.
In case current HL2 fails the previous HL2 LOW then the columns will turn red.
The trick here is that the trend CONTINUES to show the greens and reds, until a reversal happens to the opposite side.
This can be used to determinate trends and reversals.
Note: Bar colors are disabled by default.
You can set the lookback period at the indicator settings as well as the asset source (HL2,CLOSE, etc..). default is HL2
Quote that i like: “It is impossible to produce superior performance unless you do something different from the majority.” – John Templeton
Enjoy and like if you like :)
Double Zig Zag with HHLLHello Traders,
Here Double Zig Zag with HHLL script is with you. it calculates 2 Zig Zag simultaneously and draws them, and also it calculates and puts Higher High, Lower Low, Higher Low, Lower High labels. All these are done dynamically, it means last HH/HL/LL/LH can change. if price continues to go up then HL can turn to LL or if price continues to go down then LH can turn to HH. This script can be used for different purposes such trend analysis, support/resistance levels, breakouts etc.
I tried to make many things optional:
You can set Periods for Zig Zags as you wish
You can set different colors for both Zig Zag Up/Down lines
You have option to show both Zig Zag, one of them or none them
You have option to show both HHLL, one of them or none them
You can set Zig Zag 1 line style as Dashed or Dotted
You can set Line Widths for Zig Zags
Some examples:
Enjoy!
Swing Highs/Lows & Candle Patterns [LuxAlgo]This script labels swing highs and swing lows as well as the candle pattern that occurred at that precise point. The script can detect the following 6 candle patterns: hammer, inverse hammer, bullish engulfing, hanging man, shooting star, and bearish engulfing.
This indicator by its very nature backpaints by default, meaning that the displayed components are offset in the past.
🔶 USAGE
It can be interesting to see if a top or bottom is associated with a specific candle pattern, this allows us to study the potential of such a pattern to indicate a reversal. You can hover on a label with a specific pattern to see more details about it.
The notations HH, HL, LH, and LL you can see on the labels are defined as follows:
HH : Higher high
HL : Higher low
LH : Lower high
LL : Lower low
🔶 SETTING
Length: Sensitivity of the swing high/low detection, with lower values returning the maximum/minimum of shorter-term price variations.
L1 Moving Average Fingerprint for Long EntryLevel: 1
Background
This script combines moving average processing with highest high and lowest low to disclose the "fingerprint" of a specific trading pair to describe its unique behavior.
Function
Moving Average Fingerprint for Long Entry is a Level 1 pine script. It utilize several moving average of inherent highest high and lowest low and combine them with customized fingerprint coefficients to depict the unique behavior of a specific trading pair across multiple markets for long entry point identification.
Key Signal
FingerPrint1~6 are basic-level fingerprints with moving average of highest high and lowest low.
FingerPrint7~8 are composite fingerprint definitions with coefficients/weights,where coefficients/weights need to be tuned to discover the inherent "fingerprint" of a specific trading pair.
FingerPrint10~12 are composite fingerprint calculation for long entry alerts
ReadytoLong is a long entry filter where long entry point may happen within it. By using crossover() function to a customized threshold value, you can define accurate long entries.
Pros and Cons
Pros:
1. Combine moving average and extreme points to disclose a trading pair behavior.
2. Smart to tune specific set of parameters to obtain unique fingerprints of trading pairs.
3. Smart position sizing scheme by adjusting the threshold values.
Cons:
1. Require tune input parameters for each trading pair in a specific period and time frame.
2. Only long entry was studied, no short entry and re-entry are available yet to form as a trading system.
3. "ReadytoLong" is an inaccurate range where multiple long entries may happen at improper points in chop market.
4. Complex input parameters to obtain a unique fingerprint set.
Remarks
Although I wrote pine script for more than two years, this is the first script published in the community. I will publish more with my works in this platform.
Hope the community can improve this concept and make it as a trading system.
Readme
In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.
The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.
Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.
Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.
Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.
Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.
Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.
Previous Candle High and LowThis Indicator add's a label over and below the previous candle which show's it's high and low values.
Stock Breakout Algo by Technicaltrader615This is a Breakout Algo Suited for trading Stocks in NSE ( India) . The code looks for breakout above yesterday high and low with respect to the pivot R1 and S1. The order pings as Bracket order with 2R as target and 1R as risk. Time frame to be used is 5 mins.
We need to feed stocks with narrow range prior day for better performance.
You need to define risk in the Bridge for Each of the Stock. Lets say the stop loss is 10 points and Risk is 1000. The bridge will ping 1000/10 = 100 Shares to buy/ sell with 2R as target. the Target can be set to 3R also . This some times get rejected as Indian Stock exchange has upper circuit limit set. So we can go for 2R for ill-liquid stoks and 3R for liquid Stocks.
Similarly if 1000 Rs risk and 50 points sl , the bridge will place 1000/50 = 20 Share qty.
Breakout / Breakdown candles are Denoted by Colour change in the chart for visual purpose.
For more Details you can contact thru trading view chat window. You can also scroll down for my signature. This is only for the Students of Mine.
Higher High Lower Low - LiveHello All!
This is Higher High Lower Low - Live script. HHLL Live means Labels are calculated and placed dynamically. if you don't know what the Higher High - Lower Low is then you should search it on the net ;)
This is not Buy/Sell indicator but you can use it to analyse the trend or you can use it with other indicators to get signals and confirmation. You have option to use High/Low or Open/Close prices.
The script checks some indicators to see if it's in OB/OS levels and if they are in OB/OS levels then label colors are changed optionally. default OB level = 65, OS level = 35. you can set them as you wish.
I felt I need to protect the source code of the script, so this time it's not open-source.
Before you asked I should answer; it's non-repainting, live and dynamic script, you can use this with all time frames and any pair, indices, stocks etc ;)
You have option to get support/resistance levels and option to change bar color according to the trend that is calculated using broken S/R levels.
You can use different colors:
You can use Close/Open prices as source:
You have option to see only HH LL labels:
Enjoy and Good luck!
Higher/Lower Highs & LowsThis script prints higher highs , higher lows , lower highs and lower lows , as well as the last support or resistance line.
It can be configured with one parameter "lookback" which determines how fast the trend changes direction.
Alerts can be setup for each event.
Please note: the triangles are plotted with a 1 bar offset, meaning you will receive the alert 1 bar after, since the script is waiting for a price drop/climb to validate a higher/lower high/low.
Higher High and Lower Low Bar CountThe importance of counting HH&LL is to find the possible extreme of the current leg and the potential reversal.
This script helps you count the number of bars which are constantly higher or lower than the previous ones.
I set the script to count from the first one, but only display the number from the third, in order to eliminate too much noise.
Note : I have loosened the criteria of HH and LL.
Let's take "higher high" as an example, I will count the number If the current bar's low is higher than the previous one's and its high is higher or equal to the previous one's , and vice versa.
If you prefer the strict definition of HH or LL, you can modify the code as you wish.