CandleExpressionCondition

StockSharp.Algo.Candles.Patterns

Formula for a single candle inside pattern.

Implements: IAsyncPersistable

Constructors

CandleExpressionCondition
public CandleExpressionCondition(IFileSystem fileSystem, string expression)
candleExpressionCondition = CandleExpressionCondition(fileSystem, expression)

Create instance. The expression is compiled by CancellationToken).

fileSystem
File system.
expression
Expression

Properties

Expression
public string Expression { get; private set; }
value = candleExpressionCondition.Expression
candleExpressionCondition.Expression = value

Expression.

IsEmpty
public bool IsEmpty { get; }
value = candleExpressionCondition.IsEmpty

Formula is not present.

Methods

CheckCondition
public bool CheckCondition(ReadOnlySpan<ICandleMessage> candles, int candleIndex)
result = candleExpressionCondition.CheckCondition(candles, candleIndex)

Check if the condition is met for the given candles. The condition has to be prepared by CancellationToken).

candles
The candles to check the condition against.
candleIndex
The index of the candle in the candles array.

Returns: Check result.

LoadAsync
public Task LoadAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = candleExpressionCondition.LoadAsync(storage, cancellationToken)

Asynchronously loads the state of the object from the specified SettingsStorage.

storage
The SettingsStorage instance from which to load the data.
cancellationToken
A token to monitor for cancellation requests.

Returns: A task that represents the asynchronous load operation.

PrepareAsync
public ValueTask PrepareAsync(CancellationToken cancellationToken)
result = candleExpressionCondition.PrepareAsync(cancellationToken)

Compile Expression, so that the condition can be evaluated. Repeated calls do nothing.

cancellationToken
CancellationToken

Returns: ValueTask

SaveAsync
public Task SaveAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = candleExpressionCondition.SaveAsync(storage, cancellationToken)

Asynchronously saves the state of the object to the specified SettingsStorage.

storage
The SettingsStorage instance to which to save the data.
cancellationToken
A token to monitor for cancellation requests.

Returns: A task that represents the asynchronous save operation.

ToString
public override string ToString()
result = candleExpressionCondition.ToString()

Returns a string representation of the tuple, with values separated by commas.

Returns: A string representing the tuple's values.

Fields

Variables
public static readonly Variable[] Variables
value = CandleExpressionCondition.Variables

Candle formula variables.