Docs / Rule language
Rule language
Pattern functions
25 candlestick patterns, built into Ora's rule language. Each takes no arguments, reads the latest bar and the ones before it, and is shorthand for a rule, so it answers with a graded belief and combines with anything else.
| Conventions | Body = |C − O|, range = H − L, upper wick = H − greatest(O, C), lower wick = least(O, C) − L. "After a decline" or "rise" compares the close with the close five bars back. |
|---|---|
| Graded | A pattern is several conditions joined by and, so its belief is its weakest part: a bar that nearly qualifies scores above one that is nowhere close. |
| English | Questions such as "Is today an inside bar?" compile to the pattern: on TSLA it ran inside_bar() with basis pattern. |
| Context | A candle means more where it appears: hammer() and L <= 1.01 * lowest(L, 20), engulfing_bull() and C > sma(C, 50). More in the Rule library. |
All patterns
doji()Body at most 10% of the day's range.
Expands to
(H > L) and (abs(C - O) <= 0.1 * (H - L))
dragonfly_doji()Doji with a long lower wick (60%+ of the range) and almost no upper wick.
Expands to
((H > L) and (abs(C - O) <= 0.1 * (H - L))) and ((H - greatest(O, C)) <= 0.1 * (H - L)) and ((least(O, C) - L) >= 0.6 * (H - L))
gravestone_doji()Doji with a long upper wick and almost no lower wick.
Expands to
((H > L) and (abs(C - O) <= 0.1 * (H - L))) and ((least(O, C) - L) <= 0.1 * (H - L)) and ((H - greatest(O, C)) >= 0.6 * (H - L))
spinning_top()Small body (10–30% of range) with wicks of at least a quarter of the range on both sides.
Expands to
(H > L) and (abs(C - O) <= 0.3 * (H - L)) and (abs(C - O) > 0.1 * (H - L)) and ((H - greatest(O, C)) >= 0.25 * (H - L)) and ((least(O, C) - L) >= 0.25 * (H - L))
marubozu()Body at least 90% of the range: almost no wicks.
Expands to
(H > L) and (abs(C - O) >= 0.9 * (H - L))
hammer()Lower wick at least twice the body, upper wick at most 10% of the range, closing below the close five bars back.
Expands to
((H > L) and (abs(C - O) > 0) and ((least(O, C) - L) >= 2 * abs(C - O)) and ((H - greatest(O, C)) <= 0.1 * (H - L))) and (C < C[-5])
hanging_man()Hammer shape, closing above the close five bars back.
Expands to
((H > L) and (abs(C - O) > 0) and ((least(O, C) - L) >= 2 * abs(C - O)) and ((H - greatest(O, C)) <= 0.1 * (H - L))) and (C > C[-5])
shooting_star()Upper wick at least twice the body, lower wick at most 10% of the range, after a five-bar rise.
Expands to
((H > L) and (abs(C - O) > 0) and ((H - greatest(O, C)) >= 2 * abs(C - O)) and ((least(O, C) - L) <= 0.1 * (H - L))) and (C > C[-5])
inverted_hammer()Shooting-star shape after a five-bar decline.
Expands to
((H > L) and (abs(C - O) > 0) and ((H - greatest(O, C)) >= 2 * abs(C - O)) and ((least(O, C) - L) <= 0.1 * (H - L))) and (C < C[-5])
engulfing_bull()A green body that engulfs yesterday's red body.
Expands to
(C[-1] < O[-1]) and (C > O) and (O <= C[-1]) and (C >= O[-1]) and (abs(C - O) > abs(C[-1] - O[-1]))
engulfing_bear()A red body that engulfs yesterday's green body.
Expands to
(C[-1] > O[-1]) and (C < O) and (O >= C[-1]) and (C <= O[-1]) and (abs(C - O) > abs(C[-1] - O[-1]))
harami_bull()A small green body inside yesterday's red body.
Expands to
(C[-1] < O[-1]) and (C > O) and (abs(C - O) < abs(C[-1] - O[-1])) and (O >= C[-1]) and (C <= O[-1])
harami_bear()A small red body inside yesterday's green body.
Expands to
(C[-1] > O[-1]) and (C < O) and (abs(C - O) < abs(C[-1] - O[-1])) and (O <= C[-1]) and (C >= O[-1])
piercing_line()After a red day, opens below its close and closes above the middle of its body (but under its open).
Expands to
(C[-1] < O[-1]) and (C > O) and (O < C[-1]) and (C > (O[-1] + C[-1]) / 2) and (C < O[-1])
dark_cloud()After a green day, opens above its close and closes below the middle of its body (but above its open).
Expands to
(C[-1] > O[-1]) and (C < O) and (O > C[-1]) and (C < (O[-1] + C[-1]) / 2) and (C > O[-1])
morning_star()A red bar, a small bar (half its body or less) that stays under its close, then a green bar closing above the middle of the first.
Expands to
(C[-2] < O[-2]) and (abs(C[-1] - O[-1]) <= 0.5 * abs(C[-2] - O[-2])) and (greatest(O[-1], C[-1]) <= C[-2]) and (C > O) and (C > (O[-2] + C[-2]) / 2)
evening_star()A green bar, a small bar that stays above its close, then a red bar closing below the middle of the first.
Expands to
(C[-2] > O[-2]) and (abs(C[-1] - O[-1]) <= 0.5 * abs(C[-2] - O[-2])) and (least(O[-1], C[-1]) >= C[-2]) and (C < O) and (C < (O[-2] + C[-2]) / 2)
three_white_soldiers()Three green bars, each closing higher and opening inside the previous body.
Expands to
(C > O) and (C[-1] > O[-1]) and (C[-2] > O[-2]) and (C > C[-1]) and (C[-1] > C[-2]) and (O >= O[-1]) and (O <= C[-1]) and (O[-1] >= O[-2]) and (O[-1] <= C[-2])
three_black_crows()Three red bars, each closing lower and opening inside the previous body.
Expands to
(C < O) and (C[-1] < O[-1]) and (C[-2] < O[-2]) and (C < C[-1]) and (C[-1] < C[-2]) and (O <= O[-1]) and (O >= C[-1]) and (O[-1] <= O[-2]) and (O[-1] >= C[-2])
tweezer_bottom()Red then green, with lows within 0.1% of each other.
Expands to
(C[-1] < O[-1]) and (C > O) and (abs(L - L[-1]) <= 0.001 * C[-1])
tweezer_top()Green then red, with highs within 0.1%.
Expands to
(C[-1] > O[-1]) and (C < O) and (abs(H - H[-1]) <= 0.001 * C[-1])
inside_bar()Today's high and low are inside yesterday's (equal counts).
Expands to
(H <= H[-1]) and (L >= L[-1])
outside_bar()Today's high above yesterday's and low below it.
Expands to
(H > H[-1]) and (L < L[-1])
gap_up()Today's whole range is above yesterday's high: an unfilled gap up.
Expands to
L > H[-1]
gap_down()Today's whole range is below yesterday's low.
Expands to
H < L[-1]
Information, not investment advice. Beliefs and probabilities on this page are real responses for the session shown and change with every session.