Loading...
Searching...
No Matches
ATAS.Indicators.Modules.PlatformModule Class Referenceabstract

Base class of a custom module written in a custom assembly: a panel of the classic ATAS and a widget of ATAS X whose whole client area the module draws through RenderContext — one code base for both platforms. Derive from it, mark the class with PlatformModuleAttribute, give it a public parameterless constructor and override OnRender; the other hooks are optional. More...

Protected Member Functions

void Redraw ()
 Asks the platform to draw a new frame; calls are merged. Does nothing before OnInitialize.
 
virtual void OnInitialize ()
 Called when the module is attached to its panel (once per instance), after its saved settings were restored. Context is available from here on.
 
virtual void OnSettingsChanged ()
 Called after the module settings changed (and once after OnInitialize).
 
virtual void OnInstrumentChanged ()
 Called after the panel switched to another instrument (or lost it: IPlatformModuleContext.Instrument is then null), and once after OnSettingsChanged when an instrument is selected. Reset the accumulated data here; the data callbacks that follow belong to the new instrument.
 
virtual void OnNewTrades (IReadOnlyList< MarketDataArg > trades)
 New trades of the instrument, oldest first. Do not keep the list: it belongs to this call.
 
virtual void OnBestBidAskChanged (MarketDataArg bestPrice)
 The best bid or the best ask changed (MarketDataArg.DataType tells which). The latest value is delivered: changes that happen faster than the platform delivers them are merged.
 
virtual void OnMarketDepthChanged (IReadOnlyList< MarketDataArg > levels)
 Changed order book levels (MarketDataArg.DataType is MarketDataType.Bid or MarketDataType.Ask; a zero volume removes the level). The first call after OnInstrumentChanged carries the whole book of the new instrument. The book as of the delivered changes is available through IPlatformModuleContext.GetDepth. Do not keep the list: it belongs to this call.
 
virtual void OnSummaryChanged (InstrumentDailySummary summary)
 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.
 
virtual void OnInstrumentStateChanged (IPlatformModuleInstrument instrument)
 The state of an additional instrument (IPlatformModuleContext.AddInstrument) changed: the platform subscribed to its data, stopped delivering it, or delivers it again. When the instrument becomes PlatformModuleInstrumentState.Active, its statistics and — if asked for — its whole order book follow right after this call.
 
virtual void OnNewTrades (IPlatformModuleInstrument instrument, IReadOnlyList< MarketDataArg > trades)
 New trades of an additional instrument, oldest first. Do not keep the list: it belongs to this call.
 
virtual void OnBestBidAskChanged (IPlatformModuleInstrument instrument, MarketDataArg bestPrice)
 The best bid or the best ask of an additional instrument changed; the latest value is delivered.
 
virtual void OnMarketDepthChanged (IPlatformModuleInstrument instrument, IReadOnlyList< MarketDataArg > levels)
 Changed order book levels of an additional instrument added with the order book (a zero volume removes the level). The first call after the instrument became active carries its whole book. Do not keep the list.
 
virtual void OnSummaryChanged (IPlatformModuleInstrument instrument, InstrumentDailySummary summary)
 The exchange statistics of an additional instrument changed; the latest value is delivered.
 
virtual void OnButtonClick (PlatformModuleButton button)
 The user clicked a button of IPlatformModuleContext.Buttons. For a toggle (PlatformModuleButton.IsCheckable) the platform has already flipped PlatformModuleButton.IsChecked. The default implementation calls PlatformModuleButton.Click.
 
virtual void OnTimer ()
 Called about ten times per second while the panel is open (also while it is hidden behind another tab).
 
virtual void OnSizeChanged (Size size)
 The client area of the module changed its size (also called before the first OnRender).
 
abstract void OnRender (RenderContext context, Rectangle bounds)
 Draws the module. bounds is the whole client area; the platform has filled it with IPlatformModuleContext.BackgroundColor. Called for every frame — keep it cheap: compute in the data callbacks and the timer, draw here.
 
virtual void OnMouseMove (RenderControlMouseEventArgs e)
 The mouse moved over the module. Coordinates are relative to the client area.
 
virtual void OnMouseDown (RenderControlMouseEventArgs e)
 A mouse button was pressed over the module.
 
virtual void OnMouseUp (RenderControlMouseEventArgs e)
 A mouse button was released over the module.
 
virtual void OnMouseClick (RenderControlMouseEventArgs e)
 The user clicked the module. Set RenderControlMouseEventArgs.Handled to suppress the panel context menu of a right click.
 
virtual void OnMouseWheel (RenderControlMouseEventArgs e)
 The mouse wheel was turned over the module (RenderControlMouseEventArgs.Delta).
 
virtual void OnMouseLeave ()
 The mouse left the module.
 
