Tradesignal possesses a built-in HTML editor. With it, you can do the following:
- Use HTML code to design a GUI or control elements like buttons, lists or entry fields
- Use active elements written in JavaScript (JS), for example to list all active workspaces. This way you can write control elements that use program functions of Tradesignal.
Use the HTML Editor
 |
HTML Editor |
Click on the
Layout button in the
Workspace group to open the menu. Then choose the entry
Insert HTML Element.
An editor window opens. In the toolbar, the
HTML Editor group appears with the following buttons:
Show Browser - Interprets the HTML or JavaScript Code and displays the result in a browser.
Show Editor - Switch from the browser back to the editor.
Undo - Undo the last action (multiple undoes possible).
Redo - Repeat the last action (multiple repeats possible).
Select All (Ctrl+A) - Selects all code. You can use the standard Windows key commands to copy the code with "Ctrl+C" and then paste with "Ctrl+V", e.g. into a text editor.
To display HTML or JS code, simply enter it in the HTML editor and click on
Show Browser.
Search and Replace
For editing the code, the
Find group in the toolbar is available.
- Click on Find to enter a search term.
- Click on Find Again to jump to the next appearance of the search term.
- With Replace you can replace one or all appearances of a code text with another text.
- For very long scripts, you can use Goto Line to jump to a code line.
JavaScript in the HTML Editor
JavaScript offers you a connection to the inner workings of Tradesignal. With JS and a number of interface commands it is possible to control various functions of Tradesignal. Here a list of possible script commands:
TradeSignal
class TSEPublic
GetSavedWorkspaces() : TSEWorkspaceCollection
GetOpenWorkspaces() : TSEWorkspaceCollection
GetSelectedWorkspace() : TSEWorkspace
GetLastSelectedWorkspace() : TSEWorkspace
GetTotalMemory() : int
GetUserTimeZone() : string
GetVersion() : string
Create( whatToCreate : string, parameters : string ) : TSEDocument
CreateNewChart( symbol : string ) : TSEDocument
CreateNewChartEx(symbol : string, parameters : string) : TSEDocument
CreateNewMarketProfile( symbol : string ) : TSEDocument
CreateNewInstantIndicator( equillaCode : string ) : TSEDocument
CreateNewInstantIndicatorSeries( equillaCode : string ) : TSEDocument
CreateNewBrowser( url : string ) : TSEDocument
CreateNewMarketScanner( symbol : string ) : TSEDocument
CreateNewWorkspace() : TSEWorkspace
SetMixinDataSessionKey(url : string, key : string)
ShowHelp()
ShowEquillaHelp()
class TSEWorkspaceCollection
ItemAt( index : int ) : TSEWorkspace
GetLength() : int
Find( workspaceName : string ) : TSEWorkspace
class TSEWorkspace
GetTitle() : string
IsOpen() : bool
IsRecent() : bool
WasPreviouslyOpen() : bool
Open() : bool
Close( suppressDialogs : bool ) : bool
Create( whatToCreate : string, parameters : string ) : bool
Select() : bool
GetDocuments() : TSEDocumentCollection
GetSelectedDocument() : TSEDocument
class TSEDocumentCollection
ItemAt( index : int ) : TSEDocument
GetLength() : int
Find( wokspaceName : string ) : TSEDocument
class TSEDocument
GetDocumentTitle() : string
GetSelectedItemTitle() : string
GetDocumentType() : string
Select() : bool
Replace( itemToReplaceSelectedItem : string ) : bool
ReplaceAll( itemToReplaceAllCurrentItems : string ) : bool
Add( itemToAdd : string ) : bool
AddEx( itemToAdd : string, parameters : string) : bool
Set( propertyName : string, value : string ) : bool
SetAll (propertyName : string, value : string) : bool
Eval( equillaScript : string ) : bool
EvalSeries( equillaScript : string ) : bool
Close() : bool
Example: Listing all available workspaces with JavaScript
In this tutorial we will design a simple JavaScript that will display a list of all available workspaces.
Step 1: Start a HTML page and enter the page frame
Open a new, empty workspace. Then open the button menu
Layout and select the entry
Insert HTML Element. An empty HTML editor opens. For a correct page frame, please enter the following source code:
<html>
<head>
<title>List Workspaces</title>
</head>
<body>
</body>
</html>
Step 2: Adding the list element and the scripting area
Now copy the following line between the
Body Tags:
<select name="Workspaces" style="position:absolute; left:10px; top:20px; width:150px" >
</select>
The line includes the HTML code for the list with position and width values. When you now click on
Show Browser in the toolbar, you can see the new page with an empty list. Click on
Show Editor to edit the code again.
Now we can define the area for the JavaScript source code. Copy the following code into the line below the list. The code assigns the collection of all saved workspaces to a variable.
<script language="JavaScript" type="text/javascript">
var savedCollection = TradeSignal.GetSavedWorkspaces();
var maxIter = savedCollection.GetLength();
</script>
Step 3: Designing and testing the JavaScript
 |
Final script in the editor |
In the upper part we have set up a HTML page and the basis for a JavaScript. The list of workspaces was copied into a variable. To be able to read out the list later, we need the number of included elements. This value is also saved as a variable.
In the following script, a reference to the list is set, so that we can add a list entry for every workspace in the collection. To read out the collection, we need a loop that runs over all workspaces. Add the following lines in the script area:
var listRef = document.getElementById("Workspaces");
for( iter = 0; iter < maxIter; iter++ )
{
var wsName = savedCollection.ItemAt(iter).GetTitle();
var listEntry = new Option(wsName, iter );
listRef.options[listRef.options.length] = listEntry;
}
The complete script
Here you can see the complete code of the script.
<html>
<head>
<title>List Workspaces</title>
</head>
<body>
<select name="Workspaces" style="position:absolute; left:10px; top:20px; width:150px" >
<script language="JavaScript" type="text/javascript">
var savedCollection = TradeSignal.GetSavedWorkspaces();
var maxIter = savedCollection.GetLength();
var listRef = document.getElementById("Workspaces");
for( iter = 0; iter < maxIter; iter++ )
{
var wsName = savedCollection.ItemAt(iter).GetTitle();
var listEntry = new Option(wsName, iter );
listRef.options[listRef.options.length] = listEntry;
}
</script>
</select>
</body>
</html>
To view the result, click on
Show Browser again. A list of all workspaces appears.
Note that you cannot save the HTML script itself, only the workspace in which it was created.