OPEN-SOURCE SCRIPT

Highest/Lowest value since X time ago, various indicators

Diupdate
This script will count the bars back since the last time the current bar indicator value was either this low or this high.
It will provide the time in either, seconds, minutes, hours, days, weeks, months, or years.

please note:
There are currently no alerts setup for this script.
the length options only apply to the sources that have the "(MA)" in their name.
There is a horizontal line display issue which corrects once you adjust the amount of sources you want to use.
Once you select the amount of sources you would like to use, align the indicator so the horizontal lines match up with the table lines.

If find any bugs in the script, let me know.
Catatan Rilis
The script compares the current bar’s value based off the source selected to the historical bars. If the bar is a low value, it will look back and count until it finds another bar with a lower value. It will then convert the bars counted in to a one decimal place numerical value followed by a suffix. It will do the same for the high values.
So for an example, if you select source 1 as the RSI on the 15 minute chart. If the value of the relative strength index (RSI) is low, let’s say 10 – it will count how many 15-minute bars back until it finds an RSI value lower than 10. It then adds up all the bars and generates a label with the duration of time since a value was less.

There is one decimal place for everything else other than the seconds.
So, if the “bars time ago” was 1 day and 12 hours, it will show as 1.5d

The indicator will not count bars back further than what is specified in the count bars back limit option. So, if you select 60 bars on the 1 minute chart, the most it will look back will be to 60 bars ago which happens to be 1hr.
The indicator name distance is an integer value. With higher numbers, the source label name will move further away from the chart’s counted time labels.
The display filter option will only provide labels if the amount of time is greater than what is specified in the labels higher than option with the dropdown of time settings.
The time dropdown menu of seconds, minutes, hours, days, weeks, months, years.
The “display sources” menu will display the amount of sources/indicators you’d like to use. The length value on each source only applies to sources that have the moving average “(MA)” in their name.
The
please note:
There are currently no alerts setup for this script.
the length options only apply to the sources that have the "(MA)" in their name.
Display sources is the number of sources you’d like to have for labels. The horizontal lines between the sources will only display correctly once the display sources is changed.
The ease of movement source (eom) does not use the box ratio in its calculation and instead is simply the volume divided by the price move.
“The lowest since x time ago color” is the color for the labels that are the lowest since a certain amount of time ago.
“The highest since x time ago color” is the color for the labels that are the highest since a certain amount of time ago.
Currently the script has the follow indicators/values as sources:
ATR: Average True Range
CCI: Commodity Channel Index
COG: Center of Gravity
Close: Closing Price
Close percent: Percentage change in closing price
Dollar value: Total value of shares traded in dollars
EOM: Ease of Movement
Gaps: Price gaps between trading periods
High: Highest price of a trading period
Low: Lowest price of a trading period
MFI: Money Flow Index
OBV: On-Balance Volume
Open: Opening price of a trading period
Range Moving Average: Moving average difference between high and low prices of a trading period
RSI: Relative Strength Index
RVI: Relative Volatility Index
TimeClose: Closing time of a trading period
Volume: Total number of shares traded
Volume (MA): Moving average of trading volume

There are many ways you can use this script. The main idea is to pick up on sudden changes. An example could be if the range moving average has been the lowest since a long time ago, however the money flow shows highest since x time ago, and then is accompanied by highest volume since x time ago etc.
The lowest low since years ago with a highest close since years ago might be the start of an uptrend.
You can mix each source to get a better understanding of your strategy.
Catatan Rilis
corrected text size for the source label names.
Catatan Rilis
The Range MA is updated to only use an absolute percent value (positive number). The range MA looks at the past length of bars and compares the percent value from the lowest bar to the highest. If the current value is less than the previous bar’s value, it will then start counting back until it finds a lower value than itself and will provide you the amount of time since the occurrence.
Example:
So if you set the moving average range length to 20 bars, in those 20 bars the highest high compared to the lowest low is only 5%. If the previous bar’s moving average range was 8%, it will then keep counting back until it finds a bar that is less than the current bar of 5%. Then the value will be presented as a red label with a time of how long ago the first occurrence happened.
The highest value since x time ago works the same but in reverse. So, if the current bar’s value instead was 10%, and the previous bar’s value was 8%, it will count back until it finds a value higher than the 10%. It will then give you a label in green with the time lapsed since the first occurrence.
Catatan Rilis
The entire script has been re-written to add more features.

Below is a description of how this updated indicator works.

