Bjorgum

BjCandlePatterns

Bjorgum Wizard Aktualisiert   
Library "BjCandlePatterns"

Patterns is a Japanese candlestick pattern recognition Library for developers. Functions here within detect viable setups in a variety of popular patterns. Please note some patterns are without filters such as comparisons to average candle sizing, or trend detection to allow the author more freedom.



doji(dojiSize, dojiWickSize) Detects "Doji" candle patterns
  Parameters:
    dojiSize: (float) The relationship of body to candle size (ie. body is 5% of total candle size). Default is 5.0 (5%)
    dojiWickSize: (float) Maximum wick size comparative to the opposite wick. (eg. 2 = bottom wick must be less than or equal to 2x the top wick). Default is 2
  Returns: (series bool) True when pattern detected

dLab(showLabel, labelColor, textColor) Produces "Doji" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

bullEngulf(maxRejectWick, mustEngulfWick) Detects "Bullish Engulfing" candle patterns
  Parameters:
    maxRejectWick: (float) Maximum rejection wick size.
The maximum wick size as a percentge of body size allowable for a top wick on the resolution candle of the pattern. 0.0 disables the filter.
eg. 50 allows a top wick half the size of the body. Default is 0% (Disables wick detection).
    mustEngulfWick: (bool) input to only detect setups that close above the high prior effectively engulfing the candle in its entirety. Default is false
  Returns: (series bool) True when pattern detected

bewLab(showLabel, labelColor, textColor) Produces "Bullish Engulfing" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

bearEngulf(maxRejectWick, mustEngulfWick) Detects "Bearish Engulfing" candle patterns
  Parameters:
    maxRejectWick: (float) Maximum rejection wick size.
The maximum wick size as a percentge of body size allowable for a bottom wick on the resolution candle of the pattern. 0.0 disables the filter.
eg. 50 allows a botom wick half the size of the body. Default is 0% (Disables wick detection).
    mustEngulfWick: (bool) Input to only detect setups that close below the low prior effectively engulfing the candle in its entirety. Default is false
  Returns: (series bool) True when pattern detected

bebLab(showLabel, labelColor, textColor) Produces "Bearish Engulfing" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

hammer(ratio, shadowPercent) Detects "Hammer" candle patterns
  Parameters:
    ratio: (float) The relationship of body to candle size (ie. body is 33% of total candle size). Default is 33%.
    shadowPercent: (float) The maximum allowable top wick size as a percentage of body size. Default is 5%.
  Returns: (series bool) True when pattern detected

hLab(showLabel, labelColor, textColor) Produces "Hammer" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

star(ratio, shadowPercent) Detects "Star" candle patterns
  Parameters:
    ratio: (float) The relationship of body to candle size (ie. body is 33% of total candle size). Default is 33%.
    shadowPercent: (float) The maximum allowable bottom wick size as a percentage of body size. Default is 5%.
  Returns: (series bool) True when pattern detected

ssLab(showLabel, labelColor, textColor) Produces "Star" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

dragonflyDoji() Detects "Dragonfly Doji" candle patterns
  Returns: (series bool) True when pattern detected

ddLab(showLabel, labelColor) Produces "Dragonfly Doji" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
  Returns: (series label) A label visible at the chart level intended for the title pattern

gravestoneDoji() Detects "Gravestone Doji" candle patterns
  Returns: (series bool) True when pattern detected

gdLab(showLabel, labelColor, textColor) Produces "Gravestone Doji" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

tweezerBottom(closeUpperHalf) Detects "Tweezer Bottom" candle patterns
  Parameters:
    closeUpperHalf: (bool) input to only detect setups that close above the mid-point of the candle prior increasing its bullish tendancy. Default is false
  Returns: (series bool) True when pattern detected

tbLab(showLabel, labelColor, textColor) Produces "Tweezer Bottom" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

