SolCollector

Determine Consecutive Candles

SolCollector Cập nhật   
█ 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.
Phát hành các Ghi chú:
Indicator name update
Phát hành các Ghi chú:
Chart update - reversion
Phát hành các Ghi chú:
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.
Phát hành các Ghi chú:
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.
Phát hành các Ghi chú:
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
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?