AddColumn
- add numeric exploration column

Exploration / Indicators
(AmiBroker 3.80)


SYNTAX AddColumn( array, name, format = 1.2, textColor = colorDefault, bkgndColor = colorDefault, width = -1, barchart = Null )
RETURNS NOTHING
FUNCTION Adds a new column to the exploration result list. The column shows array values and has a caption of name. The values are formatted using format specification.
By default all variables are displayed with 2 decimal digits, but you can change this by assigning a different value to this variable: 1.5 gives 5 decimal digits, 1.0 gives no decimal digits. (Note for advanced users: the integer part of this number can be used to pad formatted number with spaces - 6.0 will give no decimal digits but a number space-padded upto 6 characters.)
Next two parameters allow to modify text and background color.

special format constants:

  • formatDateTime - produces date time formated according to your system settings
    AddColumn( DateTime(), "Date / Time", formatDateTime );

  • formatDateTimeISO - produces date time formated using ISO standard, i.e. YYYY-MM-DD HH:MM:SS
    AddColumn( DateTime(), "Date / Time", formatDateTimeISO );

  • formatChar - allows outputting single ASCII character codes:
    Example (produces signal file accepted by various other programs):
    Buy=Cross(MACD(),Signal());
    Sell=Cross(Signal(), MACD());
    Filter=Buy OR Sell;
    SetOption("NoDefaultColumns", True );
    AddColumn( DateTime(), "Date", formatDateTime );
    AddColumn( IIf( Buy, 66, 83 ), "Signal", formatChar );
  • width parameter allows to control pixel width of the column
  • 'barchart' parameter accepts values from 0...100 represening percentage width of bar chart displayed in a cell the in-cell bar chart is drawn with bkcolor (background color).
EXAMPLE 1. Simple column showing close price

addcolumn( Close, "Close price", 1.4 );

2. Colorful output

Filter =1;

AddColumn( Close, "Close", 1.2 );
AddColumn( MACD(), "MACD", 1.4 , IIf( MACD() > 0, colorGreen, colorRed ) );
AddTextColumn( FullName(), "Full name", 77 , colorDefault, IIf( Close < 10, colorLightBlue, colorDefault ) );

3. Barchart example Filter=1;
AddColumn( Close, "Close" );
rank =
PercentRank( Close, 100 );
Color =
ColorHSB( rank * 64/100, 255, 255 );
AddColumn( rank, "100-day percent rank", 1.2, colorDefault, Color, -1, rank );

SEE ALSO ADDTEXTCOLUMN() function

References:

The AddColumn function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.