Your interactive trading laboratory!
24 users online

Quantacula Help

C# API Reference
Development Blog
Indicator Spotlights

QCommunity Extensions
The open-source GitHub repository of source code for the QCommunity Extensions library. Contains indicators and other extensions submitted by the Quantacula Community. Look for QCommunity indicators when you create a Building Block model, mark the "QCommunity" library check box to expose them.

The open-source GitHub repository of source code for the TASCExtensions Quantacula extension. Contains indicators and other extensions adapted from the Traders' Tips articles in Technical Analysis of Stocks & Commodities magazine.
CandleCode for CandleSticks Extension
Published by Q Glitch on 12/20/2018

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.

Body Color

BC:W = white body BC:B = black body

Body Length

BL:L = long body BL:S = short body

Contained Within

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 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


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


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

Experimental CandleCodes

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.

Consecutive Up/Down Bars

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

Price Move

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

Volume Strength

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.