AlgoStudio is an integral module of the Protrader platform and is run as a separate process which allows it to operate independently from the main application although the module permits users to open several windows simultaneously.
The key features of AlgoStudio include
To add a strategy, go to script editor, select the strategy and double click
AlgoStudio is a fully customizable development tool. Users can configure the work environment according to their preferences. All panels appearing in AlgoStudio can be added, removed or moved to a different location. The panels are attached by default but can be moved using the following button.
To begin writing source code for a new indicator, strategy (Advisor), script (Macros) or Library, open AlgoStudio and click on the button located in the toolbar ribbon. The following window will throw up. Select C# as the programming language and choose from the existing options that include Indicator, Trading system, Macros and Custom column. Click the “Next” button to continue
Users can choose the
As a developer, you can add custom columns to any information panel in the terminal, using codes.
Custom columns can be created in two ways
1. Open AlgoStudio and click on the highlighted button located in the main menu of the window.
The following window will show up. Select “Custom column” and choose the panel to be customized from the drop-down list.
2. Go to settings in any of the panels in the Desktop and select the 'Columns' tab. Click on the button located in the header of the settings window.
Input the name of the Custom column in the field "Header text" and click "New" to run AlgoStudio in order to create a new script for Custom column. Please refer to C# language documentation for more information.
For additional information on creating custom columns, click HERE
AlgoStudio features a Dictionary tool which allows to view brief descriptions and all classes and methods in C# that can be used to write source code.
To open the Dictionary panel, click the button located in the toolbar ribbon. On the right side of the panel, users can find detailed information on the selected variable. Users can also search for variables from the search field which is present under the panel header.
Protrader has reference database for a large number of functions used in coding various parameters. Users can view the database HERE
The Script navigator is a tool which shows all modules created by a user. Pre-existing code or fragments of source code can be uploaded to AlgoStudio from any source file. To upload an existing source code, click the button and choose the file. The drop- down arrow beside the button will show a list of source code files that were previously opened in the AlgoStudio editor. Source codes can also be uploaded to the editor with help of the Script navigator panel by clicking on the button.
Two directories will be displayed in the panel-
The first is the installation directory: C:\Users\Username\AppData\Roaming\'Folder with terminal'.
The second directory titled “My scripts” is where all modules will be saved by default. There is also a folder bin where all compiled versions of the files are saved.
Please note that all scripts are stored in the directory Macroses: C:\Users\ User name\Documents\'Folder with terminal'.
The source code editor in AlgoStudio is a fully professional tool to facilitate the writing of source codes. It features syntax highlighting and supports Intellisense technology. Place the cursor in the required area and press Ctrl+ Space to open the Intellisense menu.
The top end of the Editor panel features a help toolbar for easy searching, filtering, inserting comments and undoing work. The initial buttons in the toolbar are “Undo” and “Redo” denoted by the symbols correspondingly. The Undo and Redo buttons allow users to reverse step by step changes or move forward.
The next available button “Find”, allows users to search for a specific phrase in the source code or replace an existing phrase with another phrase. Click on the button to search
Users can also replace phrases by clicking the “Replace” button either from the Editor toolbar or from the dropdown in the “Find and Replace” window.
The “Comment” and “Uncomment” buttons allows users to add or remove comments from the code. Use the buttons to carry out this operation.
There is also an “Errors control box” under the main source code window which can be accessed by clicking
The other feature of the Editor toolbar is a dropdown list of methods, functions, properties, variables, and fields which can be found in the source code. The list was designed to navigate codes. Selecting from this menu places the cursor immediately at the corresponding place in the code. To open the list, click on the button.
To select “Editing types” click on the button in the main menu. There are three modes for users to choose from
This mode of compilation is used as Product ready mode. If the source code is free from errors and ready for application, users can select this mode.
This mode is used for source code optimization. If any function is used more than once in the source code, then the Profiler panel will show the number, code line where this function was invoked and the exact processing time of this function.
This mode of compilation is used for debugging source code. It is very important to identify errors before script usage. Users can debug C# code.
Debug mode can be selected from the main Panel button, by hitting the Hotkey ‘F5’ or by using any of the following three buttons.
Step info (F11) – allows going through all code lines independently of breakpoints.
Step over (F10) – allows going over certain program steps.
Step out (Shift+F11) –running the script until breakpoint.
To begin debugging the source code, users should first set breakpoints. A breakpoint can be set by clicking the left mouse button between the code line numbers and the edge of the source code editor window or by
using menu Run> Toggle breakpoint. After placing the breakpoint, it will be visible in the margin as a red circle. User can remove all breakpoints from the source code using the menu, ‘Run> Clear all breakpoints.’
The properties window shows all information about a selected module and has five sections:
Script info- Shows general information about the selected module. This information is specified during the creation of any algorithm.
Script inputs- Shows settings of the external script variables.
Back testing setup- Gives all parameters of backtests.
Optimization setup- Gives all parameters for optimizing strategies (Expert Advisor’s).
Walk forward setup- Shows time settings for this type of optimization. This setup type appears when users choose the Optimization tab> Walk forward> Properties.
This backtester tool can be configured just like any other panel in the terminal by making changes in the backtesting setup under properties.
The context menu can be invoked by right- clicking anywhere in the chart area
The Output tool is used to show system communication (Ex: errors) during compilation or messages from the strategy agent such as the Expert advisor during backtesting. To open the output panel, click on the button
Watch tool is used to debug source codes. To begin, users are required to set breakpoints, select variables to be checked and add them to the Watch panel. In order to do this, place the mouse over the variable to add to Watch then open context menu and select Add watch from the menu. The selected variable will appear in the Watch window
Select the Debug mode and run debugging (F5).
If tables are used in the Watch tool, users can click on View button to see the value of an array.
Through the Context menu of the panel, users can
They are used to optimize source code. It gives users a visual representation of how functions are run through the Backtester and the number of times a function was invoked. Profiler shows the exact working time of the function in milliseconds and percent as well as the function type. To launch Profiler, click on the button.
The Chart tab typically shows a graph with all open/ closed positions during the test run and also all automatic indicators that were used during the test.
Indicators are shown in the bottom of Chart panel and can be hidden by clicking on the button placed below the chart.
The Trades history tab shows all transactions that were carried out during backtesting.
Users can view the following columns from this tab
Users can also use standard functions mentioned below from the context menu of the panel
This tab shows the orders/positions that were opened during backtesting.
The performance panel contains trade statistics, P/L charts, data related to trade population and drawdowns. All information from the panel is divided into the following three tabs:
Here, users can see the entire information about trading results and their capital. Firstly, all operations are considered together (Total tab) but they can also be viewed independently based on the operation side (Buy and Sell tabs). The section allows users to view changes in the balance and P/L graphically. The cumulative P/L chart in the OPERATIONS MODE displays how a user’s balance was altered while trading for specific time periods.
Cumulative P/L chart in the TRADES AND FEES mode displays how user’s Net P/L was altered for trade operations performed for specific time periods.
The section 'Total' is displayed by default in all the tabs. Volume bars are plotted on the chart regardless of the selected horizontal scale type (Operations, Trades & Fees, Days, etc.) and is displayed in lots.
The horizontal scale allows plotting the P/L chart by operations or by hours/days/months. If the section 'hours/days/months' are selected, then all operations are aggregated by hours/days/months.
Aggregated P/L charts display Gross and Net P/L for selected 'aggregation' interval. In order to enable aggregated mode, use the button 'Aggregate'.
Aggregation interval allows aggregating P/L chart according to the required periods. Ex: Months, days and hours. The charts can be also displayed based on the trading side or set to “Total.”
Trades population is a combination of winning/losing trades and trades populated by symbol’s.
Winning/losing trades section displays data by Total number of trades for a certain period and can be viewed separately for Buy and Sell trades.
Each tab contains the following data:
Trades population consists of two charts:
Pie chart- Illustrates the number of completed trades for individual symbol’s and shows their values in % of total trades
Profitable chart- Selected symbol from the pie chart.
When a user clicks on a certain sector of the pie chart, the corresponding line in the symbol list is highlighted and the corresponding profitable chart by this symbol is displayed. Likewise, when a user clicks on the row from the symbol list, the corresponding sector of the pie chart is highlighted and the corresponding profitable chart by this symbol is displayed. Profitable chart displays Cumulative P/L and trade volumes for the selected symbol within the period of strategy work.
The last tab of the Performance panel is the Drawdown chart. The chart shows the graphical distribution of drawdowns built trade by trade. Trade volumes, shown in lots are also displayed on the chart.
In addition, the tab displays three indicators
Maximal drawdown – Highest difference between one of the local upper extremums of the balance chart and the following lower extremums.
Absolute drawdown – Difference between the current capital and the current local upper extremum.
Average drawdown – Arithmetic average of all drawdowns over a given time period.
Logs tab shows information about the backtesting process and errors if there are any. They can be cleared or copied through the context menu.
The positions history tab shows the trading history of positions during backtesting. The backtesting range can be set in Backtesting setup >> Range. Column headers can be customized by right- clicking on the existing headers and ticking the ones to be displayed.
There are two ways of backtesting strategies on AlgoStudio
To go to the Backtesting mode, click on the button. The Backtesting type can be selected from the drop-down menu
Quick backtesting allows users to rapidly test strategies on historical data without including graph visualization during backtesting. Here, the chart with all details about open and closed positions will only appear after the backtesting is completed.
Visualize backtesting allows users to view actual trading visuals on the chart during the backtesting process.
Before beginning backtesting, users can setup all the required parameters from the Properties panel
To include more than one symbol to backtest data, click on “Additional data” and add the required symbols
After successfully testing a strategy against historical data, users can save the source code. To do this, click on the buttons to SAVE, SAVE AS and SAVE ALL correspondingly. To export strategies, click on the button from the AlgoStudio toolbar or from the main menu and select “Export Script Settings” to export
Users can also import strategies by clicking the button from the AlgoStudio toolbar. Additionally, if users have compiled an indicator or strategy in AlgoStudio but do not have the source code for it, AlgoStudio will still permit the user to run the code and test historical data.
To do this, select the recompiled file with the strategy and upload it to AlgoStudio. Then simply proceed to testing as if it were an indicator or a strategy with source code.
The last stage of testing strategies in AlgoStudio involves optimization of the created module. Users can do this using the Optimization panel. To open the panel, click on the button under the main header in AlgoStudio. Users can select any of the two options from the optimization panel using the drop-down menu
It is the simplest way to carry out optimization by using the whole range of data for optimization purposes. After completing the process, user’s will view the table and the results of the optimization process.
Walk forward is a type of step-optimization where the entire range is split into In-Sample and Out-of-sample periods. The process involves testing In-sample periods with Out-of-sample by following the same procedure used to generate In-sample optimization. This type of optimization is used to get rid of script “addiction” to a particular behaviour of an instrument which generally arises during the optimization period.
By clicking the Optimization panel, users can access and setup optimization parameters such as Strategy variables, targets and optimization limits.
Here, users can select all strategy variables which can be used as subjects of optimization. Minimum and maximum values can be set for each selected variable.
It is necessary to set Target functions for modules. These functions can be set for individual modules separately. Target functions comprise off-
Finally, users can select optimization limits with which the strategy will be optimized
The optimization process and the results are visible in the Optimization result table. Here, users can find all optimization results and choose the best strategy variables/ values for future requirements.
Optimization results can be exported/ imported to/ from a .XML file for further analysis by right- clicking in the optimization window and selecting “Results” from the context menu. Likewise, the results can also be exported to multiple sources by choosing “Export” in the context menu.
The walk forward result table starts from the row with the best version of first-step optimization and the backtesting row for this version. All other rows show information for Optimization and Backtesting. Walk forward optimization stops when the range ends.
The results of walk forward can also be exported/ imported to/ from a .XML file
Optimization settings and results can also be viewed graphically by clicking on the “Chart icon.” Select parameters for X and Y axis to see the dependence between them. Users can also select the Optimization index and different kinds of chart types.
Database comprises of instrument settings to test strategies accurately which can eventually be updated on request. It is an integral part of AlgoStudio and contains historical data loaded from the server.
When a user runs AlgoStudio for the first time, the database created from the PFSOFT demo server will run by default. If there is no existing databases, users will have to create it from Database>> Create.
For more information on the process to create database, click HERE
To familiarise with the components of a database, go to Database >> View.
Database view tab consists of three sections: Symbols, Assets and History.
The ‘Symbols’ section contains the list of all the available symbols of scrips. Choose any symbol from the list to view its parameters.
Likewise, the ‘Assets’ section contains all assets that are currently available for trading and their parameters.
The last section is ‘History.’ It displays historical data for tradable instruments. The data can be used to test scripts and construct indicators.
To run the script in AlgoStudio, users should choose the symbol and its parameters according to the existing history in the Properties tab. If the symbol and its parameters are chosen correctly, then the symbol’s chart will be displayed in the Backtester panel which can be used to run the script.
If there are no active databases while opening AlgoStudio, the system will indicate the same to the user to create a new database or open an existing one.
If a user is also logging in to AlgoStudio for the first time, a new database has to be created.
To create a new database, go to Database >> Create
Choose any of existing connections in the Connection field or use a new one. Users should also specify the name and path for the database which will be created in the corresponding fields. After filling out all the fields, click the 'Create' button. AlgoStudio will connect to the server and load all the required data excluding historical data.
To load historical data, select the scrips, the required parameters to be downloaded and click on 'Create.’ The historical data for all the selected parameters will be applied to the new database.
To run scripts on the trading platform, assign hotkeys in the “Main terminal settings.”
Go to Environment >> Settings >> Hotkeys.
In the Hotkey section, click on the button and the following drop-down menu will open up. Here, users can choose either of the two types of macro assignments: Run macros and Quick run macros.
If “Run macros” is selected and a macro is initiated by the hotkey, users will be able to change the default parameters for the script.
In “Quick run macros,” the parameters are set when the hotkey is hit and they can’t be changed during script execution.
After selecting one of the functions, the “Scripts lookup” will open up and users can select scripts to be added to the hotkeys list. If a user chooses “Quick run macros,” all strategy parameters should also be selected from the properties window.