IsSuspendedWhileInactive

View as Markdown

Definition

Prevents OnBarUpdate from being raised while the indicators display is not in use. Enabling this property in your indicator helps save CPU cycles while the indicator is suspended and not in use by a user. Once the indicator is in a state that would no longer be considered suspended, the historical OnBarUpdate() events will be triggered allowing the indicator to catch up to current real-time values.

Suspension occurs in the following scenarios:

  • Minimized Chart
  • Minimized Market Analyzer
  • Minimized Hot List Analyzer
  • Minimized SuperDOM
  • Background tabs of above features are considered “minimized”
  • Inactive workspaces in the background

Since events in OnBarUpdate() will not be processed while the indicator is suspended, internal NinjaScript functions such as Alert, PlaySound, Share, Print, etc - or any other method that would be used to notify a user of activity will NOT be processed until the indicator is un-suspended.

Scenarios where suspension will not occur

The IsSuspendedWhileInactive property will be ignored and real-time events will be processed as normal under the following cases:

Property Value

This property returns true if indicator can take advantage of suspension optimization; otherwise, false. Default set to false.

This property is overridden to “true” automatically by the NinjaScript Code Wizard. You will need to remove the property to return to the default value or manually set it to false to disable this behavior.

This property should ONLY be set from the OnStateChange() method during State.SetDefaults or State.Configure.

Syntax

IsSuspendedWhileInactive

Examples

1protected override void OnStateChange()
2{
3 if (State == State.SetDefaults)
4 {
5 IsSuspendedWhileInactive = true;
6 }
7}