tweezerTop(closeLowerHalf) Detects "TweezerTop" candle patterns
  Parameters:
    closeLowerHalf: (bool) input to only detect setups that close below the mid-point of the candle prior increasing its bearish tendancy. Default is false
  Returns: (series bool) True when pattern detected

ttLab(showLabel, labelColor, textColor) Produces "TweezerTop" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

spinningTopBull(wickSize) Detects "Bullish Spinning Top" candle patterns
  Parameters:
    wickSize: (float) input to adjust detection of the size of the top wick/ bottom wick as a percent of total candle size. Default is 34%, which ensures the wicks are both larger than the body.
  Returns: (series bool) True when pattern detected

stwLab(showLabel, labelColor, textColor) Produces "Bullish Spinning Top" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

spinningTopBear(wickSize) Detects "Bearish Spinning Top" candle patterns
  Parameters:
    wickSize: (float) input to adjust detection of the size of the top wick/ bottom wick as a percent of total candle size. Default is 34%, which ensures the wicks are both larger than the body.
  Returns: (series bool) True when pattern detected

stbLab(showLabel, labelColor, textColor) Produces "Bearish Spinning Top" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

spinningTop(wickSize) Detects "Spinning Top" candle patterns
  Parameters:
    wickSize: (float) input to adjust detection of the size of the top wick/ bottom wick as a percent of total candle size. Default is 34%, which ensures the wicks are both larger than the body.
  Returns: (series bool) True when pattern detected

stLab(showLabel, labelColor, textColor) Produces "Spinning Top" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

morningStar() Detects "Bullish Morning Star" candle patterns
  Returns: (series bool) True when pattern detected

msLab(showLabel, labelColor, textColor) Produces "Bullish Morning Star" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

eveningStar() Detects "Bearish Evening Star" candle patterns
  Returns: (series bool) True when pattern detected

esLab(showLabel, labelColor, textColor) Produces "Bearish Evening Star" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

haramiBull() Detects "Bullish Harami" candle patterns
  Returns: (series bool) True when pattern detected

hwLab(showLabel, labelColor, textColor) Produces "Bullish Harami" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

haramiBear() Detects "Bearish Harami" candle patterns
  Returns: (series bool) True when pattern detected

hbLab(showLabel, labelColor, textColor) Produces "Bearish Harami" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

haramiBullCross() Detects "Bullish Harami Cross" candle patterns
  Returns: (series bool) True when pattern detected

hcwLab(showLabel, labelColor, textColor) Produces "Bullish Harami Cross" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

haramiBearCross() Detects "Bearish Harami Cross" candle patterns
  Returns: (series bool) True when pattern detected

hcbLab(showLabel, labelColor) Produces "Bearish Harami Cross" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
  Returns: (series label) A label visible at the chart level intended for the title pattern

marubullzu() Detects "Bullish Marubozu" candle patterns
  Returns: (series bool) True when pattern detected

mwLab(showLabel, labelColor, textColor) Produces "Bullish Marubozu" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

marubearzu() Detects "Bearish Marubozu" candle patterns
  Returns: (series bool) True when pattern detected

mbLab(showLabel, labelColor, textColor) Produces "Bearish Marubozu" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

abandonedBull() Detects "Bullish Abandoned Baby" candle patterns
  Returns: (series bool) True when pattern detected

abwLab(showLabel, labelColor, textColor) Produces "Bullish Abandoned Baby" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

abandonedBear() Detects "Bearish Abandoned Baby" candle patterns
  Returns: (series bool) True when pattern detected

abbLab(showLabel, labelColor, textColor) Produces "Bearish Abandoned Baby" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

piercing() Detects "Piercing" candle patterns
  Returns: (series bool) True when pattern detected

pLab(showLabel, labelColor, textColor) Produces "Piercing" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

darkCloudCover() Detects "Dark Cloud Cover" candle patterns
  Returns: (series bool) True when pattern detected

dccLab(showLabel, labelColor, textColor) Produces "Dark Cloud Cover" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

