Professional Documents
Culture Documents
C_DownTrend = true
C_UpTrend = true
var trendRule = input(trendRule1, "Detect Trend Based On", options=[trendRule1, trendRule2, "No
detection"])
if trendRule == trendRule1
if trendRule == trendRule2
C_ShadowEqualsPercent = 100.0
C_DojiBodyPercent = 5.0
C_Factor = 2.0 // shows the number of times the shadow dominates the candlestick body
// bool
getLabel(name) =>
getBullishLabel(labelText, tooltipMsg)
getBearishLabel(labelText, tooltipMsg)
getNeutralLabel(labelText, tooltipMsg)
C_OnNeckBearishNumberOfCandles = 2
C_OnNeckBearish = false
if C_DownTrend and C_BlackBody[1] and C_LongBody[1] and C_WhiteBody and open < close[1] and
C_SmallBody and C_Range!=0 and abs(close-low[1])<=C_BodyAvg*0.05
C_OnNeckBearish := true
C_RisingWindowBullishNumberOfCandles = 2
C_RisingWindowBullish = false
C_RisingWindowBullish := true
var msg_EN = "Rising Window\nRising Window is a two-candle bullish continuation pattern that forms
during an uptrend. Both candles in the pattern can be of any type with the exception of the Four-Price
Doji. The most important characteristic of the pattern is a price gap between the first candle's high and
the second candle's low. That gap (window) between two bars signifies support against the selling
pressure."
C_FallingWindowBearish = false
C_FallingWindowBearish := true
var msg_EN = "Falling Window\nFalling Window is a two-candle bearish continuation pattern that
forms during a downtrend. Both candles in the pattern can be of any type, with the exception of the
Four-Price Doji. The most important characteristic of the pattern is a price gap between the first candle's
low and the second candle's high. The existence of this gap (window) means that the bearish trend is
expected to continue."
C_FallingThreeMethodsBearishNumberOfCandles = 5
C_FallingThreeMethodsBearish = false
C_FallingThreeMethodsBearish := true
C_RisingThreeMethodsBullishNumberOfCandles = 5
C_RisingThreeMethodsBullish = false
if C_UpTrend[4] and (C_LongBody[4] and C_WhiteBody[4]) and (C_SmallBody[3] and C_BlackBody[3] and
open[3]<high[4] and close[3]>low[4]) and (C_SmallBody[2] and C_BlackBody[2] and open[2]<high[4] and
close[2]>low[4]) and (C_SmallBody[1] and C_BlackBody[1] and open[1]<high[4] and close[1]>low[4]) and
(C_LongBody and C_WhiteBody and close>close[4])
C_RisingThreeMethodsBullish := true
var msg_EN = "Rising Three Methods\nRising Three Methods is a five-candle bullish pattern that
signifies a continuation of an existing uptrend. The first candle is long and green, followed by three short
red candles with bodies inside the range of the first candle. The last candle is also green and long and it
closes above the close of the first candle. This decisive fifth strongly bullish candle hints that bears could
not reverse the prior uptrend and that bulls have regained control of the market."
C_TweezerTopBearishNumberOfCandles = 2
C_TweezerTopBearish = false
C_TweezerTopBearish := true
var msg_EN = "Tweezer Top\nTweezer Top is a two-candle pattern that signifies a potential bearish
reversal. The pattern is found during an uptrend. The first candle is long and green, the second candle is
red, and its high is nearly identical to the high of the previous candle. The virtually identical highs,
together with the inverted directions, hint that bears might be taking over the market."
C_TweezerBottomBullishNumberOfCandles = 2
C_TweezerBottomBullish = false
C_TweezerBottomBullish := true
C_DarkCloudCoverBearishNumberOfCandles = 2
C_DarkCloudCoverBearish = false
if (C_UpTrend[1] and C_WhiteBody[1] and C_LongBody[1]) and (C_BlackBody and open >= high[1] and
close < C_BodyMiddle[1] and close > open[1])
C_DarkCloudCoverBearish := true
alertcondition(C_DarkCloudCoverBearish, title = "Dark Cloud Cover", message = "New Dark Cloud Cover -
Bearish pattern detected.")
var msg_EN = "Dark Cloud Cover\nDark Cloud Cover is a two-candle bearish reversal candlestick
pattern found in an uptrend. The first candle is green and has a larger than average body. The second
candle is red and opens above the high of the prior candle, creating a gap, and then closes below the
midpoint of the first candle. The pattern shows a possible shift in the momentum from the upside to the
downside, indicating that a reversal might happen soon."
C_DownsideTasukiGapBearish = false
if C_LongBody[2] and C_SmallBody[1] and C_DownTrend and C_BlackBody[2] and C_BodyHi[1] <
C_BodyLo[2] and C_BlackBody[1] and C_WhiteBody and C_BodyHi <= C_BodyLo[2] and C_BodyHi >=
C_BodyHi[1]
C_DownsideTasukiGapBearish := true
var msg_EN = "Downside Tasuki Gap\nDownside Tasuki Gap is a three-candle pattern found in a
downtrend that usually hints at the continuation of the downtrend. The first candle is long and red,
followed by a smaller red candle with its opening price that gaps below the body of the previous candle.
The third candle is green and it closes inside the gap created by the first two candles, unable to close it
fully. The bull’s inability to close that gap hints that the downtrend might continue."
C_UpsideTasukiGapBullishNumberOfCandles = 3
C_UpsideTasukiGapBullish = false
if C_LongBody[2] and C_SmallBody[1] and C_UpTrend and C_WhiteBody[2] and C_BodyLo[1] >
C_BodyHi[2] and C_WhiteBody[1] and C_BlackBody and C_BodyLo >= C_BodyHi[2] and C_BodyLo <=
C_BodyLo[1]
C_UpsideTasukiGapBullish := true
C_EveningDojiStarBearishNumberOfCandles = 3
C_EveningDojiStarBearish = false
if C_LongBody[2] and C_IsDojiBody[1] and C_LongBody and C_UpTrend and C_WhiteBody[2] and
C_BodyLo[1] > C_BodyHi[2] and C_BlackBody and C_BodyLo <= C_BodyMiddle[2] and C_BodyLo >
C_BodyLo[2] and C_BodyLo[1] > C_BodyHi
C_EveningDojiStarBearish := true
alertcondition(C_EveningDojiStarBearish, title = "Evening Doji Star", message = "New Evening Doji Star -
Bearish pattern detected.")
var msg_EN = "Evening Doji Star\nThis candlestick pattern is a variation of the Evening Star pattern. It
is bearish and continues an uptrend with a long-bodied, green candle day. It is then followed by a gap
and a Doji candle and concludes with a downward close. The close would be below the first day’s
midpoint. It is more bearish than the regular evening star pattern because of the existence of the Doji."
C_DojiStarBearish = false
if C_UpTrend and C_WhiteBody[1] and C_LongBody[1] and C_IsDojiBody and C_BodyLo > C_BodyHi[1]
C_DojiStarBearish := true
alertcondition(C_DojiStarBearish, title = "Doji Star", message = "New Doji Star - Bearish pattern
detected.")
var msg_EN = "Doji Star\nThis is a bearish reversal candlestick pattern that is found in an uptrend and
consists of two candles. First comes a long green candle, followed by a Doji candle (except 4-Price Doji)
that opens above the body of the first one, creating a gap. It is considered a reversal signal with
confirmation during the next trading day."
C_DojiStarBullishNumberOfCandles = 2
C_DojiStarBullish = false
if C_DownTrend and C_BlackBody[1] and C_LongBody[1] and C_IsDojiBody and C_BodyHi < C_BodyLo[1]
C_DojiStarBullish := true
alertcondition(C_DojiStarBullish, title = "Doji Star", message = "New Doji Star - Bullish pattern detected.")
var msg_EN = "Doji Star\nThis is a bullish reversal candlestick pattern that is found in a downtrend and
consists of two candles. First comes a long red candle, followed by a Doji candle (except 4-Price Doji) that
opens below the body of the first one, creating a gap. It is considered a reversal signal with confirmation
during the next trading day."
var msg_CN = "翻译中……!"
C_MorningDojiStarBullishNumberOfCandles = 3
C_MorningDojiStarBullish = false
if C_LongBody[2] and C_IsDojiBody[1] and C_LongBody and C_DownTrend and C_BlackBody[2] and
C_BodyHi[1] < C_BodyLo[2] and C_WhiteBody and C_BodyHi >= C_BodyMiddle[2] and C_BodyHi <
C_BodyHi[2] and C_BodyHi[1] < C_BodyLo
C_MorningDojiStarBullish := true
alertcondition(C_MorningDojiStarBullish, title = "Morning Doji Star", message = "New Morning Doji Star -
Bullish pattern detected.")
var msg_EN = "Morning Doji Star\nThis candlestick pattern is a variation of the Morning Star pattern. A
three-day bullish reversal pattern, which consists of three candlesticks will look something like this: The
first being a long-bodied red candle that extends the current downtrend. Next comes a Doji that gaps
down on the open. After that comes a long-bodied green candle, which gaps up on the open and closes
above the midpoint of the body of the first day. It is more bullish than the regular morning star pattern
because of the existence of the Doji."
C_PiercingBullish = false
if (C_DownTrend[1] and C_BlackBody[1] and C_LongBody[1]) and (C_WhiteBody and open <= low[1] and
close > C_BodyMiddle[1] and close < open[1])
C_PiercingBullish := true
C_HammerBullishNumberOfCandles = 1
C_HammerBullish = false
if C_SmallBody and C_Body > 0 and C_BodyLo > hl2 and C_DnShadow >= C_Factor * C_Body and not
C_HasUpShadow
if C_DownTrend
C_HammerBullish := true
var msg_EN = "Hammer\nHammer candlesticks form when a security moves lower after the open, but
continues to rally into close above the intraday low. The candlestick that you are left with will look like a
square attached to a long stick-like figure. This candlestick is called a Hammer if it happens to form
during a decline."
C_HangingManBearishNumberOfCandles = 1
C_HangingManBearish = false
if C_SmallBody and C_Body > 0 and C_BodyLo > hl2 and C_DnShadow >= C_Factor * C_Body and not
C_HasUpShadow
if C_UpTrend
C_HangingManBearish := true
var msg_EN = "Hanging Man\nWhen a specified security notably moves lower after the open, but
continues to rally to close above the intraday low, a Hanging Man candlestick will form. The candlestick
will resemble a square, attached to a long stick-like figure. It is referred to as a Hanging Man if the
candlestick forms during an advance."
C_ShootingStarBearishNumberOfCandles = 1
C_ShootingStarBearish = false
if C_SmallBody and C_Body > 0 and C_BodyHi < hl2 and C_UpShadow >= C_Factor * C_Body and not
C_HasDnShadow
if C_UpTrend
C_ShootingStarBearish := true
var msg_EN = "Shooting Star\nThis single day pattern can appear during an uptrend and opens high,
while it closes near its open. It trades much higher as well. It is bearish in nature, but looks like an
Inverted Hammer."
C_InvertedHammerBullishNumberOfCandles = 1
C_InvertedHammerBullish = false
if C_SmallBody and C_Body > 0 and C_BodyHi < hl2 and C_UpShadow >= C_Factor * C_Body and not
C_HasDnShadow
if C_DownTrend
C_InvertedHammerBullish := true
var msg_EN = "Inverted Hammer\nIf in a downtrend, then the open is lower. When it eventually trades
higher, but closes near its open, it will look like an inverted version of the Hammer Candlestick. This is a
one-day bullish reversal pattern."
var msg_CN = "翻译中……!"
C_MorningStarBullishNumberOfCandles = 3
C_MorningStarBullish = false
if C_DownTrend and C_BlackBody[2] and C_BodyHi[1] < C_BodyLo[2] and C_WhiteBody and C_BodyHi
>= C_BodyMiddle[2] and C_BodyHi < C_BodyHi[2] and C_BodyHi[1] < C_BodyLo
C_MorningStarBullish := true
var msg_EN = "Morning Star\nA three-day bullish reversal pattern, which consists of three candlesticks
will look something like this: The first being a long-bodied red candle that extends the current
downtrend. Next comes a short, middle candle that gaps down on the open. After comes a long-bodied
green candle, which gaps up on the open and closes above the midpoint of the body of the first day."
C_EveningStarBearishNumberOfCandles = 3
C_EveningStarBearish = false
if C_UpTrend and C_WhiteBody[2] and C_BodyLo[1] > C_BodyHi[2] and C_BlackBody and C_BodyLo <=
C_BodyMiddle[2] and C_BodyLo > C_BodyLo[2] and C_BodyLo[1] > C_BodyHi
C_EveningStarBearish := true
var msg_EN = "Evening Star\nThis candlestick pattern is bearish and continues an uptrend with a long-
bodied, green candle day. It is then followed by a gapped and small-bodied candle day, and concludes
with a downward close. The close would be below the first day’s midpoint."
C_MarubozuWhiteBullishNumberOfCandles = 1
C_MarubozuShadowPercentWhite = 5.0
var msg_EN = "Marubozu White\nA Marubozu White Candle is a candlestick that does not have a
shadow that extends from its candle body at either the open or the close. Marubozu is Japanese for
“close-cropped” or “close-cut.” Other sources may call it a Bald or Shaven Head Candle."
C_MarubozuBlackBearishNumberOfCandles = 1
C_MarubozuShadowPercentBearish = 5.0
var msg_EN = "Marubozu Black\nThis is a candlestick that has no shadow, which extends from the red-
bodied candle at the open, the close, or even at both. In Japanese, the name means “close-cropped” or
“close-cut.” The candlestick can also be referred to as Bald or Shaven Head."
C_DojiNumberOfCandles = 1
alertcondition(C_Doji and not C_DragonflyDoji and not C_GravestoneDojiOne, title = "Doji", message =
"New Doji pattern detected.")
if C_Doji and not C_DragonflyDoji and not C_GravestoneDojiOne and DojiInput and showNeutralSignal
var msg_EN = "Doji\nWhen the open and close of a security are essentially equal to each other, a doji
candle forms. The length of both upper and lower shadows may vary, causing the candlestick you are left
with to either resemble a cross, an inverted cross, or a plus sign. Doji candles show the playout of buyer-
seller indecision in a tug-of-war of sorts. As price moves either above or below the opening level during
the session, the close is either at or near the opening level."
C_GravestoneDojiBearishNumberOfCandles = 1
var msg_EN = "Gravestone Doji\nWhen a doji is at or is close to the day’s low point, a doji line will
develop."
C_DragonflyDojiBullishNumberOfCandles = 1
var msg_EN = "Dragonfly Doji\nSimilar to other Doji days, this particular Doji also regularly appears at
pivotal market moments. This is a specific Doji where both the open and close price are at the high of a
given day."
C_HaramiCrossBullishNumberOfCandles = 2
var msg_EN = "Harami Cross\nThis candlestick pattern is a variation of the Harami Bullish pattern. It is
found during a downtrend. The two-day candlestick pattern consists of a Doji candle that is entirely
encompassed within the body of what was once a red-bodied candle."
var msg_EN = "Harami Cross\nThis candlestick pattern is a variation of the Harami Bearish pattern. It is
found during an uptrend. This is a two-day candlestick pattern with a Doji candle that is entirely
encompassed within the body that was once a green-bodied candle. The Doji shows that some
indecision has entered the minds of sellers, and the pattern hints that the trend might reverse."
C_HaramiBullishNumberOfCandles = 2
var msg_EN = "Harami\nThis two-day candlestick pattern consists of a small-bodied green candle that
is entirely encompassed within the body of what was once a red-bodied candle."
var msg_EN = "Harami\nThis is a two-day candlestick pattern with a small, red-bodied candle that is
entirely encompassed within the body that was once a green-bodied candle."
C_LongLowerShadowBullishNumberOfCandles = 1
C_LongLowerShadowPercent = 75.0
var msg_EN = "Long Lower Shadow\nTo indicate seller domination of the first part of a session,
candlesticks will present with long lower shadows and short upper shadows, consequently lowering
prices."
C_LongUpperShadowBearishNumberOfCandles = 1
C_LongShadowPercent = 75.0
var msg_EN = "Long Upper Shadow\nTo indicate buyer domination of the first part of a session,
candlesticks will present with long upper shadows, as well as short lower shadows, consequently raising
bidding prices."
C_SpinningTopWhiteNumberOfCandles = 1
C_SpinningTopWhitePercent = 34.0
alertcondition(C_SpinningTopWhite, title = "Spinning Top White", message = "New Spinning Top White
pattern detected.")
C_SpinningTopBlackNumberOfCandles = 1
C_SpinningTopBlackPercent = 34.0
alertcondition(C_SpinningTopBlack, title = "Spinning Top Black", message = "New Spinning Top Black
pattern detected.")
var msg_EN = "Spinning Top Black\nBlack spinning tops are candlestick lines that are small, red-
bodied, and possess shadows (upper and lower) that end up exceeding the length of candle bodies. They
often signal indecision."
C_ThreeWhiteSoldiersBullishNumberOfCandles = 3
C_3WSld_ShadowPercent = 5.0
C_ThreeWhiteSoldiersBullish = false
C_ThreeWhiteSoldiersBullish := close > close[1] and close[1] > close[2] and open < close[1] and open
> open[1] and open[1] < close[2] and open[1] > open[2] and C_3WSld_HaveNotUpShadow and
C_3WSld_HaveNotUpShadow[1] and C_3WSld_HaveNotUpShadow[2]
var msg_EN = "Three White Soldiers\nThis bullish reversal pattern is made up of three long-bodied,
green candles in immediate succession. Each one opens within the body before it and the close is near to
the daily high."
C_ThreeBlackCrowsBearishNumberOfCandles = 3
C_3BCrw_ShadowPercent = 5.0
C_ThreeBlackCrowsBearish = false
C_ThreeBlackCrowsBearish := close < close[1] and close[1] < close[2] and open > close[1] and open <
open[1] and open[1] > close[2] and open[1] < open[2] and C_3BCrw_HaveNotDnShadow and
C_3BCrw_HaveNotDnShadow[1] and C_3BCrw_HaveNotDnShadow[2]
alertcondition(C_ThreeBlackCrowsBearish, title = "Three Black Crows", message = "New Three Black
Crows - Bearish pattern detected.")
var msg_EN = "Three Black Crows\nThis is a bearish reversal pattern that consists of three long, red-
bodied candles in immediate succession. For each of these candles, each day opens within the body of
the day before and closes either at or near its low."
C_EngulfingBullishNumberOfCandles = 2
var msg_EN = "Engulfing\nAt the end of a given downward trend, there will most likely be a reversal
pattern. To distinguish the first day, this candlestick pattern uses a small body, followed by a day where
the candle body fully overtakes the body from the day before, and closes in the trend’s opposite
direction. Although similar to the outside reversal chart pattern, it is not essential for this pattern to
completely overtake the range (high to low), rather only the open and the close."
var msg_EN = "Engulfing\nAt the end of a given uptrend, a reversal pattern will most likely appear.
During the first day, this candlestick pattern uses a small body. It is then followed by a day where the
candle body fully overtakes the body from the day before it and closes in the trend’s opposite direction.
Although similar to the outside reversal chart pattern, it is not essential for this pattern to fully overtake
the range (high to low), rather only the open and the close."
C_AbandonedBabyBullishNumberOfCandles = 3
var msg_EN = "Abandoned Baby\nThis candlestick pattern is quite rare as far as reversal patterns go.
The first of the pattern is a large down candle. Next comes a doji candle that gaps below the candle
before it. The doji candle is then followed by another candle that opens even higher and swiftly moves to
the upside."
C_AbandonedBabyBearishNumberOfCandles = 3
var msg_EN = "Abandoned Baby\nA bearish abandoned baby is a specific candlestick pattern that
often signals a downward reversal trend in terms of security price. It is formed when a gap appears
between the lowest price of a doji-like candle and the candlestick of the day before. The earlier
candlestick is green, tall, and has small shadows. The doji candle is also tailed by a gap between its
lowest price point and the highest price point of the candle that comes next, which is red, tall and also
has small shadows. The doji candle shadows must completely gap either below or above the shadows of
the first and third day in order to have the abandoned baby pattern effect."
C_TriStarBullishNumberOfCandles = 3
var msg_EN = "Tri-Star\nA bullish TriStar candlestick pattern can form when three doji candlesticks
materialize in immediate succession at the tail-end of an extended downtrend. The first doji candle
marks indecision between bull and bear. The second doji gaps in the direction of the leading trend. The
third changes the attitude of the market once the candlestick opens in the direction opposite to the
trend. Each doji candle has a shadow, all comparatively shallow, which signify an interim cutback in
volatility."
C_TriStarBearishNumberOfCandles = 3
var msg_EN = "Tri-Star\nThis particular pattern can form when three doji candlesticks appear in
immediate succession at the end of an extended uptrend. The first doji candle marks indecision between
bull and bear. The second doji gaps in the direction of the leading trend. The third changes the attitude
of the market once the candlestick opens in the direction opposite to the trend. Each doji candle has a
shadow, all comparatively shallow, which signify an interim cutback in volatility."
C_KickingBullishNumberOfCandles = 2
C_MarubozuShadowPercent = 5.0
var msg_EN = "Kicking\nThe first day candlestick is a bearish marubozu candlestick with next to no
upper or lower shadow and where the price opens at the day’s high and closes at the day’s low. The
second day is a bullish marubozu pattern, with next to no upper or lower shadow and where the price
opens at the day’s low and closes at the day’s high. Additionally, the second day gaps up extensively and
opens above the opening price of the day before. This gap or window, as the Japanese call it, lies
between day one and day two’s bullish candlesticks."
C_KickingBearishNumberOfCandles = 2
C_MarubozuBullishShadowPercent = 5.0
C_MarubozuBearishKicking = C_LongBody and C_UpShadow <=
C_MarubozuBullishShadowPercent/100*C_Body and C_DnShadow <=
C_MarubozuBullishShadowPercent/100*C_Body
var ttBearishKicking = "Kicking\nA bearish kicking pattern will occur, subsequently signaling a reversal
for a new downtrend. The first day candlestick is a bullish marubozu. The second day gaps down
extensively and opens below the opening price of the day before. There is a gap between day one and
two’s bearish candlesticks."
getBearishLabel("K", ttBearishKicking)