virtual void OnKeyDown (PlatformModuleKeyEventArgs e)
 A key was pressed while the module has the keyboard focus (the user clicked it).
 
virtual void OnKeyUp (PlatformModuleKeyEventArgs e)
 A key was released while the module has the keyboard focus.
 
virtual void OnDispose ()
 The platform stops using this instance: the panel was closed (also when the workspace is switched or the platform exits), the module was stopped by an error, the tariff no longer allows custom modules, 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 module 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.
 

Properties

IPlatformModuleContext Context [get]
 The panel the module is shown in. Available from OnInitialize on.
 
bool IsAttached [get]
 True once the module is attached to a panel (Context is available).
 

Detailed Description

Base class of a custom module written in a custom assembly: a panel of the classic ATAS and a widget of ATAS X whose whole client area the module draws through RenderContext — one code base for both platforms. Derive from it, mark the class with PlatformModuleAttribute, give it a public parameterless constructor and override OnRender; the other hooks are optional.

The platform never calls one module instance concurrently: data callbacks, the timer, input and the drawing are serialized, so the module needs no locks for its own fields. Data callbacks are delivered on a platform thread shortly after the data arrives (in arrival order), never on the thread of the data feed. Drawing and input are called on the thread of the panel.

Public read/write properties are the module settings: they are shown in the settings window of the panel (use [Display] for names, groups and order, [Browsable(false)] to hide one) and saved with the workspace. OnSettingsChanged is called after the user changed them.

A module reads market data and draws; it has no access to orders, accounts or positions.

If an override throws, the platform logs the exception, releases the instance (OnDispose) and shows the error in the panel; clicking the panel, opening its settings or loading the workspace again starts a new instance with the saved settings.

Member Function Documentation

◆ OnBestBidAskChanged() [1/2]

virtual void ATAS.Indicators.Modules.PlatformModule.OnBestBidAskChanged ( IPlatformModuleInstrument  instrument,
MarketDataArg  bestPrice 
)
protectedvirtual

The best bid or the best ask of an additional instrument changed; the latest value is delivered.

◆ OnBestBidAskChanged() [2/2]

virtual void ATAS.Indicators.Modules.PlatformModule.OnBestBidAskChanged ( MarketDataArg  bestPrice)
protectedvirtual

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

◆ OnButtonClick()

virtual void ATAS.Indicators.Modules.PlatformModule.OnButtonClick ( PlatformModuleButton  button)
protectedvirtual

The user clicked a button of IPlatformModuleContext.Buttons. For a toggle (PlatformModuleButton.IsCheckable) the platform has already flipped PlatformModuleButton.IsChecked. The default implementation calls PlatformModuleButton.Click.

◆ OnDispose()

virtual void ATAS.Indicators.Modules.PlatformModule.OnDispose ( )
protectedvirtual

The platform stops using this instance: the panel was closed (also when the workspace is switched or the platform exits), the module was stopped by an error, the tariff no longer allows custom modules, 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 module 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.

◆ OnInitialize()

virtual void ATAS.Indicators.Modules.PlatformModule.OnInitialize ( )
protectedvirtual

Called when the module is attached to its panel (once per instance), after its saved settings were restored. Context is available from here on.

◆ OnInstrumentChanged()

virtual void ATAS.Indicators.Modules.PlatformModule.OnInstrumentChanged ( )
protectedvirtual

Called after the panel switched to another instrument (or lost it: IPlatformModuleContext.Instrument is then null), and once after OnSettingsChanged when an instrument is selected. Reset the accumulated data here; the data callbacks that follow belong to the new instrument.

◆ OnInstrumentStateChanged()

virtual void ATAS.Indicators.Modules.PlatformModule.OnInstrumentStateChanged ( IPlatformModuleInstrument  instrument)
protectedvirtual

The state of an additional instrument (IPlatformModuleContext.AddInstrument) changed: the platform subscribed to its data, stopped delivering it, or delivers it again. When the instrument becomes PlatformModuleInstrumentState.Active, its statistics and — if asked for — its whole order book follow right after this call.

◆ OnKeyDown()

virtual void ATAS.Indicators.Modules.PlatformModule.OnKeyDown ( PlatformModuleKeyEventArgs  e)
protectedvirtual

A key was pressed while the module has the keyboard focus (the user clicked it).

◆ OnKeyUp()

virtual void ATAS.Indicators.Modules.PlatformModule.OnKeyUp ( PlatformModuleKeyEventArgs  e)
protectedvirtual

A key was released while the module has the keyboard focus.

◆ OnMarketDepthChanged() [1/2]

virtual void ATAS.Indicators.Modules.PlatformModule.OnMarketDepthChanged ( IPlatformModuleInstrument  instrument,
IReadOnlyList< MarketDataArg >  levels 
)
protectedvirtual