tasukiBull() Detects "Upside Tasuki Gap" candle patterns
  Returns: (series bool) True when pattern detected

utgLab(showLabel, labelColor, textColor) Produces "Upside Tasuki Gap" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

tasukiBear() Detects "Downside Tasuki Gap" candle patterns
  Returns: (series bool) True when pattern detected

dtgLab(showLabel, labelColor, textColor) Produces "Downside Tasuki Gap" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

risingThree() Detects "Rising Three Methods" candle patterns
  Returns: (series bool) True when pattern detected

rtmLab(showLabel, labelColor, textColor) Produces "Rising Three Methods" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

fallingThree() Detects "Falling Three Methods" candle patterns
  Returns: (series bool) True when pattern detected

ftmLab(showLabel, labelColor, textColor) Produces "Falling Three Methods" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

risingWindow() Detects "Rising Window" candle patterns
  Returns: (series bool) True when pattern detected

rwLab(showLabel, labelColor, textColor) Produces "Rising Window" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

fallingWindow() Detects "Falling Window" candle patterns
  Returns: (series bool) True when pattern detected

fwLab(showLabel, labelColor, textColor) Produces "Falling Window" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

kickingBull() Detects "Bullish Kicking" candle patterns
  Returns: (series bool) True when pattern detected

kwLab(showLabel, labelColor, textColor) Produces "Bullish Kicking" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

kickingBear() Detects "Bearish Kicking" candle patterns
  Returns: (series bool) True when pattern detected

kbLab(showLabel, labelColor, textColor) Produces "Bearish Kicking" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

lls(ratio) Detects "Long Lower Shadow" candle patterns
  Parameters:
    ratio: (float) A relationship of the lower wick to the overall candle size expressed as a percent. Default is 75%
  Returns: (series bool) True when pattern detected

llsLab(showLabel, labelColor, textColor) Produces "Long Lower Shadow" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

lus(ratio) Detects "Long Upper Shadow" candle patterns
  Parameters:
    ratio: (float) A relationship of the upper wick to the overall candle size expressed as a percent. Default is 75%
  Returns: (series bool) True when pattern detected

lusLab(showLabel, labelColor, textColor) Produces "Long Upper Shadow" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

bullNeck() Detects "Bullish On Neck" candle patterns
  Returns: (series bool) True when pattern detected

nwLab(showLabel, labelColor, textColor) Produces "Bullish On Neck" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

bearNeck() Detects "Bearish On Neck" candle patterns
  Returns: (series bool) True when pattern detected

nbLab(showLabel, labelColor, textColor) Produces "Bearish On Neck" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

soldiers(wickSize) Detects "Three White Soldiers" candle patterns
  Parameters:
    wickSize: (float) Maximum allowable top wick size throughout pattern expressed as a percent of total candle height. Default is 5%
  Returns: (series bool) True when pattern detected

wsLab(showLabel, labelColor, textColor) Produces "Three White Soldiers" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

crows(wickSize) Detects "Three Black Crows" candle patterns
  Parameters:
    wickSize: (float) Maximum allowable bottom wick size throughout pattern expressed as a percent of total candle height. Default is 5%
  Returns: (series bool) True when pattern detected

bcLab(showLabel, labelColor, textColor) Produces "Three Black Crows" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

triStarBull() Detects "Bullish Tri-Star" candle patterns
  Returns: (series bool) True when pattern detected

tswLab(showLabel, labelColor, textColor) Produces "Bullish Tri-Star" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

triStarBear() Detects "Bearish Tri-Star" candle patterns
  Returns: (series bool) True when pattern detected

