Table of Contents

Class Indicator

Namespace
ATAS.Indicators
Assembly
ATAS.Indicators.dll

Base class for custom indicators.

[DataContract]
public abstract class Indicator : ExtendedIndicator, INotifyPanelPropertyChanged, IPropertiesEditorOwner, IMarketTimeProvider
Inheritance
object
Indicator
Implements
Derived
Inherited Members
Extension Methods

Constructors

Indicator(DataSeriesType)

Initializes the indicator with a price series of the chart as the default source.

protected Indicator(DataSeriesType seriesType)

Parameters

seriesType DataSeriesType

The price series to take as the default source (Open, High, Low, Close, ...).

Indicator(bool)

Initializes the indicator.

protected Indicator(bool useCandles = false)

Parameters

useCandles bool

true to take the candles of the chart as the default source; false to take the Close price series.

Properties

CalculationTimeFrame

The timeframe the indicator calculates on (PLAT-4527). Default is Chart - the chart's own series. Any other value makes the platform compute the indicator on that timeframe's series and project the values onto the chart bars: every chart bar shows the value of the higher-timeframe candle it belongs to, so the bars of the forming candle update live until it closes. Only shown in settings when SupportsCalculationTimeFrame is set and MTF data is available; ignored otherwise.

Added in ATAS 8.0.15.

[DataMember]
[Display(ResourceType = typeof(Strings), Name = "TimeFrame", GroupName = "Calculation", Description = "CalculationTimeFrameDescription", Order = 15)]
public CandleSeriesTimeFrame CalculationTimeFrame { get; set; }

Property Value

CandleSeriesTimeFrame

CalculationTimeFrameSmoothing

When CalculationTimeFrame is not the chart's, draws the projected values as a continuous line: the value changes gradually across the chart bars of one higher-timeframe candle and reaches the candle's value on its last bar. Off (the default) repeats the candle's value on every bar it covers - steps.

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

[DataMember]
[Display(ResourceType = typeof(Strings), Name = "CalculationTimeFrameSmoothing", GroupName = "Calculation", Description = "CalculationTimeFrameSmoothingDescription", Order = 16)]
public bool CalculationTimeFrameSmoothing { get; set; }

Property Value

bool

CandlesDataProvider

Gets the candle series provider for other timeframes and instruments (see ICandlesDataProvider). Null when the host does not supply candle series.

Added in ATAS 8.0.15.

[Browsable(false)]
[IgnoreDataMember]
protected ICandlesDataProvider? CandlesDataProvider { get; }

Property Value

ICandlesDataProvider

Category

Gets the category of the indicator from its System.ComponentModel.CategoryAttribute, or null when the class has none.

[Browsable(false)]
[IgnoreDataMember]
public string? Category { get; }

Property Value

string

ChartArea

Gets the rectangle representing the chart area on the screen.

protected Rectangle ChartArea { get; }

Property Value

Rectangle

ChartInfo

Gets the chart information associated with the data provider.

[Browsable(false)]
[IgnoreDataMember]
public IChart? ChartInfo { get; }

Property Value

IChart

ChartType

Chart type

[Browsable(false)]
[IgnoreDataMember]
[Obsolete("Use ChartInfo.ChartType instead.")]
public string? ChartType { get; }

Property Value

string

CumulativeDomAsks

Gets the total volume of the asks in the market depth; use MarketDepthInfo instead.

[Obsolete("Use MarketDepthInfo.CumulativeDomAsks instead.")]
protected decimal CumulativeDomAsks { get; }

Property Value

decimal

CumulativeDomBids

Gets the total volume of the bids in the market depth; use MarketDepthInfo instead.

[Obsolete("Use MarketDepthInfo.CumulativeDomBids instead.")]
protected decimal CumulativeDomBids { get; }

Property Value

decimal

DataPath

Path to the working program folder

[Browsable(false)]
[IgnoreDataMember]
[Obsolete("Direct access to the platform data path is deprecated. Use IIndicatorStorage instead.")]
public string DataPath { get; }

Property Value

string

FirstVisibleBarNumber

Gets the bar number of the first visible bar on the chart.

protected int FirstVisibleBarNumber { get; }

Property Value

int

IgnoreHistoryScale

Gets or sets a value indicating whether the autoscale of the price panel takes only the last bar of the indicator into account instead of every visible bar. For an indicator drawn on the price panel with its scale used.

