To create a DataFeed object, use the Open DataFeed command with arguments specifying details about the connection:
feed = Open DataFeed( options );
No arguments are required. You can simply create the Datafeed object and then send messages to it. Messages might include connecting to a port or setting up a script to process the data coming in. However, you would typically set up the basic operation of the data feed in the Open DataFeed command and subsequently send messages as needed to manage the data feed. Any of the options below work both as options inside Open DataFeed or as messages sent to a Datafeed object.
It’s a good idea to store a reference to the object in a global variable, such as feed above, so that you can easily send messages to the object. You can store a reference to an existing object by using a subscript; for example, to store a reference to the second data feed created:
feed2 = Data Feed[2];
(Windows only) To connect to a live data source, use Connect( ) and specify details for the port. Each setting takes only one argument; in this syntax summary the symbol | between argument choices means “or.” The Port specification is needed if you want to connect, otherwise the object still works, but is not connected to a data feed. The last three items, DTR_DSR, RTS_CTS, and XON_XOFF, are Boolean to specify which control characters are sent back and forth to indicate when the Datafeed is ready to get data. Typically, you would turn on at most one of them.
feed = Open Datafeed(
	Connect(
		Port( "com1:" | "com2:" | "lpt1:" | ... ),
		Baud( 9600 | 4800 | ... ),
		Data Bits( 8 | 7 ),
		Parity( None | Odd | Even ),
		Stop Bits( 1 | 0 | 2 ),
		DTR_DSR( 0 | 1 ), // Data Terminal Ready
		RTS_CTS( 0 | 1 ), // Request To Send | Clear To Send
		XON_XOFF( 1 | 0 ) // Transmitter On | Transmitter Off
	)
);
This command creates a scriptable data feed object and stores a reference to it in the global variable feed. The Connect argument starts up a thread to watch a communications port and collect lines. The thread collects characters until it has a line, and then appends it to the line queue and schedules an event to call the script.
Set Script attaches a script to the Datafeed object. This script is triggered by the On DataFeed handler whenever a line of data arrives. The argument for Set Script() is simply the script to run, or a global containing a script.
feed = Open Datafeed( Set Script( myScript ) );
feed = Open Datafeed( Set Script( Print( feed << Get Line ) ) );
A Datafeed script typically uses Get Line to get a copy of one line and then does something with that line. Often it parses the line for data and adds it to some data table.

Help created on 9/19/2017