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:
- After creating an EasyLanguage analysis
technique document, open the Properties window.
- Select the AnalysisTechnique object
from the combo box at the top of the Properties window.
- Click to go to
the Events tab.
- Double click on the Initialized, WorkspaceSaving, or
UnInitialized event to create a handler method in your analysis technique
document.
Namespace: elsystem
Additional
properties, methods, and events are described in the classes listed
under Inheritance Hierarchy (see below).
|
Name |
Type |
Description |
|
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).
|
|
DataNum |
int |
The
number of the data stream to use for the analysis technique. |
|
DataStreams |
object |
Used to access information about the data streams used by the analysis technique. Note that this property only contains information about data streams used by the analysis technique, rather than about all the data streams in the chart. For example, an analysis technique might refer to Data1 and Data2, while the chart contains 5 data streams. In this case, only Data1 and Data2 will be part of this DataStreams property. See DataStreams. (For information about all the data streams on a chart see the DataStreams property of the ChartingHost class.) |
|
DrawingObjects |
object |
Used to add, delete, and access drawing objects in a chart. See DrawObjects for more info. |
|
Name
|
string |
The
name of the analysis technique. |
|
Name |
Description |
|
GetDataNum |
Gets
the number of the data stream used by the analysis technique. |
|
GetParent |
The
analysis technique object that called this analysis technique. |
|
Name |
Description |
|
Initialized |
Event handler that is called when the analysis technique
first runs. See InitializedEventArgs for the properties returned by the handler's args parameter. |
|
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. |
|
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.
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.
- Click
on the Import Example link to import the example into TradeStation.
- Go
to the TradeStation platform and create a Chart Analysis window.
Use the Insert - Indicator menu sequence and Add !ex_AnalysisAppStorage
to the chart.
- To review
or modify the example code, go to the TS Development Environment
and open indicator!ex_AnalysisAppStorage in the
EasyLanguage Editor.