Class BaseIndicator
- Namespace
- ATAS.Indicators
- Assembly
- ATAS.Indicators.dll
Base class for custom indicators in a chart.
[DataContract]
public abstract class BaseIndicator : ChartObject, INotifyPanelPropertyChanged, IPropertiesEditorOwner
- Inheritance
-
objectBaseIndicator
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
BaseIndicator(bool)
Initializes the indicator with one value series, named after the indicator and drawn as a line.
protected BaseIndicator(bool useCandles = false)
Parameters
useCandlesbooltrue to take the candles of the chart as the default source; false to take a price series (Close by default).
Fields
MaxCustomNameLength
Maximum allowed length of the user-defined CustomName.
Added in ATAS 8.0.15.
public const int MaxCustomNameLength = 50
Field Value
- int
UsedIndicators
The list of indicators that are being used by this indicator.
protected readonly List<Indicator> UsedIndicators
Field Value
- List<Indicator>
Properties
CurrentBar
Bars number. All bars and the values of the corresponding data series have a serial number. The earliest bar of the chart is assigned the number 0; the next bar is assigned the number 1, and so on.
[Browsable(false)]
[IgnoreDataMember]
public int CurrentBar { get; }
Property Value
- int
CustomName
User-defined display name of this indicator instance. It is independent from other instances of the same indicator type and is used purely as a label. When null or empty, the auto-generated name (see ToString()) is shown instead.
Added in ATAS 8.0.15.
[DataMember]
[Browsable(false)]
public string? CustomName { get; set; }
Property Value
- string
DataSeries
List of data series used by the indicator.
[Display(ResourceType = typeof(Strings), GroupName = "Drawing")]
[Tab(TabName = "Visualization", ResourceType = typeof(Strings))]
[IgnoreDataMember]
public List<IDataSeries> DataSeries { get; }
Property Value
- List<IDataSeries>
ExternalCalculation
When true the indicator's own OnCalculate(int, decimal) pipeline is suppressed and its data series are filled by an external calculation service (the platform's multi-timeframe projection host, PLAT-4527). The host listens to ExternalCalculateBarRequested / ExternalRecalculateRequested to keep the series in sync. Not persisted; set by the host only.
Added in ATAS 8.0.15.
[Browsable(false)]
[IgnoreDataMember]
public bool ExternalCalculation { get; set; }
Property Value
- bool
IsDisposed
Gets or sets a value indicating whether the indicator object has been disposed of.
[Browsable(false)]
[IgnoreDataMember]
public bool IsDisposed { get; set; }
Property Value
- bool
IsVerticalIndicator
Gets or sets a value indicating whether the indicator is intended to be displayed as a vertical indicator.
[Browsable(false)]
public bool IsVerticalIndicator { get; set; }
Property Value
- bool
this[int]
Gets or sets the value of the first data series of the indicator at the specified index.
public decimal this[int index] { get; protected set; }
Parameters
indexintThe index of the value to get or set.
Property Value
- decimal
The value of the indicator at the specified index.
LineSeries
List of line series used by the indicator.
[Display(ResourceType = typeof(Strings), GroupName = "Lines")]
[Tab(TabName = "Visualization", ResourceType = typeof(Strings))]
[IgnoreDataMember]
public List<LineSeries> LineSeries { get; }
Property Value
- List<LineSeries>
Name
Name of the indicator.
[Browsable(false)]
public string Name { get; set; }
Property Value
- string
Panel
The name of the panel where the indicator is placed.
[DataMember]
[Tab(TabName = "Visualization", ResourceType = typeof(Strings))]
[Display(ResourceType = typeof(Strings), Name = "Panel", GroupName = "Drawing", Description = "PanelDescription", Order = 0)]
public string Panel { get; set; }
Property Value
- string
PerformanceDiagnoser
Indicator performance tracker.
protected static PerformanceDiagnoser? PerformanceDiagnoser { get; }
Property Value
PropertiesEditor
Added in ATAS 8.0.15.
[Browsable(false)]
[IgnoreDataMember]
public IPropertiesEditor? PropertiesEditor { get; set; }
Property Value
SourceDataSeries
Gets or sets the data series used as the source for the indicator's calculations.
[IgnoreDataMember]
[Tab(TabName = "Data", ResourceType = typeof(Strings))]
[Display(ResourceType = typeof(Strings), Name = "SourceDataSeries", GroupName = "Common", Description = "SourceDescription", Order = 10)]
public IDataSeries<decimal>? SourceDataSeries { get; set; }
Property Value
- IDataSeries<decimal>
Remarks
The source data series provides the input data for the indicator's calculations. When this property is set, the indicator will automatically recalculate its values based on the new source data series.
SupportsExtendedSeries
Gets value indicating whether the data series can be drawn out of chart bars
[Browsable(false)]
[IgnoreDataMember]
public bool SupportsExtendedSeries { get; init; }
Property Value
- bool
UseCandles
Gets a value indicating whether the indicator uses candle data series.
[Browsable(false)]
[IgnoreDataMember]
public bool UseCandles { get; }
Property Value
- bool
UseProfiling
Set to true to measure the performance of all indicators.
protected static bool UseProfiling { get; set; }
Property Value
- bool
Methods
Add(Indicator)
Adds an indicator to the list of used indicators by this indicator.
protected void Add(Indicator indicator)
Parameters
indicatorIndicatorThe indicator to be added to the list of used indicators.
Calculate(int, decimal)
Performs the calculation for the indicator at the specified bar and value.
protected virtual void Calculate(int bar, decimal value)
Parameters
barintThe bar number for which the calculation is performed.
valuedecimalThe input value from the data series at the specified bar.
Clear()
Clear all data series.
protected void Clear()
Dispose()
Releases the indicator: calls OnDispose(), clears its values and series, detaches the source and disposes the indicators it uses. A second call does nothing.
public virtual void Dispose()
MeasurePerformance(string)
Measures the performance of a specific operation with the given name. If a performance diagnoser is available, it will be used to measure the performance; otherwise, a default performance counter will be returned.
protected static PerfCounter MeasurePerformance(string name)
Parameters
namestringThe name of the operation to measure performance for.
Returns
- PerfCounter
A performance counter representing the measured performance. If no performance diagnoser is available, a default performance counter will be returned.
OnCalculate(int, decimal)
The main indicator calculation method is called for each bar on the history, then it is called on each tick.
protected abstract void OnCalculate(int bar, decimal value)
Parameters
barintBar number.
valuedecimalInput data series value.
OnDispose()
Called when the indicator is being disposed.
protected virtual void OnDispose()
OnFinishRecalculate()
The method is executed after the end of the calculation.
protected virtual void OnFinishRecalculate()
OnInitialize()
The method is executed before the first calculation.
protected virtual void OnInitialize()
OnPropertiesEditorChanged(IPropertiesEditor?, IPropertiesEditor?)
Called when the PropertiesEditor property changes.
Added in ATAS 8.0.15.
protected virtual void OnPropertiesEditorChanged(IPropertiesEditor? oldValue, IPropertiesEditor? newValue)
Parameters
oldValueIPropertiesEditorThe previous properties editor instance.
newValueIPropertiesEditorThe new properties editor instance.
OnRecalculate()
The method is executed before a new calculation.
protected virtual void OnRecalculate()
OnSourceChanged()
This method is called when the SourceDataSeries property is changed.
protected virtual void OnSourceChanged()
OnVisibleChanged()
Called when the Visible property changes.
protected override void OnVisibleChanged()
RaiseBarValueChanged(int)
Raises the BarValueChanged event with the specified bar value.
protected void RaiseBarValueChanged(int bar)
Parameters
barintThe bar value to pass to the event handlers.
RaisePanelPropertyChanged(string)
Raises the PanelPropertyChanged event with the specified property name.
protected void RaisePanelPropertyChanged(string name)
Parameters
namestringThe name of the property that changed.
RaisePropertyChanged(object?, PropertyChangedEventArgs)
Raises the PropertyChanged event with the specified event arguments.
Added in ATAS 8.0.15.
protected void RaisePropertyChanged(object? sender, PropertyChangedEventArgs e)
Parameters
senderobjectThe sender of the event.
ePropertyChangedEventArgsThe event arguments.
RaisePropertyChanged(string)
Raises the PropertyChanged event for the specified property name.
protected void RaisePropertyChanged(string propertyName)
Parameters
propertyNamestringThe name of the property that changed.
RecalculateValues()
Recalculate the indicator values on each bar.
protected virtual void RecalculateValues()
ToString()
Converts the current instance of the indicator to its string representation.
public override string ToString()
Returns
- string
A string representation of the indicator.
Events
BarValueChanged
Event that is raised when the value of a bar in the indicator changes.
Added in ATAS 8.0.15.
public event Action<int>? BarValueChanged
Event Type
- Action<int>
ExternalCalculateBarRequested
Raised instead of a single-bar calculation when ExternalCalculation is on (a source data series tick arrived for the given bar).
Added in ATAS 8.0.15.
public event Action<int>? ExternalCalculateBarRequested
Event Type
- Action<int>
ExternalRecalculateRequested
Raised instead of a full recalculation when ExternalCalculation is on (the data series were cleared and must be re-projected in full).
Added in ATAS 8.0.15.
public event Action? ExternalRecalculateRequested
Event Type
- Action
PanelPropertyChanged
Added in ATAS 8.0.15.
public event PropertyChangedEventHandler? PanelPropertyChanged
Event Type
- PropertyChangedEventHandler
PropertyChanged
Occurs when a property of the indicator changes.
Added in ATAS 8.0.15.
public event PropertyChangedEventHandler? PropertyChanged
Event Type
- PropertyChangedEventHandler