The Backtesting dashboard is a feature-rich interface that enables you to code, modify and backtest potential trading strategies.
Tabs located at the top of the page provide access to the following:
- a C# development console
- Backtesting history
- Exchange/trading options
- an E-Chart that plots price, indicator data, and trade events
When you are satisfied with your algorithm's execution and performance you can publish it as either a private or open source strategy - also done from the Backtesting interface.
[minerva info] After the Private Beta testing phase, charting will be migrated to embedded TradingView charts.
Below are descriptions of the most important components to get you started.
When starting a "New Backtest" you will be asked to select either a sample strategy or a minimal code template. This will serve as the basis for your strategy development. Next you will be presented with the development console containing the C# code of the strategy template you selected.
To the right of the console is a panel that, initially, displays the backtest Launcher and strategy Parameters. Here you can specify an exchange, instrument, candle timeframe, as well as start and end dates for your backtest.
To compile your code and backtest the trading strategy click the green "Run Backtest" button in the Launcher.
Most strategies have parameters and these, plus any additional parameters you might define, are displayed below the Launcher. Strategy parameters can be changed in this area, prior to running the next backtest.
[mkb-info] The Machina Engine will only run a new backtest after you have either made changes to the code, or have changed at least one value in a Parameter input. If you do not make any changes and click "Run Backtest" then the Engine will simply display the results of the last successful backtest.[/mkb-info]
To assist you during the process of developing your code the console window offers some facilities:
Syntax errors and pre-compiler errors in your code are reported at the top of the window, in place of your strategy's name. The error message will tell you the line number and error type. Additionally, the full error message (and multiple error messages, if they occur) will be listed in an "Errors" tab, accessible at the top of the window.
The error type and description are useful for finding solutions online or when asking for help in the MachinaTrader support forum.
A "Help" tab can be accessed at the top of the panel. The Help utility is searchable and contains a list of all exposed classes and methods in the Machina Engine.
If your code compiles successfully, then "Run Backtest" will open a "Results Window" and display the progress of the backtest. This can take a few seconds or up to several minutes depending on the complexity of your algorithm.
Initially, the Engine will retrieve the complete set of candles for the period (start to end dates) during which you are applying your backtest. Once all candles have been retrieved, the price chart will draw and backtest progress will be displayed in the area above the chart.
After the backtest has run to completion, various tabs below the chart provide useful information, such as:
- Backtest statistics
- Order history for the period
- Algorithm logs
- Trade history
[mkb-tip] If your backtest yields unexpected results (or no results at all) the Logs tab will give you insight into possible causes and errors. For example, if a code runtime error occurs it will usually be the last message in the log.[/mkb-tip]
The History window lists your previously completed backtests in chronological order. You can also sort them by name, timeframe, profitability, etc.
The last 50 successful backtests are listed for review and inspection. You can access any of these - with the code, configuration and options as they were for each backtest - by clicking on the magnifying glass button.
You will be able to view the backtest results and you may choose to edit and re-run the backtest from that previous state.
[mkb-info] Be aware that only the last 50 completed backtests are stored. To avoid losing previous successful backtests (along with their code and configuration), be sure to either publish a desired backtest as a strategy, or delete irrelevant backtests from the history list via the pink "Delete" button.[/mkb-info]