Table of Contents

Class Extensions

Namespace
ATAS.Indicators
Assembly
ATAS.Indicators.dll

Contains extension methods for various types.

public static class Extensions
Inheritance
object
Extensions

Fields

AxisTextFormat

The format used for axis text.

public static readonly RenderStringFormat AxisTextFormat

Field Value

RenderStringFormat

Methods

CalcAverage(IDataSeries, int, int)

Calculates the average value of a data series within a specified period.

public static decimal CalcAverage(this IDataSeries series, int period, int bar)

Parameters

series IDataSeries

The data series.

period int

The period for the calculation.

bar int

The current bar number.

Returns

decimal

The calculated average value.

CalcAverage(IDataSeries<decimal>, int, int)

Calculates the average value of a data series within a specified period.

public static decimal CalcAverage(this IDataSeries<decimal> series, int period, int bar)

Parameters

series IDataSeries<decimal>

The data series.

period int

The period for the calculation.

bar int

The current bar number.

Returns

decimal

The calculated average value.

CalcSum(IDataSeries, int, int)

Calculates the sum of a data series within a specified period.

public static decimal CalcSum(this IDataSeries series, int period, int bar)

Parameters

series IDataSeries

The data series.

period int

The period for the calculation.

bar int

The current bar number.

Returns

decimal

The calculated sum.

CalcSum(IDataSeries<decimal>, int, int)

Calculates the sum of a data series within a specified period.

public static decimal CalcSum(this IDataSeries<decimal> series, int period, int bar)

Parameters

series IDataSeries<decimal>

The data series.

period int

The period for the calculation.

bar int

The current bar number.

Returns

decimal

The calculated sum.

Calculate(Indicator, int, decimal)

Calculates the value of an indicator for a specific bar and stores it in the source data series.

public static decimal Calculate(this Indicator indicator, int bar, decimal value)

Parameters

indicator Indicator

The indicator.

bar int

The current bar number.

value decimal

The value to store in the source data series.

Returns

decimal

The calculated indicator value.

Convert(Color)

Converts a System.Drawing.Color to a System.Windows.Media.Color.

public static Color Convert(this Color color)

Parameters

color Color

The System.Drawing.Color to convert.

Returns

Color

The equivalent System.Windows.Media.Color.

Convert(Color)

Converts a System.Windows.Media.Color to a System.Drawing.Color.

public static Color Convert(this Color color)

Parameters

color Color

The System.Windows.Media.Color to convert.

Returns

Color

The equivalent System.Drawing.Color.

DrawLabelOnPriceAxis(Indicator, RenderContext, string, int, RenderFont, Color, Color)

Draws a label on the price axis of the chart's render context.

public static void DrawLabelOnPriceAxis(this Indicator indicator, RenderContext context, string text, int y, RenderFont font, Color fillColor, Color textColor)

Parameters

indicator Indicator

The Indicator instance.

context RenderContext

The RenderContext instance.

text string

The text of the label.

y int

The Y-coordinate of the label.

font RenderFont

The font of the label.

fillColor Color

The background color of the label.

textColor Color

The text color of the label.

GetDescription(BaseIndicator, bool, bool, bool, bool)

Gets the description of the BaseIndicator.

public static string GetDescription(this BaseIndicator indicator, bool showSeries = true, bool showParameters = true, bool showInstrument = false, bool showTimeFrame = false)

Parameters

indicator BaseIndicator

The BaseIndicator instance.

showSeries bool

true to show the series information in the description, otherwise false.

showParameters bool

true to show the parameter information in the description, otherwise false.

showInstrument bool

true to show the instrument information in the description, otherwise false.

showTimeFrame bool

true to show the time frame information in the description, otherwise false.

Returns

string

The description of the BaseIndicator.

GetDescription(BaseIndicator, string, bool, bool, bool, bool)

Gets the description of the BaseIndicator built on top of an explicit display name instead of the current Name. Use it when the indicator derives its Name from the description itself, otherwise every rebuild would append the parameters to the previous description (PLAT-5163).

Not in ATAS 8.0.15 yet: available from the next version.

public static string GetDescription(this BaseIndicator indicator, string displayName, bool showSeries = true, bool showParameters = true, bool showInstrument = false, bool showTimeFrame = false)

Parameters

indicator BaseIndicator

The BaseIndicator instance.

displayName string

The name the description starts with.

showSeries bool

true to show the series information in the description, otherwise false.

showParameters bool

true to show the parameter information in the description, otherwise false.

showInstrument bool

true to show the instrument information in the description, otherwise false.

showTimeFrame bool

true to show the time frame information in the description, otherwise false.

Returns

string

The description of the BaseIndicator.

GetIndicatorCandle(ExtendedIndicator, int)

Gets the IndicatorCandle at a specified bar for the given ExtendedIndicator.

public static IndicatorCandle GetIndicatorCandle(this ExtendedIndicator indicator, int bar)

Parameters

indicator ExtendedIndicator

The ExtendedIndicator instance.

bar int

The bar number.

Returns

IndicatorCandle

The IndicatorCandle at the specified bar.

GetTimeFrameTypeChartPeriod(IChart)

Returns the chart period as a System.TimeSpan based on the TimeFrame value. Supports minute (M), hour (H), daily, and weekly formats.

Added in ATAS 8.0.15.

public static TimeSpan GetTimeFrameTypeChartPeriod(this IChart chartInfo)

Parameters

chartInfo IChart

The IChart instance.

Returns

TimeSpan

A System.TimeSpan representing the specified period.

Exceptions

ArgumentNullException

Thrown when chartInfo is null.

ArgumentException

