IndicatorHelper
Extension class for indicators.
Methods
public static IIndicatorValue CreateEmptyValue(IIndicator indicator, DateTime time)
result = IndicatorHelper.CreateEmptyValue(indicator, time)
Create empty IIndicatorValue.
- indicator
- IIndicator
- time
- Time
Returns: Empty IIndicatorValue.
public static IIndicator CreateIndicator(IndicatorType type)
result = IndicatorHelper.CreateIndicator(type)
Create indicator.
- type
- IndicatorType
Returns: IIndicator
public static IEnumerable<IndicatorType> ExcludeObsolete(IEnumerable<IndicatorType> types)
result = IndicatorHelper.ExcludeObsolete(types)
Exclude obsolete indicators.
- types
- All indicator types.
Returns: Filtered collection.
public static decimal GetCurrentValue(IIndicator indicator)
result = IndicatorHelper.GetCurrentValue(indicator)
To get the current value of the indicator.
- indicator
- Indicator.
Returns: The current value.
public static T GetCurrentValue<T>(IIndicator indicator)
result = IndicatorHelper.GetCurrentValue(indicator)
To get the current value of the indicator.
- indicator
- Indicator.
Returns: The current value.
public static decimal GetFirstValue(IIndicator indicator)
result = IndicatorHelper.GetFirstValue(indicator)
To get the first value of the indicator.
- indicator
- Indicator.
Returns: The current value.
public static decimal? GetNullableCurrentValue(IIndicator indicator)
result = IndicatorHelper.GetNullableCurrentValue(indicator)
To get the current value of the indicator.
- indicator
- Indicator.
Returns: The current value.
public static decimal? GetNullableFirstValue(IIndicator indicator)
result = IndicatorHelper.GetNullableFirstValue(indicator)
To get the first value of the indicator.
- indicator
- Indicator.
Returns: The current value.
public static decimal? GetNullableValue(IIndicator indicator, int index)
result = IndicatorHelper.GetNullableValue(indicator, index)
To get the indicator value by the index (0 - last value).
- indicator
- Indicator.
- index
- The value index.
Returns: Indicator value.
public static decimal GetValue(IIndicator indicator, int index)
result = IndicatorHelper.GetValue(indicator, index)
To get the indicator value by the index (0 - last value).
- indicator
- Indicator.
- index
- The value index.
Returns: Indicator value.
public static Type GetValueType(Type indicatorType, bool isInput)
result = IndicatorHelper.GetValueType(indicatorType, isInput)
Get value type for specified indicator.
- indicatorType
- Indicator type.
- isInput
- Is input.
Returns: Value type.
public static T GetValue<T>(IIndicator indicator, int index)
result = IndicatorHelper.GetValue(indicator, index)
To get the indicator value by the index (0 - last value).
- indicator
- Indicator.
- index
- The value index.
Returns: Indicator value.
public static bool IsNonDecimalOutputValue(Type indicator)
result = IndicatorHelper.IsNonDecimalOutputValue(indicator)
Determines whether the indicator is a non-decimal output value.
- indicator
- Indicator type.
Returns: Check result.
public static void Preload(IIndicator indicator, IEnumerable<ValueTuple<DateTime, object[]>> items)
IndicatorHelper.Preload(indicator, items)
Bulk preload using primitive tuples. Implementations may override; default throws NotSupportedException.
- indicator
- IIndicator
- items
- Sequence of (time, values) where values correspond to ToValues output.
public static IIndicatorValue Process(IIndicator indicator, decimal value, DateTime time, bool isFinal)
result = IndicatorHelper.Process(indicator, value, time, isFinal)
To renew the indicator with numeric value.
- indicator
- Indicator.
- value
- Numeric value.
- time
- Time
- isFinal
- Is the value final (the indicator finally forms its value and will not be changed in this point of time anymore). Default is .
Returns: The new value of the indicator.
public static IIndicatorValue Process(IIndicator indicator, ICandleMessage candle)
result = IndicatorHelper.Process(indicator, candle)
To renew the indicator with candle closing price ClosePrice.
- indicator
- Indicator.
- candle
- Candle.
Returns: The new value of the indicator.
public static IIndicatorValue Process(IIndicator indicator, IIndicatorValue input, decimal value)
result = IndicatorHelper.Process(indicator, input, value)
To renew the indicator with numeric value.
- indicator
- Indicator.
- input
- IIndicatorValue
- value
- Numeric value.
Returns: The new value of the indicator.
public static IIndicatorValue Process(IIndicator indicator, object inputValue, DateTime time, bool isFinal)
result = IndicatorHelper.Process(indicator, inputValue, time, isFinal)
To renew the indicator with new value.
- indicator
- Indicator.
- inputValue
- Input value.
- time
- Time
- isFinal
- IsFinal
Returns: IIndicatorValue.
public static IIndicatorValue Process<TValue>(IIndicator indicator, ValueTuple<TValue, TValue> value, DateTime time, bool isFinal)
result = IndicatorHelper.Process(indicator, value, time, isFinal)
To renew the indicator with numeric pair.
- indicator
- Indicator.
- value
- The pair of values.
- time
- Time
- isFinal
- If the pair final (the indicator finally forms its value and will not be changed in this point of time anymore). Default is .
Returns: The new value of the indicator.
public static IIndicatorValue SetValue(IIndicatorValue input, IIndicator indicator, decimal value)
result = IndicatorHelper.SetValue(input, indicator, value)
To replace the indicator input value by new one (for example it is received from another indicator).
- input
- IIndicatorValue
- indicator
- Indicator.
- value
- Value.
Returns: New object, containing input value.
public static ICandleMessage ToCandle(IIndicatorValue value)
result = IndicatorHelper.ToCandle(value)
Convert IIndicatorValue to ICandleMessage.
- value
- IIndicatorValue
Returns: ICandleMessage
public static decimal ToDecimal(IIndicatorValue value, Level1Fields? source)
result = IndicatorHelper.ToDecimal(value, source)
Convert IIndicatorValue to Decimal.
- value
- IIndicatorValue
- source
- Field specified value source.
Returns: Decimal
public static decimal? ToNullableDecimal(IIndicatorValue value, Level1Fields? source)
result = IndicatorHelper.ToNullableDecimal(value, source)
Convert IIndicatorValue to Decimal or if the value is empty..
- value
- IIndicatorValue
- source
- Field specified value source.
Returns: Decimal or if the value is empty.
public static IIndicator TryCreateIndicator(IndicatorType type)
result = IndicatorHelper.TryCreateIndicator(type)
Create indicator.
- type
- IndicatorType
Returns: IIndicator
public static IndicatorType TryGetById(IIndicatorProvider provider, string id)
result = IndicatorHelper.TryGetById(provider, id)
Try find IndicatorType by identifier.
- provider
- IIndicatorProvider
- id
- Identifier.
Returns: IndicatorType or .
public static IndicatorType TryGetByType(IIndicatorProvider provider, Type type)
result = IndicatorHelper.TryGetByType(provider, type)
Try find IndicatorType by type.
- provider
- IIndicatorProvider
- type
- Indicator
Returns: IndicatorType or .