Scripting
Last updated
Last updated
Agena indicator Help Guide provides extensive information about indicators integrated in AgenaTrader:
Description of indicators and oscillators;
Meaning of parameters;
Use and interpretation of signals;
Syntax and code examples;
References.
AgenaTrader's programming environment is comparable to Visual Studio. It enables you to:
navigate the programming workspace using toolbars,
handle multiple components at the same time via the editor (top tab bar),
use the IntelliSense® functionality,
view a list of errors at the bottom of the screen.
Icon
Function
Loads existing self-programmed indicators/strategies to the workspace
Saves source code changes
Cuts marked source code
Copies marked source code
Pastes copied / cut source code
Enables comments on marked source code parts
Uncomments the selected lines
Cancels previous action(s)
Repeats cancelled action(s)
Opens output window
Opens reference popup
Compiles sources
Searches for a text within source code
Find/Replace
Opens list of errors
Deletes file
Microsoft provides a complimentary version known as Visual Studio Community Edition, which is highly suitable for developing AgenaScript code.
Download: Latest Version of Visual Studio Download: Older Versions of Visual Studio
Supported Versions: • Windows 10: VS2017, VS2019, and VS2022 (latest builds/updates)
• Windows 11: VS2022 only (latest builds/updates)
• Please note that VS2015 and older are not supported by Microsoft anymore hence why we will not support either
This article was created by http://script-trading.com.
AgenaTrader provides its proprietary script editor, which is utilized for AgenaScript development.
This editor serves as an efficient tool for making swift adjustments to a few lines of code or reviewing AgenaScript. For most other purposes, it is crucial to use Microsoft's Visual Studio development environment. Visual Studio offers a comprehensive and dependable solution, proving its efficacy across multiple facets of software development, including AgenaScript and C#
The most important advantages are:
Debugging
Code Completion
Syntax checking
In addition, there is a multitude of further features that make developing easier for you.
You can download the free “Visual Studio Community” edition at https://www.visualstudio.com/downloads.
Please note that the download and the installation of the software take about 60 minutes!
As of AgenaTrader 2.0, it is mandatory to utilize "Visual Studio Community 2017" or later versions, due to the implementation of .NET version 4.6. Please refer to the list of compatible Visual Studio versions provided above.
Once you have successfully installed Visual Studio, you can link it to AgenaTrader using the Global Configuration setting shown below. From now on, all AgenaScript files will automatically be opened with Visual Studio, and the debugger will also automatically be linked to AgenaTrader.
Global Configuration setting for Visual Studio
You can now conveniently develop, test and debug your AgenaScripts in Visual Studio.
This article was created by http://script-trading.com.
Select the Strategy Handlings-> Scripting and then Indicator -> New or Edit menu items to program new indicators or make changes to existing indicators.
Should you wish to change/modify an existing indicator, select the Edit menu item to open the following Indicators dialog window:
The buttons inside this window have the following functions:
Click the Edit button or double-click on the entry to open the scripting window for the selected indicator.
Click the Delete button to remove the selected indicator.
Click the Compile button to compile all indicators, conditions, strategies and alert handlers. If you delete an indicator, the system will only accept changes after you have clicked the Compile button.
After selecting the New->Create menu item for creating a new indicator you will receive a navigation popup with the option to either create a new indicator or import an indicator from a different trading platform:
Step 1. Enter the name
Chart-Panel: if this is checked the indicator will be displayed in the charting panel.
Indicator-Panel: if this checked the indicator will be displayed beneath the chart.
Step 2. Define parameters.
Step 3. Define the Plots-Outputs for visualization of the indicator.
Step 4. Define Level-Lines with the fixed threshold values (if necessary).
Step 5. Begin writing the indicator-specific program code.
The compile function is availalbe via Strategy Handling- > Scripting -> Compile
After Indicator would be available in indicator list
Select from the main menu Strategy Handling-> Scripting followed by Condition -> New or Edit items to create new or modify existing conditions.
If you wish to edit the existing condition, select the Edit submenu. You will see the following dialog box.
The buttons inside this window have the following functions:
Click the Edit button or double-click on the entry to open the programming window for the selected condition.
Click the Delete button to remove the selected conditions.
Click the Compile button to compile all indicators, conditions, strategies and alert handlers. If you delete a condition, the system will only accept changes after you have clicked the Compile button.
Step 1. Enter the name
Step 2. Define input parameters
Step 3. Select the condition type: entry, stop or target. This will determine where the condition will appear in the SetupBuilder (EntryEscort, StopEscort or TargetEscort respectively).
Additionally, you can specify the line and color for a condition
Entry: tba
Stop occurred: defines the color of the signal fluctuations ("spikes") within the indicator panel; price defines the color within the chart.
Target: tba
Step 4. Begin programming the condition-specific code.
Select from the main menu Strategy Handling-> Scripting and then Strategy -> New or Edit to program new or edit the existing strategy.
If you wish to edit the existing strategy, select the Edit submenu. You will see the following dialog box:
The buttons inside this window have the following functions:
Click the Edit button or double-click on the entry to open the programming window for the selected strategy.
Click the Delete button to remove the selected strategies.
Click the Compile button to compile all indicators, conditions, strategies and alert handlers. If you delete a strategy, the system will only accept changes after you have clicked the Compile button.
After selecting the New->Createmenu item for creating a new strategy you will receive a navigation popup with the option to either create a new strategy or import a strategy from a different trading platform:
Step 1. Enter the name
Step 2. Define input parameters.
Step 3. Begin programming the strategy-specific code.
AgenaTrader's extensive functionalities allow you to code custom price and time alerts within a single (or multiple) self-programmed alert handler(s). Programming in AgenaTrader is based on the Microsoft C#/.net language which enables you to control the system environment and use/code features such as email, SMS, blog entries etc.
Select from the main menu Strategy Handling-> Scripting following by Alert Handler -> New or Edit items to programm new or edit existing alerts.
For example, in the Time alert tab you can select an entry reason for an alert.
Once your price or time alert is triggered, all existing alerts will be opened. You will see the reason for the alert inside this window and can terminate the current alert.
If you wish to edit the existing alert handler select the Edit submenu. You will see the following dialog box:
The buttons inside this window have the following functions:
Click the Edit button or double-click on the entry to open the programming window for the selected alert handler.
Click the Delete button to remove the selected alert handler.
Click the Compile button to compile all indicators, conditions, strategies and alert handlers. If you delete an alert handler, the system will only accept changes after you have clicked the Compile button.
Step 1. Enter the name and a short description.
Step 2. Click on the Next button and begin programming the alert-specific code.
A straightforward way to integrate a price or time alert with the Alert Handler is by utilizing the alert reason. For instance, if the alert reason field includes "Send Email," the programmed alert will activate immediately once the alert handler detects this reason.
The output tab displays messages that have been built into self-programmed indicators, strategies, alert handlers, etc. based on the print method.
This tab can also be used for troubleshooting (debugging), but besides this it has no other functionalities.
Right click in the tab and select the Clear option to delete all entries in the output tab.
Select Strategy Handling-> Scripting following by Scripting references from the menu to load the necessary references for programming or to edit them.
The following window will be opened:
The references can be selected from the top tabs .Net, COM and Browse.
The buttons inside this window have the following functions:
Click the Add button to attach the references to the reference list.
Click the Remove button to delete a reference from the reference list.
Click the OK button to accept the changes.
To integrate self-programmed alert handlers, indicators, conditions, strategies, or conditions compiled from external sources using Signal Builder into AgenaTrader, copy the *.CSV file from Documents/AgenaTrader/UserCode/ into the corresponding subfolder "Scripted alert handlers (indicators, conditions, strategies)" or into the Signal Builder subfolder. Then select Strategy Handling-> Scripting -> Compile to make these available within AgenaTrader.
Directory structure
If the compilation procedure generates errors, this information will appear in a dialog box indicating where the error comes from.
1. Display Error description 2. Display file name. Left click on file name will open file location.
You may use the Visual Studio instead of the internal Script (programming environment) just activate Use Visual Studio checkbox in Global Configuration
In order to solve the issue User should verify conditions scripts and try to compile again.
Select from the main menu Strategy Handling-> Scripting-> Condition ->Edit items to verify condition.
In the following dialog box click the Edit button or double-click on the entry to open the programming window for the selected condition.
In order to solve the issue User should verify indicator scripts and try to compile again.
Select the Strategy Handlings-> Scripting->__Indicator -> Edit to verify indicator.
In the following dialog box click the Edit button or double-click on the entry to open the programming window for the selected indicator.
In order to solve the issue User should verify strategy scripts and try to compile again.
Select from the main menu Strategy Handling-> Scripting -> Strategy -> Edit item to verify condition. strategy.
In the following dialog box click the Edit button or double-click on the entry to open the programming window for the selected strategy.
There are several ways to solve this issue:
Download and install the latest release of AgenaTrader. Download link here
Please go to Strategie Handling->Scripting and click on Compile button
Important! In some cases, User can get compiling errors. Please find details about how to solve this on page Compile Errors
Please check the destination of script files. They should be located: C:\Users\'User_name'\Documents\AgenaTrader\UserCode\ folders: Indicators, Scanns, ScriptedConditions, Strategies or AlertHandlers (depends on Script type). In case you find them in other location, just copy them to the destination folder and click Compile button.
Conditions might disappear because your packages were not updated to the latest version. In this case please select Tools -> Packages -> Imported Packages from the main menu.
In open tab please check version of your add on. Up-to-date button means that your addon is already updated.
Update Available means that you add on version is obsolete.
To update add on please click on Update Available button and in open dialog click button Yes
Step 6. Compile the indicator by pressing the button, after which it will become available.
Step 5. Press the button to make the condition available.
Step 4. Press the button to make the strategy available.
Step 3. Click the button to make the alert handler available (with all other alert handlers). When a price or time alert is triggered, each Alert Handler will search for ways to handle it, if necessary.
Check and correct the condition-specific code. After click Compile (in Visual Studio the Build) button.
Check and correct the indicator-specific code. After click Compile (in Visual Studio the Build) button.
Check and correct the strategy-specific code. After you finished click Compile (in Visual Studio the Build) button.