About Component Objects in EasyLanguage

To make it easier to add and use objects with EasyLanguage, some object classes are designed as components so that you can simply double-click on their icons in the Toolbox to add them into your EasyLanguage document. Once added, these objects are configured by using the Properties Editor (View menu - Toolbars - Properties). Components automatically produce hidden designer generated code that is associated with your EasyLanguage document.  You may view designer code, but you can't directly edit the code.

Once component objects are added to your EasyLanguage document and configured using the Properties Editor, they can be used just like any other objects in your EasyLanguage code.

Inserting a Component Object
  1. From the TradeStation Development Environment (TDE), Open or create a New document (study, strategy, function) in the EasyLanguage editor.
  2. Open the Toolbox panel by clicking the Toolbox tab on the left side of the TDE window.  Double-click the icon that represents the type of component you want to add to your code.
  3. Double-clicking the component's icon in the Toolbox will cause an instance of the class (an object) to be added to the Component Tray at the bottom of your EasyLanguage document. (Note: You may have to re-size the Component Tray to see all of the icons if you add more than one component.)  To remove a component from a document, select its icon in the component tray and press the Delete key.

  1. Components in the Component Tray may be cut, copied, and pasted. To select a component to cut or copy, right-click the component's icon in the Component Tray and select Cut or Copy from the right-click menu. To paste, go to the Component Tray in which you'd like to paste the cut or copied component. Right-click in the destination Component Tray and select Paste from the right-click menu. As an alternative to using the right-click menu, the shortcut keys can be used (Ctrl-C to copy, Ctrl-X to cut, and Ctrl-V to paste). Components may be copied and pasted within a study or from a study to a different study. To select multiple items to cut or copy, hold down the Ctrl key when clicking on the item in the Component Tray.
  2. The designer generated code for the component is automatically linked to the EasyLanguage document and can be viewed using the View > Designer Generated Code menu sequence.  The designer code is protected and may not be directly edited using the editor.  Component values are modified using the Properties editor (see step # 5).
  3. Click on the Properties tab on the right side of the TDE window to open the Properties editor. This is where you manage and modify component values, inputs, and events.  Use the drop-down list at the top of the Properties editor to select a component whose values you want to view or modify. Property names appear in the left column and property values appear in the right column.  For example, the name of the component appears in the Design section and may be changed by entering a new name in the Value column of the Name field.
Modifying Component Properties

Example 1 (Timer component named Timer1)

To turn on the Timer component (Timer1 is this case) so that when the EasyLanguage document is applied to a chart or grid it will start counting, click the initial Enable property and select True from the drop-down list.  The value changes to True in the properties editor.

The matching EasyLanguage component (designer generated code) will now read:

 Timer1.Enable = true ;

 

Example 2 (Creating a handler method that will run with the timer elapses)

Click the Event icon at the top of the Properties editor for Timer1, then double-click on the Elapsed property to create an event handler named Timer1_Elapsed.  

A new method will be added to your EasyLanguage document that reads:

method void Timer1_Elapsed( elsystem.Object sender, elsysetm.TimerElapsedEventArgs args )

begin

 { Insert your EasyLanguage statements below }

 

end;


Simply add your own EasyLanguage statements and every time the Timer object elapses the EasyLanguage statements will be executed.  Since the AutoReset property of the Timer is set to True, your EasyLanguage will execute every 1000 milliseconds (1 second) by default).