Connection

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Add On >

Connection

Previous page Return to chapter overview Next page

Definition

The Connection class can be used to monitor connection related events as well as accessing connection related information.

 

Static Connection Class Events and Properties

CancelAllOrders()

Cancels all orders

Connect()

Connects to a connection

ConnectionStatusUpdate

Event handler for connection status updates

 

 

Events and Properties from Connection instances

Accounts

List of accounts from the connection

Disconnect()

Disconnects from the connection

Options

The connection's configuration options

PriceStatus

A ConnectionStatus representing the status of the price feed. Possible values are:

 

ConnectionStatus.Connected

ConnectionStatus.Connecting
ConnectionStatus.ConnectionLost

ConnectionStatus.Disconnecting

ConnectionStatus.Disconnected

Status

A ConnectionStatus representing the status of the order feed. Possible values are:

 

ConnectionStatus.Connected

ConnectionStatus.Connecting
ConnectionStatus.ConnectionLost

ConnectionStatus.Disconnecting

ConnectionStatus.Disconnected

 

 

Example

ns

// Example of accessing information on all connected connections
public class MyAddOnTab : NTTabPage
{
  public MyAddOnTab()
  {
    // Print information about all connected connections
    lock (Connection.Connections)
      foreach(Connection c in Connection.Connections)
          NinjaTrader.Code.Output.Process(string.Format("Connection: {0} Provider: {1}", c.Options.Name, c.Options.Provider), PrintTo.OutputTab1);
 
    // Other required NTTabPage members left out for demonstration purposes. Be sure to add them in your own code.
  }
}