NinjaScript > Language Reference > Data >

AddPointAndFigure()

Print this Topic Previous pageReturn to chapter overviewNext page

Definition

Similar to the Add() method for adding Bars objects to an indicator or strategy, this method adds a Point-and-Figure Bars object for multi-series NinjaScript. When running NinjaScript, you will be able to choose the primary instrument and bar interval to run on. This primary Bars object will carry a BarsInProgress index of 0. In a multi-time frame and multi-instrument NinjaScript, supplementary Bars objects are added via this method in the Initialize() method and given an incremented BarsInProgress index value. See additional information on running multi-bars scripts.

 

Syntax

AddPointAndFigure(string instrumentName, PeriodType basePeriodType, int basePeriodTypeValue, int boxSize, int reversal, PointAndFigurePriceType pointAndFigurePriceType, MarketDataType marketDataType)

 

NOTE: You can optionally add the exchange name as a suffix to the symbol name. This is only advised if the instrument has multiple possible exchanges that it can trade on and it is configured within the Instrument Manager. For example: AddPointAndFigure("MSFT Arca", PeriodType.Minute, 1, 2, 3, PointAndFigurePriceType.Close, MarketDataType.Last).

 

 

Parameters

instrumentName

An instrument name such as "MSFT"

basePeriodType

The underlying period type of the Point-and-Figure such as:
PeriodType.Day
PeriodType.Minute

PeriodType.Second
PeriodType.Tick
PeriodType.Volume

basePeriodTypeValue

The underlying period interval such as "3" for 3 minute bars

boxSize

Price movement signified by the X's and O's of a Point-and-Figure chart

reversal

Number of boxes the price needs to move in the reversal direction before a new column will be built

pointAndFigurePriceType

Determines where to base reversal calculations off of.

 

Possible values are:
PointAndFigurePriceType.Close

PointAndFigurePriceType.HighsAndLows

marketDataType

Possible values are:

MarketDataType.Ask

MarketDataType.Bid

MarketDataType.Last

 

* Please see the article here on using Bid/Ask series.

 

 

Examples

protected override void Initialize()
{

    // Add a 1 minute Point-and-Figure Bars object for the ES 06-10 contract - BarsInProgress index = 1
    AddPointAndFigure("ES 06-10", PeriodType.Minute, 1, 2, 3, PointAndFigurePriceType.Close, MarketDataType.Last);
}
 
protected override void OnBarUpdate()
{
    // Ignore the primary Bars object and only process the Point-and-Figure Bars object
    if (BarsInProgress == 1)
    {

         // Do something;
    }
}