Loading...
Searching...
No Matches
ATAS.Indicators.VolumeFilter Class Reference

A volume threshold that can be set either in instrument volume units or in money (PLAT-5080). More...

Inheritance diagram for ATAS.Indicators.VolumeFilter:
[legend]
Collaboration diagram for ATAS.Indicators.VolumeFilter:
[legend]

Public Member Functions

 VolumeFilter (bool enableVisible, bool asScalar=false)
 Initializes a new instance of the VolumeFilter class.
 
 VolumeFilter ()
 Initializes a new instance of the VolumeFilter class with default settings.
 
bool TryGetMoneyFactor (IVolumeValuation? valuation, out VolumeValueFactor factor)
 Gets the factor converting volumes into money of the filter currency.
 
bool IsMoneyApplied (IVolumeValuation? valuation=null)
 True when the threshold is compared in money: money mode with a known exchange rate. In money mode without a rate the filter falls back to the volume threshold.
 
bool HasThreshold (IVolumeValuation? valuation=null)
 True when the threshold is not zero in the unit it is applied in (a zero maximum usually means "no limit").
 
int Compare (decimal volume, decimal price, IVolumeValuation? valuation=null)
 Compares a traded volume with the threshold.
 
decimal GetVolumeThreshold (decimal price, IVolumeValuation? valuation=null)
 Returns the threshold in volume units at a price: Filter<TValue,TFilter>.Value in volume mode or when no rate is known, the volume worth Amount at price in money mode.
 
string FormatThreshold ()
 Returns the threshold as text in its current unit, e.g. "100" or "€50,000.00".
 
override object Clone ()
 
override bool Equals (object? obj)
 
override int GetHashCode ()
 
override string GetStringValue ()
 
- Public Member Functions inherited from ATAS.Indicators.Filter< decimal, VolumeFilter >
override bool Equals (object? obj)
 
override int GetHashCode ()
 
bool SetValueSilently (TValue value)
 Sets value of Value property. Returns false when new value equals new value.
 
 Filter (bool enabledVisible, bool asScale=false)
 Initializes a new instance of the Filter<TValue, TFilter> class with the specified parameters.
 
 Filter ()
 Initializes a new instance of the Filter<TValue, TFilter> class with default parameters.
 
 Filter (bool enabledVisible, bool asScalar=false)
 Initializes a new instance of the Filter<TValue> class with the specified visibility of the Enabled property and scalar value.
 
 Filter ()
 Initializes a new instance of the Filter<TValue> class with default visibility settings.
 
 Filter (bool enableVisible, bool asScalar=false)
 Initializes a new instance of the Filter class with the specified visibility of the Enabled property and scalar value.
 
 Filter ()
 Initializes a new instance of the Filter class with default visibility settings.
 
void RefreshValue ()
 Asks bindings to reread Value without changing it or invoking the value-changed action. This also restores an editor whose uncommitted input is invalid.
 
TFilter ValueOnChanging (Func< ValueChangingEventArgs< TValue >, TValue > onChanging)
 Sets a function to be invoked when the value of the filter is changing.
 
TFilter ValueOnChanged (Action< TValue > onChanged)
 Sets an action to be invoked when the value of the filter has changed.
 
override string ToString ()
 Converts the filter to its string representation.
 
virtual string GetStringValue ()
 
override object Clone ()
 

Static Public Member Functions

static IReadOnlyList< VolumeFilterUnitOption > GetUnitOptions ()
 Returns the units offered by editors: volume, the instrument currency and the display currencies.
 
- Static Public Member Functions inherited from ATAS.Indicators.Filter< decimal, VolumeFilter >
static bool operator== (Filter< TValue, TFilter >? left, Filter< TValue, TFilter >? right)
 
static bool operator!= (Filter< TValue, TFilter >? left, Filter< TValue, TFilter >? right)
 
static operator TValue (Filter< TValue, TFilter > other)
 Converts the Filter<TValue, TFilter> to its value of type TValue .
 

Static Public Attributes

const string VolumeUnitKey = "Volume"
 UnitKey of the volume unit.
 