Added in ATAS 8.0.15.

[Browsable(false)]
[IgnoreDataMember]
public bool IgnoreHistoryScale { get; set; }

Property Value

bool

Instrument

Instrument name

[Browsable(false)]
[IgnoreDataMember]
[Obsolete("Use InstrumentInfo.Instrument instead.")]
public string? Instrument { get; }

Property Value

string

InstrumentInfo

Gets the instrument information associated with the data provider.

[Browsable(false)]
[IgnoreDataMember]
protected IInstrumentInfo? InstrumentInfo { get; }

Property Value

IInstrumentInfo

InstrumentMarketDataProvider

Gets the live market-data provider for other instruments (see IInstrumentMarketDataProvider). Null when the host does not supply it.

Added in ATAS 8.0.15.

[Browsable(false)]
[IgnoreDataMember]
protected IInstrumentMarketDataProvider? InstrumentMarketDataProvider { get; }

Property Value

IInstrumentMarketDataProvider

LastVisibleBarNumber

Gets the bar number of the last visible bar on the chart.

protected int LastVisibleBarNumber { get; }

Property Value

int

MarketDepthInfo

Gets the market depth information provider associated with the data provider.

[Browsable(false)]
[IgnoreDataMember]
protected IMarketDepthInfoProvider? MarketDepthInfo { get; }

Property Value

IMarketDepthInfoProvider

MouseLocationInfo

Gets the information about the mouse location on the chart.

protected IMouseLocationInfo MouseLocationInfo { get; }

Property Value

IMouseLocationInfo

OptionsDataProvider

Gets the options data provider for the chart's security (see IOptionsDataProvider). Null when the host does not supply options data.

Added in ATAS 8.0.15.

[Browsable(false)]
[IgnoreDataMember]
protected IOptionsDataProvider? OptionsDataProvider { get; }

Property Value

IOptionsDataProvider

PlatformSettings

Gets the platform settings associated with the data provider.

[Browsable(false)]
[IgnoreDataMember]
public IPlatformSettings? PlatformSettings { get; }

Property Value

IPlatformSettings

StringFormat

Price format

[Obsolete("Use ChartInfo.StringFormat instead.")]
protected string StringFormat { get; }

Property Value

string

TickSize

TickSize

[Obsolete("Use InstrumentInfo.TickSize instead.")]
protected decimal TickSize { get; }

Property Value

decimal

TimeFrame

Timeframe.

[Browsable(false)]
[IgnoreDataMember]
[Obsolete("Use ChartInfo.TimeFrame instead.")]
public string? TimeFrame { get; }

Property Value

string

TradingManager

Gets the trading manager associated with the data provider.

[Browsable(false)]
[IgnoreDataMember]
protected ITradingManager? TradingManager { get; }

Property Value

ITradingManager

TradingStatisticsProvider

Gets the trading statistics provider associated with the data provider.

[Browsable(false)]
[IgnoreDataMember]
public ITradingStatisticsProvider? TradingStatisticsProvider { get; }

Property Value

ITradingStatisticsProvider

ValueAreaPercent

Gets the value area percentage of the platform settings; use PlatformSettings instead.

[Browsable(false)]
[IgnoreDataMember]
[Obsolete("Use PlatformSettings.ValueAreaPercent instead.")]
public int ValueAreaPercent { get; }

Property Value

int

VisibleBarsCount

Gets the number of visible bars on the chart.

protected int VisibleBarsCount { get; }

Property Value

int

Methods

AddText(string, string, bool, int, decimal, Color, Color, Color, float, TextAlign, bool)

Adds a drawing text element to the chart at the specified position.

protected DrawingText AddText(string tag, string text, bool isAbovePrice, int bar, decimal price, Color textColor, Color outlineColor, Color fillColor, float fontSize, DrawingText.TextAlign align, bool autoSize = false)

Parameters

tag string

The tag associated with the text element.

text string

The text content of the element.

isAbovePrice bool

Specifies whether the text should be placed above the price.

bar int

The bar number where the text will be placed.

price decimal

The price at which the text will be placed.

textColor Color

The color of the text.

outlineColor Color

The color of the outline of the text.

fillColor Color

The fill color of the text.

fontSize float

The font size of the text.

align DrawingText.TextAlign

