Your interactive trading laboratory!
 • 
16 users online

Quantacula Help

How-To
C# API Reference
Extensions
Development Blog
API-Extensions
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.

TASC-Extensions
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.
TrendChartStyles
Published by Q Glitch on 10/12/2018

The Trend Chart Styles extension includes the following new chart styles for Quantacula Studio:

  • Kagi
  • Line Break
  • Point & Figure
  • Renko

Additionally, the extension contains building block conditions and indicators that can be used both in Quantacula Studio, and the Quantacula web site. For those of you who code your models in the C# programming language, the extension includes .NET classes that let you programmatically create and interrogate the chart styles listed above. If you use these classes, be sure to add using TrendChartStyles; along with your other using statements.

All the chart styles in this extension display with a non-uniform date axis. They rely on reversals to determine when to plot the next data on the chart. Therefore, each piece of data plotted may comprise many actual bars of historical data.

Kagi Charts

Kagi charts display price movement in a series of variable length vertical lines connected by short horizontal lines. A new vertical line is drawn when prices complete a reversal based on a percentage or point value that you specify in the configuration. Kagi charts can be based off closing price, or highs and lows.

Kagi also includes the concept of Yin/Yang. When prices penetrate the previous reversal high, they enter Yang territory, and are plotted with a thick line. Alternately, when prices cross below the previous reversal low, they enter Yin territory, and are plotted with a thin line.

Kagi Charts

Kagi Building Block and Indicator

These items can be used both in Quantacula Studio, and in Q-Web here on the Quantacula.com web site. The Kagi Reversal building block condition resolves to true if a Kagi reversal was detected on the bar being evaluated. The KagiYinYang indicator resolved to 1 if a bar is in Kagi Yang territory, and a 0 if it is in Yin territory.

Kagi .NET Class

Create an instance of the Kagi class to work with Kagi methods in your C# coded models. Use the following constructor format:

public Kagi(BarHistory bars, SourceData kagiSource, ReversalTypes kagiRevType, double revAmount)

SourceData = CloseOnly or HighsAndLows.

ReversalTypes = Value (point value) or Percent.

Once you have an instance of the Kagi class created, you can access its properties and methods.

public List<KagiEvent> Events

Returns a list of KagiEvent instances that represent the Kagi reversals in the source data. The KagiEvent class contains the following properties:

  • int Index – the index within the source data that the reversal was triggered.
  • double ReversalPrice – the price value that triggered the reversal.
  • YinYang YinYang – the current Yin/Yang state. The YinYang enum can assume values of Yin or Yang.
  • double? YinYangStateChange – if there was a change in Yin/Yang state, this property contains the price value at which the state change occurred.
  • bool IsUpsideReversal – is it an upside reversal?
  • bool IsDownsideReversal – is it a downside reversal?
public KagiEvent EventAt(int idx)

Returns the KagiEvent that occurred on the specified bar, or null if no event occurred at that bar.

public TimeSeries YinYangSeries

Returns the TimeSeries that represents the Yin/Yang state of the source data. This is the TimeSeries that is used to populate the KagiYinYang indicator contained in this extension.

Line Break Charts

Line break charts display price action using a series of boxes called lines. If prices continue in one direction, new lines are added in that direction. A new line in the opposite direction will be added only if a previous number of lines are penetrated. The number of lines to penetrate is configurable, with a default value of three. For example, in a downtrend, a new upside reversal line will be plotted only if prices penetrate the high of the previous three downside lines.

Line Break Charts

Line Break Building Block and Indicators

The Line Break Reversal building block condition resolves to true if a Line Break reversal occurred on the bar of data being evaluated. The LineBreakCount indicator contains the number of consecutive up or down lines. Up lines are represented by positive values, and down lines by negative values. The LineBreakValue indicator returns the value needed to penetrate the most recent N lines, configurable via parameter. You can use this indicator as a stop value for an entry trade, to simulate the Line Break trading method in a trading model.

LineBreak .NET Class

Create an instance of the LineBreak class to work with Line Break methods in your C# coded models. Use the following constructor to create an instance of the LineBreak class:

public LineBreak(BarHistory bh, int lineCount)

Once created, you can access the following properties and methods of the class.

public List<LineBreakLine> Lines

Returns a list of LineBreakLine objects that represent the lines on the Line Break chart. The LineBreakLine class has the following properties:

  • int Index – the index in the source data where this line occurs.
  • int LineIndex – the index into the LineBreak.Lines property where this instance occurs.
  • double High – the high value of the line.
  • double Low – the low value of the line.
  • bool IsUpsideLine – is it an upside line?
  • bool IsDownsideLine – is it a downside line?
  • bool IsReversal – did a reversal occur at this line?
public LineBreakLine LineAt(int idx)

Returns the LineBreakLine instance at the specified index into the source data. If no LineBreakLine exists at that index, returns null.

public TimeSeries LineCounts

Returns a TimeSeries that contains the number of running line counts (positive for upside lines, negative for downside lines) as of each bar in the source data. This is the TimeSeries used to populate the LineBreakCount indicator.

public TimeSeries GetBreakoutSeries(BarHistory bars, int lineCount, bool basedOnHighs)

Returns a TimeSeries that contains the highest (if basedOnHighs = true) or lowest (if basedOnHighs = false) value of the previous lineCount lines. This method is used to populate the LineBreakValue indicator.