tsbLab(showLabel, labelColor, textColor) Produces "Bearish Tri-Star" identifier label
  Parameters:
    showLabel: (bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (series label) A label visible at the chart level intended for the title pattern

wrap(cond, barsBack, borderColor, bgcolor) Produces a box wrapping the highs and lows over the look back.
  Parameters:
    cond: (series bool) Condition under which to draw the box.
    barsBack: (series int) the number of bars back to begin drawing the box.
    borderColor: (series color) Color of the four borders. Optional. The default is color.gray.
    bgcolor: (series color) Background color of the box. Optional. The default is color.gray.
  Returns: (series box) A box who's top and bottom are above and below the highest and lowest points over the lookback

topWick() returns the top wick size of the current candle
  Returns: (series float) A value equivelent to the distance from the top of the candle body to its high

bottomWick() returns the bottom wick size of the current candle
  Returns: (series float) A value equivelent to the distance from the bottom of the candle body to its low

body() returns the body size of the current candle
  Returns: (series float) A value equivelent to the distance between the top and the bottom of the candle body

highestBody() returns the highest body of the current candle
  Returns: (series float) A value equivelent to the highest body, whether it is the open or the close

lowestBody() returns the lowest body of the current candle
  Returns: (series float) A value equivelent to the highest body, whether it is the open or the close

barRange() returns the height of the current candle
  Returns: (series float) A value equivelent to the distance between the high and the low of the candle

bodyPct() returns the body size as a percent
  Returns: (series float) A value equivelent to the percentage of body size to the overall candle size

midBody() returns the price of the mid-point of the candle body
  Returns: (series float) A value equivelent to the center point of the distance bewteen the body low and the body high

bodyupGap() returns true if there is a gap up between the real body of the current candle in relation to the candle prior
  Returns: (series bool) true if there is a gap up and no overlap in the real bodies of the current candle and the preceding candle

bodydwnGap() returns true if there is a gap down between the real body of the current candle in relation to the candle prior
  Returns: (series bool) true if there is a gap down and no overlap in the real bodies of the current candle and the preceding candle

gapUp() returns true if there is a gap down between the real body of the current candle in relation to the candle prior
  Returns: (series bool) true if there is a gap down and no overlap in the real bodies of the current candle and the preceding candle

gapDwn() returns true if there is a gap down between the real body of the current candle in relation to the candle prior
  Returns: (series bool) true if there is a gap down and no overlap in the real bodies of the current candle and the preceding candle

dojiBody() returns true if the candle body is a doji
  Returns: (series bool) true if the candle body is a doji. Defined by a body that is 5% of total candle size
Versionshinweise:
v2

Minor updates for label tooltips
Versionshinweise:
v3
updated wrap() default colors to combat small bug
Versionshinweise:
v4

NEW FUNCTIONS
"Inside" and "Double Inside" patterns with accompanying labels.


Added:
insideBar() Detects "Inside Bar" candle patterns
  Returns: (series bool) True when pattern detected

insLab(showLabel, labelColor, textColor) Produces "Inside Bar" identifier label
  Parameters:
    showLabel: (series bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (label) A label visible at the chart level intended for the title pattern

doubleInside() Detects "Double Inside Bar" candle patterns
  Returns: (series bool) True when pattern detected

dinLab(showLabel, labelColor, textColor) Produces "Double Inside Bar" identifier label
  Parameters:
    showLabel: (series bool) Shows label when input is true. Default is false
    labelColor: (series color) Color of the label border and arrow
    textColor: (series color) Text color
  Returns: (label) A label visible at the chart level intended for the title pattern

Can buy me a coffee here...


paypal.me/JBjorgum


BTC: bc1qfdf6rnzyhsj67y9atdrdyugy8x9hsvry4h3fvz

Pine Bibliothek

In echter TradingView-Manier hat der Autor diesen Pine-Code als Open-Source-Bibliothek veröffentlicht, so dass andere Pine-Programmierer aus unserer Community ihn weiterverwenden können. Ein Hoch auf den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Publikationen verwenden, aber die Wiederverwendung dieses Codes in einer Publikation unterliegt den Hausregeln.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.

Möchten Sie diese Bibliothek nutzen?

Kopieren Sie die folgende Zeile und fügen Sie sie in Ihr Skript ein.