The alignment of the text.

autoSize bool

Specifies whether the text size should be automatically adjusted.

Returns

DrawingText

The newly added DrawingText element.

AddText(string, string, bool, int, decimal, Color, Color, float, TextAlign, bool)

Adds a drawing text element to the chart at the specified position.

protected DrawingText AddText(string tag, string text, bool isAbovePrice, int bar, decimal price, Color textColor, Color fillColor, float fontSize, DrawingText.TextAlign align, bool autoSize = false)

Parameters

tag string

The tag associated with the text element.

text string

The text content of the element.

isAbovePrice bool

Specifies whether the text should be placed above the price.

bar int

The bar number where the text will be placed.

price decimal

The price at which the text will be placed.

textColor Color

The color of the text.

fillColor Color

The fill color of the text.

fontSize float

The font size of the text.

align DrawingText.TextAlign

The alignment of the text.

autoSize bool

Specifies whether the text size should be automatically adjusted.

Returns

DrawingText

The newly added DrawingText element.

AddText(string, string, bool, int, int, int, int, Color, Color, Color, float, TextAlign, bool)

Adds a text label at a price given in ticks; use the overload that takes the price itself.

[Obsolete]
protected DrawingText AddText(string tag, string text, bool isAbovePrice, int bar, int price, int yOffset, int xOffset, Color textcolor, Color outlinecolor, Color fillcolor, float fontSize, DrawingText.TextAlign align, bool autoSize = false)

Parameters

tag string

The unique identifier of the label.

text string

The text.

isAbovePrice bool

Whether the label is drawn above the price.

bar int

The bar index.

price int

The price in ticks (multiplied by the tick size of the instrument).

yOffset int

The vertical offset in pixels.

xOffset int

The horizontal offset in pixels.

textcolor Color

The color of the text.

outlinecolor Color

The color of the outline.

fillcolor Color

The fill color.

fontSize float

The font size.

align DrawingText.TextAlign

The alignment of the text.

autoSize bool

Whether the size of the label follows the text.

Returns

DrawingText

The added label.

DoActionInGuiThread(Action)

Executes the specified action on the GUI thread.

protected void DoActionInGuiThread(Action action)

Parameters

action Action

The action to execute on the GUI thread.

GetMarketDepthSnapshot()

Gets the current levels of the market depth; use MarketDepthInfo instead.

[Obsolete("Use MarketDepthInfo.GetMarketDepthSnapshot() instead.")]
protected IEnumerable<MarketDataArg> GetMarketDepthSnapshot()

Returns

IEnumerable<MarketDataArg>

The levels, or an empty sequence when the market depth is not available.

IsNewMonth(int)

Function returns new month flag.

protected bool IsNewMonth(int bar)

Parameters

bar int

Bar number

Returns

bool

IsNewSession(int)

Function returns new session flag.

protected bool IsNewSession(int bar)

Parameters

bar int

Bar number

Returns

bool

IsNewWeek(int)

Function returns new week flag.

protected bool IsNewWeek(int bar)

Parameters

bar int

Bar number

Returns

bool

OnApplyDefaultColors()

Invoked to apply default colors to the drawing elements.

protected override void OnApplyDefaultColors()

Remarks

This method can be overridden in derived classes to customize or set default color values for the drawing elements. When this method is called, it is an opportunity for the derived class to apply its own default color scheme to the drawing elements used in the specific implementation.

OnDataProviderChanged(IIndicatorDataProvider?, IIndicatorDataProvider?)

Added in ATAS 8.0.15.

protected override void OnDataProviderChanged(IIndicatorDataProvider? oldDataProvider, IIndicatorDataProvider? newDataProvider)

Parameters

oldDataProvider IIndicatorDataProvider

The old IIndicatorDataProvider value.

newDataProvider IIndicatorDataProvider

The new IIndicatorDataProvider value.

OnSupportsCalculationTimeFrameChanged()

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

protected override void OnSupportsCalculationTimeFrameChanged()

OnValuationChanged()

Called when an exchange rate, the money display currency or the instrument model changed (Changed of Valuation). Indicators that show volumes in money recalculate or redraw them here. May be called on any thread.

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

protected virtual void OnValuationChanged()

RefreshData()

Refreshes the data of the indicator. Override this method to update the indicator's data when necessary.

public virtual void RefreshData()