AnalysisTechnique Class

The base class for an analysis technique object.  All EasyLanguage analysis techniques (Indicator, ShowMe, PaintBar, etc.) are automatically created as an instance of the AnalysisTechnique class which allows you to access information about the analysis technique from other objects using the listed properties. You can also create your own event handler methods that respond to the Initialized, WorkspaceSaving, and UnInitialized events.

To use the Initialized, WorkspaceSaving, and Uninitialized events with an analysis technique you need to do the following:

  1. After creating an EasyLanguage analysis technique document, open the Properties window.
  2. Select the AnalysisTechnique object from the combo box at the top of the Properties window.
  3. Click to go to the Events tab.
  4. Double click on the Initialized, WorkspaceSaving, or UnInitialized event to create a handler method in your analysis technique document.

Namespace: elsystem 

Properties

   Additional properties, methods, and events are described in the classes listed under Inheritance Hierarchy (see below).

  Name Type Description
Public property AppStorage object

A Dictionary of name-value pairs that will be persistent when an analysis technique is re-verified, has its inputs modified, or re-runs for another reason (such as when it is disabled by the user temporarily, and then enabled again).

 

AppStorage is an instance of the Dictionary class. Any object can be placed in AppStorage. However, only native data type values (int, bool, string, float, double, byte) and "serializable" objects that contain native data type elements (see below for a list of "serializable" objects) should be expected to retain all of their values "permanently" (that is, beyond the time during which the analysis technique is running). Thus, for example, an integer value can be stored in AppStorage and retrieved from AppStorage even after the computer has been restarted. But an instance of the Position class cannot be so stored and retrieved, since the Position class is not "serializable."

 

Note that values that are stored in AppStorage are saved when the workspace is saved. So, when the workspace is closed it should be saved so as to retain the latest values stored in AppStorage.

 

If instances of the following classes contain only the native data types, then the instances (objects) are serializable:

1) Dictionary

2) Vector

3) Stack

4) Queue

If desired, EasyLanguage code can be written to put values into AppStorage when the WorkspaceSaving event fires (see below for details on the WorkspaceSaving event). Values can be placed in AppStorage at any time, but it is sometimes convenient to store values when the workspace is saved (that is, when the WorkspaceSaving event fires).

Public property DataNum int The number of the data stream to use for the analysis technique.
Public property DataStreams object Used to access additional information about the data streams used by the analysis technique. See DataStreams for more info.
Public property DrawingObjects object Used to add, delete, and access drawing objects in a chart. See DrawObjects for more info.
Public property Name string The name of the analysis technique.
Methods
  Name Description
Public property GetDataNum Gets the number of the data stream used by the analysis technique.
Public property GetParent The analysis technique object that called this analysis technique.
Events
  Name Description
Public event Initialized Event handler that is called when the analysis technique first runs. See InitializedEventArgs for the properties returned by the handler's args parameter.
Public event Uninitialized Event handler that is called as the analysis technique is shutting down and prior to finishing calculation. See UnInitializedEventArgs for the properties returned by the handler's args parameter.
Public event WorkSpaceSaving Event handler that is called when a workspace containing the analysis technique is to be saved. See WorkSpaceSavingEventArgs for the properties returned by the handler's args parameter.


The Initialized event can be used to call an event handler method that contains code that is called only once prior to calculations commencing in the analysis technique.  The initialized event handler might be used to perform one time initialization of variables or perform any other operation that needs to occur at the time the analysis technique first runs and not thereafter.  

Likewise, the UnInitialized event can be used to call an event handler method that contains code that is called prior to the calculation of the analysis technique finishing.  The uninitialized event handler might be used to execute any cleanup code required to be run before the analysis technique shuts down.  This could happen when the analysis technique is removed from an analysis window or when a window, workspace, or desktop is closed.  The UnInitialized event is also called prior to recalculation.  However, in the case of an exception error there are times that the uninitialized event handler may not get called.

   Note that UnInitialized event is fired after the contents of the analysis technique have been saved to its workspace, so this event should not be used to store values (such as AppStorage) associated with the analysis technique.

The WorkSpaceSaving event occurs when the workspace containing the analysis technique is about to saved. This event fires before the analysis technique Uninitialized event occurs, so creating a method to handle this event is a good place to store values associated with an analysis technique, such as AppStorage values, that need to be updated before the analysis technique is closed.

Example

The following AnalysisTechnique example creates an entry in the AppStorage dictionary during the Initialized event, and then updates the entry every time the workspace is saved.

  Import Example

AnalysisTechnique Create-Update AppStorage value

  1. Click on the Import Example link to import the example into TradeStation.   
  2. Go to the TradeStation platform and create a Chart Analysis window.  Use the Insert - Indicator menu sequence and Add !ex_AnalysisAppStorage to the chart.
  3. To review or modify the example code, go to the TS Development Environment and open indicator!ex_AnalysisAppStorage in the EasyLanguage Editor.
Inheritance Hierarchy

elsystem.Object

elsystem.AnalysisTechnique