State

View as Markdown

Definition

Represents the current progression of the object as it advances from setup, processing data, to termination. These states can be used for setting up or declaring various resources and properties.

More detailed explanation of various states along with examples can be found in the OnStateChange() method section of this help guide. You can also attempt to set a new State using the SetState() method.

Property Value

An enum value representing the current state of the object. Possible values are:

StateDescription
SetDefaultsDefault values are set (pushed to UI).
ConfigureUser the presses the OK or Apply button.
ActiveObject is configured and is ready to receive instructions.
DataLoadedAll data series have been loaded.
HistoricalBegins to process historical data.
TransitionFinished processing historical data.
RealtimeBegins to process realtime data.
TerminatedBegins to shut down.

Syntax

State

Examples

Understanding the sequence of States

1protected override void OnStateChange()
2{
3 Print(DateTime.Now + ": Current State is State." + State);
4}

Using State to only process real-time data

1protected override void OnBarUpdate()
2{
3 // only process real-time OnBarUpdate events
4 if (State == State.Historical)
5 return;
6
7 //rest of logic
8}