InstrumentType

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Common > Instruments > Instrument > MasterInstrument >

InstrumentType

Previous page Return to chapter overview Next page

Definition

Returns the type of instrument.

 

Property Value

An InstrumentType representing the type of an instrument.

 

Possible values are:

InstrumentType.Forex

InstrumentType.Future

InstrumentType.Index

InstrumentType.Stock

 

Syntax

Instrument.MasterInstrument.InstrumentType

 

 

Examples

ns


if (Instrument.MasterInstrument.InstrumentType == InstrumentType.Future)

{

 // Do something

}

else

{

 // Do something else

}

 

 

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)