Highest/Lowest value since X time ago, various indicators

Dean_Crypto Telah dikemas kini   
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.
Nota Keluaran:
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.
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.
Nota Keluaran:
corrected text size for the source label names.
Nota Keluaran:
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.
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.
Skrip sumber terbuka

Dalam semangat TradingView yang sebenar, penulis skrip ini telah menerbitkannya dengan menggunakan sumber terbuka supaya pedagang-pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda dapat menggunakannya secara percuma tetapi penggunaan semula kod ini dalam penerbitan adalah dikawalselia oleh Peraturan Dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.


Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.

Ingin menggunakan skrip ini pada carta?