Table of Contents

Class WatchlistColumn

Namespace
ATAS.Indicators.Watchlist
Assembly
ATAS.Indicators.dll

Base class of a Watchlist column written in a custom assembly. Derive from it, mark the class with WatchlistColumnAttribute and give it a public parameterless constructor. The column computes the cell of one instrument: the platform creates one instance per Watchlist row, attaches it to the row's instrument, feeds it the instrument data and shows what the column publishes in Value.

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

[Obfuscation(Feature = "renaming", ApplyToMembers = true, Exclude = true)]
public abstract class WatchlistColumn
Inheritance
object
WatchlistColumn
Extension Methods

Remarks

The platform never calls one instance concurrently: the data callbacks and the timer are serialized (all rows of a column share one lock), so the column needs no locks for its own fields. They are delivered on a platform thread shortly after the data arrives, never on the thread of the data feed, and never while the Watchlist is drawn.

The column does not draw: it publishes a WatchlistCellValue (text, optional sort number and colors) and the platform draws, sorts and selects the cells like the built-in ones, identically in %ATAS and %ATAS X.

Public read/write properties are the column settings: they are saved with the workspace and the Watchlist lists and restored into every row instance before OnInitialize().

If an override throws, the platform logs the exception, releases every instance of the column (OnDispose()) and shows the error in the column header; hiding and showing the column, or loading the layout again, starts new instances with the saved settings.

Constructors

WatchlistColumn()

Initializes the column. The platform creates it with its parameterless constructor; the column is attached to its row afterwards, so do not use the platform services here.

protected WatchlistColumn()

Properties

Instrument

The instrument of the row. Available from OnInitialize() on. TimeZone / TimeZoneOffset are the time zone set for the instrument in the platform, as chart indicators of the instrument get them (read when the instance is attached to the row).

protected IInstrumentInfo Instrument { get; }

Property Value

IInstrumentInfo

Exceptions

InvalidOperationException

The column is not attached to a row yet.

IsAttached

True once the column is attached to a row (Instrument is available).

protected bool IsAttached { get; }

Property Value

bool

Value

The cell the Watchlist shows for the row; null (the default) shows an empty cell. Assign a new value whenever the content changes: the platform redraws the Watchlist on its next update.

protected WatchlistCellValue? Value { get; set; }

Property Value

WatchlistCellValue

Methods

OnBestBidAskChanged(MarketDataArg)

The best bid or the best ask changed (DataType tells which). The latest value is delivered: changes that happen faster than the platform delivers them are merged.

protected virtual void OnBestBidAskChanged(MarketDataArg bestPrice)

Parameters

bestPrice MarketDataArg

OnDispose()

The platform stops using this instance: the column was hidden, its row or the column was removed, the Watchlist was closed (also when the workspace is switched or the platform exits), the column was stopped by an error, the tariff no longer allows custom columns, its settings were replaced as a whole, or the assembly was reloaded. Called exactly once for every instance whose constructor completed, even if OnInitialize() was not reached or threw. Release what the instance created (timers, files, subscriptions to your own services, native resources) here; no other method is called afterwards. An exception thrown here is logged and ignored.

protected virtual void OnDispose()

OnInitialize()

Called once per instance when it is attached to its row, after the saved settings were restored. Instrument is available from here on. The current statistics of the instrument follow in OnSummaryChanged(InstrumentDailySummary) right after OnSettingsChanged(), when the feed has reported them.

protected virtual void OnInitialize()

OnNewTrades(IReadOnlyList<MarketDataArg>)

New trades of the instrument, oldest first. Do not keep the list: it belongs to this call.

protected virtual void OnNewTrades(IReadOnlyList<MarketDataArg> trades)

Parameters

trades IReadOnlyList<MarketDataArg>

OnSettingsChanged()

Called after OnInitialize(); reserved for setting changes made by the user.

protected virtual void OnSettingsChanged()

OnSummaryChanged(InstrumentDailySummary)

The exchange statistics of the instrument (day open/high/low, volume, previous close, …) changed. The latest value is delivered: changes that happen faster than the platform delivers them are merged.

protected virtual void OnSummaryChanged(InstrumentDailySummary summary)

Parameters

summary InstrumentDailySummary

OnTimer()

Called about once per second for every row while the column is shown.

protected virtual void OnTimer()