const string InstrumentCurrencyUnitKey = "Instrument"
 UnitKey of money in the instrument's own currency (no exchange rate).
 

Properties

VolumeFilterUnit Unit [get, set]
 Unit the threshold is set in.
 
decimal Amount [get, set]
 Threshold in money, used when Unit is VolumeFilterUnit.Money.
 
string? Currency [get, set]
 Currency of Amount; null means the instrument's own currency.
 
bool IsMoney [get]
 True when the threshold is set in money.
 
decimal DisplayValue [get, set]
 Threshold in the current unit: Amount in money mode, otherwise Filter<TValue,TFilter>.Value. Bound by editors.
 
string UnitKey [get, set]
 Unit selector value for editors: VolumeUnitKey, InstrumentCurrencyUnitKey or a currency code. Switching from volume to money converts the threshold at the reference price when the filter is bound to a valuation.
 
string? MoneyScalar [get, set]
 The money part of the threshold as one invariant scalar, for indicators whose threshold was persisted as a bare number (PLAT-5080): "50000 EUR", "50000" for the instrument currency, null in volume mode. Such an indicator keeps persisting Filter<TValue,TFilter>.Value under the old property name and this text in a new one, so older versions read the volume threshold and skip the text. Setting it does not convert anything.
 
IVolumeValuation? Valuation [get, set]
 Valuation of the instrument the filter is applied to. Bound by the host (indicators get it bound automatically); used when no valuation is passed explicitly and by editors to convert the threshold between units.
 
- Properties inherited from ATAS.Indicators.Filter< decimal, VolumeFilter >
TValue Value [get, set]
 Gets or sets the value of the filter.
 

Additional Inherited Members

- Protected Member Functions inherited from ATAS.Indicators.Filter< decimal, VolumeFilter >
bool Equals (Filter< TValue, TFilter > other)
 
virtual ? TValue GetRealValue (TValue? value)
 
virtual TValue ValueOnChanging (TValue? oldValue, TValue? newValue)
 Invoked when the value of the filter is changing.
 
void RaiseValueOnChanged ()
 Raises the NotifyPropertyChangedBase.PropertyChanged event for the Value property and invokes the value changed action.
 
virtual TFilter CreateNew ()
 Creates a new instance of the derived filter type.
 

Detailed Description

A volume threshold that can be set either in instrument volume units or in money (PLAT-5080).

Filter<TValue,TFilter>.Value always holds the threshold in volume units. In money mode it is kept untouched and serves as the fallback: when no exchange rate is known and when an older platform version, which only knows Filter, loads the template - it reads the same JSON object, ignores the money fields and keeps working with the volume threshold.

A money threshold is compared with each trade at the trade's own price, so it keeps its meaning while the price of the instrument moves.

Constructor & Destructor Documentation

◆ VolumeFilter() [1/2]

ATAS.Indicators.VolumeFilter.VolumeFilter ( bool  enableVisible,
bool  asScalar = false 
)

Initializes a new instance of the VolumeFilter class.

Parameters
enableVisibleA value indicating whether the filter's Enabled property is visible.
asScalarA value indicating whether the filter is stored as a bare value while it is set in volume units.

◆ VolumeFilter() [2/2]

ATAS.Indicators.VolumeFilter.VolumeFilter ( )

Initializes a new instance of the VolumeFilter class with default settings.

Member Function Documentation

◆ Clone()

override object ATAS.Indicators.VolumeFilter.Clone ( )

◆ Compare()

int ATAS.Indicators.VolumeFilter.Compare ( decimal  volume,
decimal  price,
IVolumeValuation?  valuation = null 
)

Compares a traded volume with the threshold.

Parameters
volumeTraded volume in instrument units.
priceTrade price; used in money mode.
valuationValuation of the instrument; the bound Valuation when null.
Returns
Less than zero when the volume is below the threshold, zero when equal, greater than zero when above.

◆ Equals()

override bool ATAS.Indicators.VolumeFilter.Equals ( object?  obj)

◆ FormatThreshold()

string ATAS.Indicators.VolumeFilter.FormatThreshold ( )

