In this post I'm going to delve into the guts of the most complex (to date) extension for Quantacula, the Candlestick Patterns extension. Read the linked article first if you're not familiar with the Candlestick extension. Alright, now that you're an expert, let's delve deeper into the extension to uncover all of the advanced goodies.
CandleCodes
The extension expresses candlestick patterns in the form of text based codes. The format of a CandleCode is:
CODE:PARAMETER
Patterns that require more than one code to describe them have their CandleCodes separated by periods. For example, the Bearish Long Black Line is composed of two CandleCodes:
BL:L.BC:B
If a pattern requires more than one bar to describe, each set of CandleCodes is separated by a comma. For example, here is the two bar code that expresses the Bearish Engulfing pattern:
BL:S.BC:W,BC:B.ENG:1
If you know all of the codes, you can actually compose candlestick patterns by hand, like I did when I populated the pattern library with all of the patterns we're familiar with. In fact, if you right click on the Pattern Library list in the Candlestick Genetic Evolver tool, you'll see a popup menu item that lets you "Add a new Pattern Manually ..."
Here is a roster of the currently available CandleCodes.
Body Color
BC:W = white body, BC:B = black body
Body Length
BL:L = long body, BL:S = short body
Contained Within
CON:nB = contained within the candle "n" bars ago's body, CON:nR = contained within the candle "n" bars ago's hull range.
Engulfs
ENG:n = engulfs the bar n bars back.
Gap at Open
GAP:+ = gap up at open, GAP:- = gap down at open. A gap up at open occurs when the market opens above the previous bar's high. A gap down at open occurs when it opens below the previous low.
Price Comparison
P:c1?c2
Compares two price components of the candle. Replace c1 and c2 with one of the following codes:
O = open
H = high
L = low
C = close
T = top of body
B = bottom of body
M = midpoint of body
Replace the ? with one of the following operands:
=
>
<
n = near
f = far
Indexed Price Comparison
P-:nC1?c2
Like above, but compares a price of the current candle with a price from the candle n bars ago.
Range Length
RL:L = long ranged candle, RL:S = short ranged candle
Shadow Length
SL:+L = long upper shadow, SL:+S = short upper shadow, SL:-L = long lower shadow, SL:-S = short lower shadow
You now know how to construct a candlestick pattern by hand and add it to your Candlestick extension pattern library. In the next part of this article we'll show you how to develop your own CandleCode extensions that can work seamlessly with the extension! This feature opens up the Genetic Evolver to numerous new possibilities ripe for exploration.