In this post I'm going to delve into the guts of the most complex (to date) extension for Quantacula, the Candlestick Extension. Read the linked article first if you're not familiar with the Extension. Alright, now that you're an expert, let's delve deeper into Candlesticks to uncover all of the advanced goodies.
The Extension expresses candlestick patterns in the form of text based codes called CandleCodes. The format of a CandleCode is:
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:
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:
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.
BC:W = white body BC:B = black body
BL:L = long body BL:S = short body
CON:nB = this candle is contained within the candle n bars ago's body, CON:nR = this candle is contained within the candle n bars ago's, using its full range including high & low.
ENG:n = this candle engulfs the candle that is n bars back.
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.
Compares two price components of the candle. Replace c1 and c2 with one of the following codes:
Replace the ? with one of the following operands:
Like above, but compares a price of the current candle with a price from the candle n bars ago.
RL:L = long ranged candle, RL:S = short ranged candle
SL:+L = long upper shadow SL:+S = short upper shadow SL:-L = long lower shadow SL:-S = short lower shadow
The CandleCodes below aren't necessarily part of traditional candlestick pattern analysis, but they represent experimental and possibly important information that was worth including in the package.
CONSEC:nUPx = closing price has been above price x bars ago for n consecutive bars CONSEC:nDNx = closing price has been below price x bars ago for n consecutive bars
M:+S = closing price is above previous closing price but within near range. M:+L = closing price is far above previous closing price M:-S = closing price is below previous closing price but within near range. M:-L = closing price is far below previous closing price
RSI:>xxxnn - RSI indicator (nn period) is above value xxx RSI:<xxxnn - RSI indicator (nn period) is above value xxx
V:L = light volume V:M = medium volume V:H = heavy volume
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 Extension libraries that can work seamlessly with the Extension. This feature opens up the Candlestick Genetic Evolver to numerous new possibilities ripe for exploration.