Changed order book levels of an additional instrument added with the order book (a zero volume removes the level). The first call after the instrument became active carries its whole book. Do not keep the list.

◆ OnMarketDepthChanged() [2/2]

virtual void ATAS.Indicators.Modules.PlatformModule.OnMarketDepthChanged ( IReadOnlyList< MarketDataArg >  levels)
protectedvirtual

Changed order book levels (MarketDataArg.DataType is MarketDataType.Bid or MarketDataType.Ask; a zero volume removes the level). The first call after OnInstrumentChanged carries the whole book of the new instrument. The book as of the delivered changes is available through IPlatformModuleContext.GetDepth. Do not keep the list: it belongs to this call.

◆ OnMouseClick()

virtual void ATAS.Indicators.Modules.PlatformModule.OnMouseClick ( RenderControlMouseEventArgs  e)
protectedvirtual

The user clicked the module. Set RenderControlMouseEventArgs.Handled to suppress the panel context menu of a right click.

◆ OnMouseDown()

virtual void ATAS.Indicators.Modules.PlatformModule.OnMouseDown ( RenderControlMouseEventArgs  e)
protectedvirtual

A mouse button was pressed over the module.

◆ OnMouseLeave()

virtual void ATAS.Indicators.Modules.PlatformModule.OnMouseLeave ( )
protectedvirtual

The mouse left the module.

◆ OnMouseMove()

virtual void ATAS.Indicators.Modules.PlatformModule.OnMouseMove ( RenderControlMouseEventArgs  e)
protectedvirtual

The mouse moved over the module. Coordinates are relative to the client area.

◆ OnMouseUp()

virtual void ATAS.Indicators.Modules.PlatformModule.OnMouseUp ( RenderControlMouseEventArgs  e)
protectedvirtual

A mouse button was released over the module.

◆ OnMouseWheel()

virtual void ATAS.Indicators.Modules.PlatformModule.OnMouseWheel ( RenderControlMouseEventArgs  e)
protectedvirtual

The mouse wheel was turned over the module (RenderControlMouseEventArgs.Delta).

◆ OnNewTrades() [1/2]

virtual void ATAS.Indicators.Modules.PlatformModule.OnNewTrades ( IPlatformModuleInstrument  instrument,
IReadOnlyList< MarketDataArg >  trades 
)
protectedvirtual

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

◆ OnNewTrades() [2/2]

virtual void ATAS.Indicators.Modules.PlatformModule.OnNewTrades ( IReadOnlyList< MarketDataArg >  trades)
protectedvirtual

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

◆ OnRender()

abstract void ATAS.Indicators.Modules.PlatformModule.OnRender ( RenderContext  context,
Rectangle  bounds 
)
protectedpure virtual

Draws the module. bounds is the whole client area; the platform has filled it with IPlatformModuleContext.BackgroundColor. Called for every frame — keep it cheap: compute in the data callbacks and the timer, draw here.

◆ OnSettingsChanged()

virtual void ATAS.Indicators.Modules.PlatformModule.OnSettingsChanged ( )
protectedvirtual

Called after the module settings changed (and once after OnInitialize).

◆ OnSizeChanged()

virtual void ATAS.Indicators.Modules.PlatformModule.OnSizeChanged ( Size  size)
protectedvirtual

The client area of the module changed its size (also called before the first OnRender).

◆ OnSummaryChanged() [1/2]

virtual void ATAS.Indicators.Modules.PlatformModule.OnSummaryChanged ( InstrumentDailySummary  summary)
protectedvirtual

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.

◆ OnSummaryChanged() [2/2]

virtual void ATAS.Indicators.Modules.PlatformModule.OnSummaryChanged ( IPlatformModuleInstrument  instrument,
InstrumentDailySummary  summary 
)
protectedvirtual

The exchange statistics of an additional instrument changed; the latest value is delivered.

◆ OnTimer()

virtual void ATAS.Indicators.Modules.PlatformModule.OnTimer ( )
protectedvirtual

Called about ten times per second while the panel is open (also while it is hidden behind another tab).

◆ Redraw()

void ATAS.Indicators.Modules.PlatformModule.Redraw ( )
protected

Asks the platform to draw a new frame; calls are merged. Does nothing before OnInitialize.

Property Documentation

◆ Context

IPlatformModuleContext ATAS.Indicators.Modules.PlatformModule.Context
getprotected

The panel the module is shown in. Available from OnInitialize on.

Exceptions
InvalidOperationExceptionThe module is not attached to a panel yet.

◆ IsAttached

bool ATAS.Indicators.Modules.PlatformModule.IsAttached
getprotected

True once the module is attached to a panel (Context is available).


The documentation for this class was generated from the following file: