SolCollector

Determine Consecutive Candles

SolCollector Diupdate   
█ OVERVIEW

This is a simple script that will plot labels over or under candles to show where there had been consecutive candles that closed in a similar fashion. This script was inspired by a Tweet about Bitcoin experiencing its first 7th-consecutive weekly black candle and I sought out to test that.

█ INPUTS

There are three inputs for this script.

"offset" (integer) - (Can be 0 or 1) Allows the user to apply this script at the currently closing candle or the most recently closed candle.
"Number of Candles" (integer) - (From 3 to 100*) Allows the user to select how many candles to back test for consecutive-ness.
"Black or White" (boolean) - Allows the user to select what kinds of candles to look for in this script. (true - Black , false - White ).

*Publishing open-sourced, this selection was arbitrary and can be modified at will.

█ USAGE

Because I had created this in a little over an hour, this is just a simple experiment that I wanted to share with others. Its applications are unknown to me, but I am interested in hearing how others may find what this script does useful.
Catatan Rilis:
Indicator name update
Catatan Rilis:
Chart update - reversion
Catatan Rilis:
Major re-work.

Adjustments made: No longer uses function calls, instead all of the logic is implemented in the global scope instead (I found this to be much easier than trying to play around with historical references on function calls).

Alerts have been added, and this script has now been made to be adaptive. The "Number of Candles" (now called "Min Number of Candles") is instead a lower bound for detection, and this script will recognize the longest run of consecutive black or white candles to display overtop a label.

Detection for both types of runs is now supported, and bugs with the "On Close" offset have been fixed.

The alerts to be generated from this script will:
- Inform the user of an additional candle being added onto a run that meets the minimum number of candles.
- Inform the user when a run has ended.

Both of these alerts may be turned on or off individually.
Catatan Rilis:
BUG FIXES:

Ordinal indicators have been fixed (and absolved into its own function for re-use). There had been an issue where the ordinal indicators of 11, 12, and 13 had not been accounted for. The logic itself was also wrong; 31, 32, 33, 51, 52 ... would be given a "th" for their ordinal indicators (if ever displayed), they should now display properly.

FUNCTIONALITY UPDATE:

A fellow trader (@yuip) approached me with an idea of adding support for detecting lower high and higher low runs. I took this idea one step further and also added the ability to detect higher high and lower low runs. Alerts for all 4 types of these runs have been added, and all may be turned on/off with boolean switches. Users now have the ability to disable the original function this script was meant to handle and focus on the runs specific to highs and lows.

DISPLAY CHANGES:

Along with the addition of other booleans to play around with, many of the inputs have now been put in representative groups for easier readability when using the options menu associated with this indicator.

Cheers.
Catatan Rilis:
New Features:

Index Offset
Show Counter Plots

The Index Offset integer will allow the user to specify which index to begin counting at. Default is 1, where the first candle in a run is considered candle '1', however this may be set so that the first candle in a run is identified as '0'. This applies to all types of runs.

The second feature introduced is more of a diagnostic feature. Show Counter Plots will allow the user to view how the variables used in this script to determine runs function. It is recommended that the indicator is moved to its own pane in order for this functionality to properly display. This will also remove all labels from the chart when enabled.

An example of the second feature can seen here (COINBASE:BTCUSD 1D):

I build open-source indicators, help support my work:

BTC: 3GJFVgbxWLZjbupSEDifqouKSw1DsQytDP
ETH/USDC: 0x8a9915B9281F72C08f0274049028bdD89cF76Fd3
LTC: MFX9qvAvMvz9rRC3o9QchzH1rP4woGSmv2
Skrip open-source

Dalam semangat TradingView, penulis dari skrip ini telah mempublikasikannya ke sumber-terbuka, maka trader dapat mengerti dan memverifikasinya. Semangat untuk penulis! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.

Inggin menggunakan skrip ini pada chart?