Point & Figure Charts

Point & Figure charts are displayed as a series of columns of X's and O'x. Columns with X's represent rising prices, and columns with O's indicate falling prices. The symbols plotted on a Point & Figure chart are called boxes. New boxes are added only if prices move by a certain, configurable, amount.

Point & Figure Charts

Point & Figure boxes can be calculated based on closing prices only, or on highs and lows. They can also be based on either a fixed point value, or a percentage. You configure both the box size, and the reversal count, which indicates how many boxes in the opposite direction need to occur for a reversal to actually plot.

If you select the Traditional box type, this overrides the calculation and box size settings, and establishes a Point & Figure chart based on point values, using the highest data value in the chart history. The following table is used to determine the box size. This method is not recommended for backtesting, because the full range of data is used to determine the dynamic box size, so this introduces an element of look-ahead.

Highest HighBox Size
>= 25,000500
>= 1,00050
>= 5005
>= 2004
>= 1002
>= 201
>= 50.5
>= 10.25
>= 0.250.125
< 0.250.0625

Point & Figure Building Block and Indicator

The Point & Figure Reversal building block condition resolves to true if there is a Point & Figure reversal on the bar of data being processed. The PFBoxCount indicator returns a series of values that contain the running total up X boxes (positive values) and O boxes (negative values) in the source data.

PointAndFigure .NET Class

Create an instance of the PointAndFigure .NET class to work with Point & Figure concepts in your C# coded models. Use the following constructor to create a PointAndFigure instance:

public PointAndFigure(BarHistory bars, SourceData pfMethod, PointAndFigureBoxTypes pfBoxType, double boxSize, int boxCount)

SourceData = CloseOnly or HighsAndLows

PointAndFigureBoxTypes = Traditional, Fixed or Point

After creating the PointAndFigure instance, you can access its properties and methods, described below.

public List<PointAndFigureColumn> Columns

Returns a list of PointAndFigureColumn objects that represent the columns in the Point & Figure chart. The PointAndFigureColumn class has the following properties:

  • int Index – the index that the column occurred in the source data
  • bool IsRisingX – is it a rising (X) column?
  • bool IsFallingO – is it a falling (O) column?
  • List<PointAndFigureBox> Boxes – a list of PointAndFigureBox objects that represent the boxes in the column. The PointAndFigureBox class has the following properties:
  • double High – the high price of the box
  • double Low – the low price of the box
  • int Index – the index at which point the box was established in the source data
public PointAndFigureColumn ColumnAt(int idx)

Returns the PointAndFigureColumn at the specified index in the source data, or null if one was not found.

public List<PointAndFigureEvent> Events

Returns a list of PointAndFigureEvent objects that represent the reversals that occurred in the Point & Figure chart. The PointAndFigureEvent class has the following properties:

  • int Index – the index of the reversal in the source data
  • bool IsUpsideReversal – is it an upside reversal?
  • bool IsDownsideReversal – is it a downside reversal?
public PointAndFigureEvent EventAt(int idx)

Returns the PointAndFigureEvent* at the specified index in the source data, or null if one was not found.

public TimeSeries RunningTotals

Returns a TimeSeries that contains the running total of rising X (positive values) boxes and falling O (negative values) boxes. This is the property used to populate the PFBoxCount indicator.

Renko Charts

Renko charts use bricks, or boxes, to display price movement. A new box is drawn whenever price moves more than a predetermined interval either up or down. This means that a single bar on a normal chart can result in many boxes being drawn on a Renko chart. For example, if the Renko box size is $1, and price moves $3 up in one trading day, 3 Renko boxes are drawn on the chart. You control the Renko box size in chart preferences. As you can see below, the Renko boxes can be based off closing price only, or off highs and lows.

Renko Charts

Renko Building Block and Indicator

The Renko Reversal building block condition resolves to true if there was a Renko reversal on the bar of data being processed. The RenkoBoxCount indicator displays the running total of Renko boxes, using positive values for up boxes and negative values for down boxes.

Renko .NET Class

Create an instance of the Renko .NET class to work with Renko charting methods in your C# coded models. The Renko class uses the following constructor format:

public Renko(BarHistory bh, SourceData source, double boxSize)

SourceData = CloseOnly or HighsAndLows

Once you create the Renko instance, you can access its properties, described below.

public List<RenkoEvent> Events

Returns a list of RenkoEvent object instances that represent the turning points in the Renko chart. The RenkoEvent class has the following properties:

  • int Index – the index of where the reversal occurred in the source data
  • bool IsUpsideReversal – is it an upside reversal?
  • bool IsDownsideReversal – is it a downside reversal?
public RenkoEvent EventAt(int idx)

Returns the RenkoEvent that occurred at the specified bar, or null if no event occurred on that bar.

public TimeSeries Boxes

Returns a TimeSeries that contains the number of Renko boxes for each bar of data on the chart. The value for a particular bar may be zero if no Renko boxes were drawn for that bar, or a positive value if up boxes were drawn, or a negative value if down boxes were drawn.

public TimeSeries RunningTotals

Returns a TimeSeries that contains the running total of Renko boxes as of each bar of data on the chart. If the current state of the Renko chart is up, then the value will be positive, and if it is down the value will be negative. This property is used to populate the RenkoBoxCount indicator.