InstrumentType

View as Markdown

Definition

Returns the type of instrument.

Property Value

An InstrumentType representing the type of an instrument.

Possible values are:

  • InstrumentType.Future
  • InstrumentType.Stock
  • InstrumentType.Index
  • InstrumentType.Forex
  • InstrumentType.Cfd
  • InstrumentType.Cryptocurrency

Syntax

Instrument.MasterInstrument.InstrumentType

Examples

1if (Instrument.MasterInstrument.InstrumentType == InstrumentType.Future)
2{
3 // Do something
4}
5else
6{
7 // Do something else
8}

Additional Access Information

This property can be accessed without a null reference check in the OnBarUpdate() event handler. When the OnBarUpdate() event is triggered, there will always be an Instrument object. Should you wish to access this property elsewhere, check for null reference first. e.g. if (Instrument != null)