Using Studies (PowerLanguage Editor)
Understanding Studies
Custom studies can be created from scratch or existing studies modified by using the PowerLanguage Editor.
Studies can be classified into three types:
- Indicators
- Signals
- Functions
Indicators are visual technical analysis tools, used to analyze market conditions and identify and forecast trends and market patterns. An indicator is a visualization of a mathematical formula, and consists of one or more Plots – lines, histograms, series of points or crosses, highs and lows, left and right ticks, or a combination of the above.
Signals are mechanical technical analysis tools, used to systematically specify market entry or exit points according to a set of trading rules implemented in the signal's algorithm. The trade points are indicated on a chart by ticks and arrows. Signals can be viewed as the basic building blocks of strategies.
Functions are independent procedures (subroutine) that can be called from other scripts to carry out specific tasks.
Creating Indicators
To create an indicator:
- Open New dialog box by clicking the New
icon on the toolbar, by selecting File in the main menu and clicking New, or by using the Ctrl+N keyboard shortcut.
- Select Indicator.
- Enter the indicator name.
- Click OK.
Creating Signals
To create a signal:
- Open New dialog box by clicking the New
icon on the toolbar, by selecting File in the main menu and clicking New, or by using the Ctrl+N keyboard shortcut.
- Select Signal.
- Enter the signal name.
- Click OK.
Creating Functions
To create a function:
- Open New dialog box by clicking the New
icon on the toolbar, by selecting File in the main menu and clicking New, or by using the Ctrl+N keyboard shortcut.
- Select Function.
- Enter the function name.
- Select the Return Type.
- Select the Function Storage.
- Click OK.
Available Studies List
A list of all available studies can be viewed in the Open window. Studies' Name, Type, Status, and the last modification date (Modified) are displayed in the list.
Studies can be edited, deleted and the studies' properties can be modified from the Open window.
To open the Open window:
- Click the Open
icon on the toolbar.
- The Open window can also be opened by selecting File in the main menu and clicking Open, or by using the Ctrl+O keyboard shortcut.
To open a study’s script from the list of recent scripts:
- Click on the arrow next to the Open
icon on the toolbar.
- In the File menu choose Recent Scripts and select the required script.
Study List
The list of available studies, displayed in the Open window, can be set to include one or more of the following study types: Indicators, Signals, and Functions. To select the study types to be listed, select or clear the appropriate checkboxes in the Study Type section.
In the list, each study's name, type, status, and last modification date and time are displayed in the Name, Type, Status, and Modified columns. The list can be sorted by any column, in ascending or descending order, by clicking on the column header:
- Name column displays the study's name.
- Type column displays the study's type: Indicator, Signal, or Function.
- Status column displays the study's status:
- Compiled
- the study is ready to be used; to learn more, see Compiling Studies
- Protected
- the study cannot be opened for editing, and the study’s code cannot be viewed; to learn more, see Protecting Studies
- No status is displayed – the study has to be compiled before it can be used; to learn more, see Compiling Studies
- Compiled
- Modified column displays the date and time that the most recent study modification has been made.
To scroll through the list of studies, use the scrollbar on the right side of the list, or the UP ARROW and DOWN ARROW keys on the keyboard.
Opening Studies
To open a study:
- Open the Open window.
- To open the Open window:
- Click the Open
icon on the toolbar.
- The Open window can also be opened by selecting File in the main menu and clicking Open, or by using the Ctrl+O keyboard shortcut.
- Click the Open
- To open the Open window:
- In the Study Type section, select or clear Indicator, Signal, and/or Function checkboxes to specify the types of studies to be included in the list.
- Select one or more studies to be opened; several studies can be selected at once by holding down Ctrl or/and Shift keys while making the selection. All studies can be selected by using the Ctrl+A keyboard shortcut, or by clicking any study’s name and then clicking Select All.
- Click OK or double-click the selected study.
Saving Studies
To save a study in PowerLanguage Editor, click the Save icon on the toolbar. A study can also be saved by selecting File in the main menu and clicking Save, or by using the Ctrl+S keyboard shortcut.
All studies currently opened in PowerLanguage editor can be saved by selecting File in the main menu and clicking Save All, or by using the Ctrl+Shift+S keyboard shortcut.
Renaming Studies
A study can be renamed by one of the following methods:
- Click the Properties
icon on the toolbar; in the Properties tab of the Properties dialog box that appears, in the Name box, enter the new study name and click OK.
- Right-click within the study’s window and then click Properties; in the Properties tab of the Properties dialog box that appears, in the Name box, enter the new study name and click OK.
- Select File in the main menu and click Save As; in the dialog box that appears, enter the new study name and click OK.
A study can also be renamed from the Open window. To rename a study from the Open window:
- Open the Open window.
- To open the Open window:
- Click the Open
icon on the toolbar.
- The Open window can also be opened by selecting File in the main menu and clicking Open, or by using the Ctrl+O keyboard shortcut.
- Click the Open
- To open the Open window:
- In the Study Type section, select or clear Indicator, Signal, and/or Function checkboxes to specify the types of studies to be included in the list.
- Right-click the study to be renamed, and then click Edit.
- In the Properties tab of the Properties dialog box that appears, in the Name box, enter the new study name and click OK.
Closing Studies
A study can be closed by one of the following methods:
- Click the Close icon on the study's title bar.
- Right-click on the study's window tab, and then click Close.
- Select File in the main menu and click Close.
- Use the Alt+F4 keyboard shortcut.
Deleting Studies
To delete a study:
- Open the Open window.
- To open the Open window:
- Click the Open
icon on the toolbar.
- The Open window can also be opened by selecting File in the main menu and clicking Open, or by using the Ctrl+O keyboard shortcut.
- Click the Open
- To open the Open window:
- In the Study Type section, select or clear Indicator, Signal, and/or Function checkboxes to specify the types of studies to be included in the list.
- Select one or more studies to be deleted; several studies can be selected at once by holding down Ctrl or/and Shift keys while making the selection. All studies can be selected by using the Ctrl+A keyboard shortcut, or by clicking any study’s name and then clicking Select All.
- Press the Delete key on the keyboard, or right-click the study to be deleted, and then click Delete.
Editing Study Properties
Study properties can be edited from the Properties window.
Properties window can be opened by one of the following methods:
- Click the Properties
icon on the toolbar.
- Right-click within the study’s window and then click Properties.
Properties window can be opened from the Open window. To open the Properties window from the Open window:
- Open the Open window.
- To open the Open window:
- Click the Open
icon on the toolbar.
- The Open window can also be opened by selecting File in the main menu and clicking Open, or by using the Ctrl+O keyboard shortcut.
- Click the Open
- To open the Open window:
- In the Study Type section, select or clear Indicator, Signal, and/or Function checkboxes to specify the types of studies to be included in the list.
- Right-click the study, the properties of which are to be edited, and then click Edit.
To learn more about studies properties, see Default Properties.