Determine Consecutive Candles

SolCollector 업데이트됨   

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.


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.


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.
릴리즈 노트:
Indicator name update
릴리즈 노트:
Chart update - reversion
릴리즈 노트:
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.
릴리즈 노트:

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.


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.


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.

릴리즈 노트:
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
오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.


이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?