Collections

ChartDrawings

Description

ChartDrawings is a collection containing all drawing objects within the chart. The property hold all drawings which were generated by the script. The index for ChartDrawings is the explicit name for the drawing object (string tag).

Usage

ChartDrawings [string tag]

Example

Note: To be able to use the interface definitions you must use the using method.

using AgenaTrader.Plugins;
// Output number of drawing objects within the chart and their tags
Print("The chart contains " + ChartDrawings.Count + " drawing objects.");
foreach (IDrawObject draw in ChartDrawings) Print(draw.Tag);
//Draw a black trend line...
AddChartLine("MyLine", true, 10, Close[10], 0, Close[0], Color.Black, DashStyle.Solid, 3);
// ... and change the color to red
ITrendLine line = (ITrendLine) ChartDrawings["MyLine"];
if (line != null) line.Pen.Color = Color.Red;
// Set all lines within the chart to a line strength of 3,
// and lock it so that it cannot be edited or moved
foreach (IDrawObject draw in ChartDrawings)
if (draw is IVerticalLine)
{
    IVerticalLine vline = (IVerticalLine) draw;
    vline.IsLocked = true;
    vline.Editable = false;
    vline.Pen.Width = 3;
}

InSeries

Description

InSeries is a DataSeries object in which the input data for an indicator or strategy is stored.

If the indicator is used without any explicit instructions for the input data, then the closing price for the current market prices will be used.

When calling up the SMA(20) the smoothing average is calculated on the basis of the closing prices for the current chart price data (this is equivalent to SMA(close,20).

InSeries[0] = Close[0].

When calling up the SMA(high, 20) the high price values are loaded and used for the calculation of the smoothing average.

InSeries[0] = High[0].

This way you can select which data series should be used for the calculation of the indicator.

double d = RSI(SMA(20), 14, 3)[0]; calculates the 14 period RSI using the SMA(20) as the input data series. InSeries[0] = SMA(20)[0].

Usage

Example

Lines

Description

Lines is a collection that contains all LevelLine objects of an indicator.

When a line object is added to the indicator using the Add() method, this line is automatically added to the "lines" collection.

The order of the add commands determines how these lines are sorted. The first information request of Add() will create Lines[0], the next information request will be Lines[1] etc.

See OutputDescriptor.

Usage

Example

PlotColors

Description

PlotColors is a collection that contains all color series of all plot objects.

When a plot is added using the Add() method it automatically creates a color series object and is added to the PlotColors collection.

The order of the add commands determines how the plot colors are sorted. The first information request of Add() will create PlotColors[0], the following information request will create PlotColors[1] etc.

Usage

More Information

More information regarding the collection class: http://msdn.microsoft.com/en-us/library/ybcx56wz%28v=vs.80%29.aspx

Example

OutputDescriptor

Description

OutputDescriptor is a collection that contains the plot objects of an indicator.

When a plot object is added to an indicator using the Add() method, it is also automatically added to the "plots" collection.

The order of the add commands determines how the plots are sorted. The first Add() information request will create Plots[0], the following information request will create OutputDescriptor[1] etc.

See Lines.

Usage

Example

Values

Description

Values are a collection that contains the data series objects of an indicator.

When a plot is added to an indicator using the Add() method, a value object is automatically created and added to the "values" collection.

The order of the add commands determines how the values are sorted. The first information request will create Values[0], the next information request will create Values[1], etc.

Value is always identical to Values[0].

Usage

More Information

The methods known for a collection, Set() Reset() and Count(), are applicable for values.

Information on the class collection: http://msdn.microsoft.com/en-us/library/ybcx56wz%28v=vs.80%29.aspx

Example

Last updated