Thrown when chartInfo.ChartType.ChartType is not TimeFrame or when the provided time frame format is invalid or unsupported.

GetWithTransparency(Color, int)

Gets a System.Drawing.Color equal to the given one with added transparency.

public static Color GetWithTransparency(this Color color, int transparency)

Parameters

color Color
transparency int

The transparency range is from 0 to 100.

Returns

Color

System.Drawing.Color with a given transparency.

GetWithTransparency(Color, int)

Gets a System.Windows.Media.Color equal to the given one with added transparency.

public static Color GetWithTransparency(this Color color, int transparency)

Parameters

color Color
transparency int

The transparency range is from 0 to 100.

Returns

Color

System.Windows.Media.Color with a given transparency.

GetXByBar(IChart, int, bool)

Gets the X-coordinate of a bar on the chart.

public static int GetXByBar(this IChart chart, int bar, bool isStartOfBar = true)

Parameters

chart IChart

The IChart instance.

bar int

The bar number.

isStartOfBar bool

true to get the X-coordinate of the start of the bar, false to get the X-coordinate of the middle of the bar.

Returns

int

The X-coordinate of the bar on the chart.

GetYByPrice(IChart, decimal, bool)

Gets the Y-coordinate of a price on the chart.

public static int GetYByPrice(this IChart chart, decimal price, bool isStartOfPriceLevel = true)

Parameters

chart IChart

The IChart instance.

price decimal

The price value.

isStartOfPriceLevel bool

true to get the Y-coordinate of the start of the price level, false to get the Y-coordinate of the middle of the price level.

Returns

int

The Y-coordinate of the price on the chart.

IsEqual(CumulativeTrade, CumulativeTrade)

Checks if two CumulativeTrade objects are equal.

public static bool IsEqual(this CumulativeTrade trade1, CumulativeTrade trade2)

Parameters

trade1 CumulativeTrade

The first CumulativeTrade object.

trade2 CumulativeTrade

The second CumulativeTrade object.

Returns

bool

true if the CumulativeTrade objects are equal, otherwise false.

IsKeyPressed(IChart, Key)

Checks if a specific key is currently pressed on the chart's keyboard.

public static bool IsKeyPressed(this IChart chart, Key key)

Parameters

chart IChart

The IChart instance.

key Key

The key to check.

Returns

bool

true if the key is pressed, otherwise false.

IsNewIndicatorMonth(Indicator, int)

Checks if a new month has started for the indicator at a specified bar.

public static bool IsNewIndicatorMonth(this Indicator indicator, int bar)

Parameters

indicator Indicator

The Indicator instance.

bar int

The bar number.

Returns

bool

true if a new month has started, otherwise false.

IsNewIndicatorSession(Indicator, int)

Checks if a new session has started for the indicator at a specified bar.

public static bool IsNewIndicatorSession(this Indicator indicator, int bar)

Parameters

indicator Indicator

The Indicator instance.

bar int

The bar number.

Returns

bool

true if a new session has started, otherwise false.

IsNewIndicatorWeek(Indicator, int)

Checks if a new week has started for the indicator at a specified bar.

public static bool IsNewIndicatorWeek(this Indicator indicator, int bar)

Parameters

indicator Indicator

The Indicator instance.

bar int

The bar number.

Returns

bool

true if a new week has started, otherwise false.

MAX(IDataSeries, int, int)

Finds the maximum value of a data series within a specified period.

public static decimal MAX(this IDataSeries series, int period, int bar)

Parameters

series IDataSeries

The data series.

period int

The period for the calculation.

bar int

The current bar number.

Returns

decimal

The maximum value.

MAX(IDataSeries<decimal>, int, int)

Finds the maximum value of a data series within a specified period.

public static decimal MAX(this IDataSeries<decimal> series, int period, int bar)

Parameters

series IDataSeries<decimal>

The data series.

period int

The period for the calculation.

bar int

The current bar number.

Returns

decimal

The maximum value.

MIN(IDataSeries, int, int)

Finds the minimum value of a data series within a specified period.

public static decimal MIN(this IDataSeries series, int period, int bar)

Parameters

series IDataSeries

The data series.

period int

The period for the calculation.

bar int

The current bar number.

Returns

decimal

The minimum value.

MIN(IDataSeries<decimal>, int, int)

Finds the minimum value of a data series within a specified period.

public static decimal MIN(this IDataSeries<decimal> series, int period, int bar)

Parameters

series IDataSeries<decimal>

The data series.

period int

The period for the calculation.

bar int

The current bar number.

Returns

decimal

The minimum value.

RenderRightAxisLabel(RenderContext, int, int, string, Color, Color, RenderFont)

Renders a right axis label on the chart's render context.

public static void RenderRightAxisLabel(this RenderContext context, int x, int y, string text, Color background, Color textColor, RenderFont font)

Parameters

context RenderContext

The RenderContext instance.

x int

The X-coordinate of the label.

y int

The Y-coordinate of the label.

text string

The text of the label.

background Color

The background color of the label.

textColor Color

The text color of the label.

font RenderFont

The font of the label.

To(LineDashStyle)

Converts a LineDashStyle to a System.Drawing.Drawing2D.DashStyle.

public static DashStyle To(this LineDashStyle style)

Parameters

style LineDashStyle

The LineDashStyle to convert.

Returns

DashStyle

The equivalent System.Drawing.Drawing2D.DashStyle.

To(DashStyle)

Converts a System.Drawing.Drawing2D.DashStyle to a LineDashStyle.

public static LineDashStyle To(this DashStyle style)

Parameters

style DashStyle

The System.Drawing.Drawing2D.DashStyle to convert.

Returns

LineDashStyle

The equivalent LineDashStyle.