Returns the threshold as text in its current unit, e.g. "100" or "€50,000.00".

◆ GetHashCode()

override int ATAS.Indicators.VolumeFilter.GetHashCode ( )

◆ GetStringValue()

override string ATAS.Indicators.VolumeFilter.GetStringValue ( )
virtual

◆ GetUnitOptions()

static IReadOnlyList< VolumeFilterUnitOption > ATAS.Indicators.VolumeFilter.GetUnitOptions ( )
static

Returns the units offered by editors: volume, the instrument currency and the display currencies.

◆ GetVolumeThreshold()

decimal ATAS.Indicators.VolumeFilter.GetVolumeThreshold ( decimal  price,
IVolumeValuation?  valuation = null 
)

Returns the threshold in volume units at a price: Filter<TValue,TFilter>.Value in volume mode or when no rate is known, the volume worth Amount at price in money mode.

Returns
The threshold; decimal.MaxValue when the price does not allow the conversion (zero price).

◆ HasThreshold()

bool ATAS.Indicators.VolumeFilter.HasThreshold ( IVolumeValuation?  valuation = null)

True when the threshold is not zero in the unit it is applied in (a zero maximum usually means "no limit").

◆ IsMoneyApplied()

bool ATAS.Indicators.VolumeFilter.IsMoneyApplied ( IVolumeValuation?  valuation = null)

True when the threshold is compared in money: money mode with a known exchange rate. In money mode without a rate the filter falls back to the volume threshold.

◆ TryGetMoneyFactor()

bool ATAS.Indicators.VolumeFilter.TryGetMoneyFactor ( IVolumeValuation?  valuation,
out VolumeValueFactor  factor 
)

Gets the factor converting volumes into money of the filter currency.

Parameters
valuationValuation of the instrument; the bound Valuation when null.
factorThe factor when available.
Returns
False in volume mode, or when the instrument cannot be valued in the filter currency.

Member Data Documentation

◆ InstrumentCurrencyUnitKey

const string ATAS.Indicators.VolumeFilter.InstrumentCurrencyUnitKey = "Instrument"
static

UnitKey of money in the instrument's own currency (no exchange rate).

◆ VolumeUnitKey

const string ATAS.Indicators.VolumeFilter.VolumeUnitKey = "Volume"
static

UnitKey of the volume unit.

Property Documentation

◆ Amount

decimal ATAS.Indicators.VolumeFilter.Amount
getset

Threshold in money, used when Unit is VolumeFilterUnit.Money.

◆ Currency

string? ATAS.Indicators.VolumeFilter.Currency
getset

Currency of Amount; null means the instrument's own currency.

◆ DisplayValue

decimal ATAS.Indicators.VolumeFilter.DisplayValue
getset

Threshold in the current unit: Amount in money mode, otherwise Filter<TValue,TFilter>.Value. Bound by editors.

◆ IsMoney

bool ATAS.Indicators.VolumeFilter.IsMoney
get

True when the threshold is set in money.

◆ MoneyScalar

string? ATAS.Indicators.VolumeFilter.MoneyScalar
getset

The money part of the threshold as one invariant scalar, for indicators whose threshold was persisted as a bare number (PLAT-5080): "50000 EUR", "50000" for the instrument currency, null in volume mode. Such an indicator keeps persisting Filter<TValue,TFilter>.Value under the old property name and this text in a new one, so older versions read the volume threshold and skip the text. Setting it does not convert anything.

◆ Unit

VolumeFilterUnit ATAS.Indicators.VolumeFilter.Unit
getset

Unit the threshold is set in.

◆ UnitKey

string ATAS.Indicators.VolumeFilter.UnitKey
getset

Unit selector value for editors: VolumeUnitKey, InstrumentCurrencyUnitKey or a currency code. Switching from volume to money converts the threshold at the reference price when the filter is bound to a valuation.

◆ Valuation

IVolumeValuation? ATAS.Indicators.VolumeFilter.Valuation
getset

Valuation of the instrument the filter is applied to. Bound by the host (indicators get it bound automatically); used when no valuation is passed explicitly and by editors to convert the threshold between units.


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