For simplicity we'll be on the daily timeframe and assume there is only 100 candles being displayed with one source selected as the RSI MA1 (moving average). The MA1 (moving average length) is set to 14 days.

Each block represents the percent rank of the candle's RSI value compared to all previous candles.

An example of how it is calculated:
Let's say the current candle's RSI is extremely low at 8, it will then compare its value to the prior candle. If the current candle's RSI is lower than the previous, it will count how many previous candles there were until it finds a value less than 8. If 99 candles were counted, then this means there were 99 counted candles until a value below 8 was found.

This 99 value is assigned to the current colored block. To get the color for this block, It is positioned within a percent rank with all other blocks that recorded their current candle's RSI lower than previous candles' RSI. Since there were only 100 candles and this one was lower than 99 prior candles, it will belong to the color group, "percent rank colors low to lower" 91 to 100 percent rank (currently set to bright pink/purple. If however the current candle's RSI only was lower than one previous candle, it'd have belonged in to 0 to 10 percent rank (dark red color).

The same principle is applied when dealing with the candle's RSI that is higher than previous RSIs. The only difference is, if the current candle's RSI is higher than 99 prior candles, it will be compared with all other blocks that had stored values of where a their candle's RSI was higher than previous candle RSIs. The color will then be assigned to the color group "percent rank colors high to higher" and will be placed in the 91 to 100 percent rank (bright teal color).

The formula for the timeframe length of candles is as follows:
99 counted candles are converted in to seconds then divided by the seconds in a month.
86,400 seconds in one day * 99 daily counted daily candle = 8,553,600 total seconds.
8,553,600 total seconds divided by 2,628,003 seconds in a month = 3.3M (M for month) since a prior candle was found that had a lower RSI.

This indicator's options are:

Sources - the amount of sources to display, minimum is 1 and maximum is 10 (note: having 10 sources creates a longer script load time. Trading view will not load scripts that are longer than their maximum load time limit.)

Load from the beginning / load from x bars - choose whether to load the blocks from the beginning of the chart or from the past amount of bars.

x bars: - the amount of prior bars of when the indicator should load.

Color based on (all bars)/(x bars:) - All bars will look at all prior candles for when calculating higher or lower prior candles and the percent rank color it will receive. X bars will only look at past amount of candles you enter.

x bars: - amount of prior bars to consider when calculating percent rank colors and time since prior low or high. This value only works if you have set color based on (all bars)/(x bars:) to "x bars:".

block vertical height trim - controls the vertical height of the blocks. At 0 there is barely a vertical gap between blocks at 0.5 the blocks disappear. minimum value is at 0, max is at 0.5.


Sources
sources with "MA1" in their name use the moving average length MA1. Whether sources use the MA1 or not, you can apply an additional moving average with the MA+.

ATR MA1 - All true range
body distance - the upper body minus lower body of the candle (does not include the wicks).
CCI MA1 - commodity channel index.
close percent - current close percent difference from previous close.
close - close price.
COG MA1 - center of gravity.
dollar value - volume * ((high + low + close) / 3)
close distance over volume - percent difference from current close to previous close divided by volume.
gaps - current open minus previous close.
high - high price.
low - low price.
MFI MA1 - money flow index.
OBV - on-balance volume.
open - open price.
range MA1 - moving average of high minus moving average of low.
RSI MA1 - relative strength index.
RVI MA1 - relative vigor index.
volume MA1 - moving average volume.
volume - volume.

Percent rank colors low to lower and percent rank colors high to higher - choose the colors for each block that falls in the percentage ranges. For source values that are lower than previous lows, they will use the low to lower colors, while source values higher than previous ranges will use the high to higher.

show more labels on left - there is a limit to how many labels can be shown. Moving this slider to the left will display the block's counted time label. Moving it enough to the left starts to remove labels to the right in order to display prior labels.

show more labels on right - if you have increased "Source label slider" to move labels to the left, if you're on a higher trading view plan, you will have access to more labels to be displayed. You might be able to increase this value to expand the range of labels shown. If you increase it too much labels on the left will begin to be removed.

source name label size
source value label size
title label horizontal distance - controls the horizontal distance of title labels.

source label text color
source label text outline color

title label text color
title label text outline color

barssincecountcounterhighestloweststatisticsTIMETrend AnalysisVolume

Skrip open-source

Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menerbitkannya sebagai sumber terbuka, sehingga para trader dapat memahami dan memverifikasinya. Hormat untuk penulisnya! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Inggin menggunakan skrip ini pada chart?

Pernyataan Penyangkalan