Backtesting Description. Possibilities and limitations
Hey there, Protraders!
In one of the previous articles we’ve reviewed settings of the Backtester and Optimizer which are available for users of the Protrader terminal. In the current article we will focus more on the features and limitations of AlgoStudio development environment in order to avoid errors and false conclusions when working with it.
Let’s describe the main options available to the users:
- The ability to create indicators, strategies (Expert advisors), scripts (Macros) and custom columns;
- Simultaneous support for two programming languages: MQL4 and C#;
- The History data manager tool for importing data from different sources;
- The capability to perform backtesting on custom historical data or data provided by a broker;
- Backtesting of single symbols or multiple symbols simultaneously. Users have the opportunity to backtest their own securities portfolio;
- The possibility to backtest multiple time intervals (support for non-standard timeframes such as M7, H3, D5, etc.);
- The possibility to backtest all chart types available on the Protrader trading platform including the time-independent (Renko, 3 Line break, Kagi, Price range, etc.);
- Strategy testing in ticks, minutes, or daily data;
- The possibility to test strategies at Bid, Ask, and Trade prices.
- Testing visualization;
- Two emulation types: one position or multiple positions;
- Capability to use functions that provide access to Level II;
- Powerful and flexible optimization tool with lots of options;
- Plain text and graphic reports;
- Editor with IntelliSense support;
- The ability to import and export the strategy parameters during backtesting.
Let’s move to the objective description of AlgoStudio development environment features.
Swap, spread, dimension and multiplicity of lots, margin requirements are taken from the settings of traded symbols. In case of custom symbols this data can be changed. To provide this, when creating a custom symbol in the “History data manager” user needs to choose interested symbol in “Setup” window, and determine the above symbol settings.
All parameters of the traded symbol including margin requirements, swaps etc. are modeled during the backtesting. Before the beginning of testing it is necessary to determine some additional test settings in the “Properties - > Backtesting setup”. Here user can define the modeling data type, modeling scheme, “Stop out” value, type and size of the commission payments, leverage and even the latency of the trading operations which will bring testing closer to the real trading.
Upon reaching the “Stop out” the backtesting ends.
In general case, orders are opened and closed without a slippage. “Latency” parameter can be used for approximation of testing to the real trading. Using this parameter we can indicate latency in milliseconds from sending the open order before its execution.
Modeling of the quotes in AlgoStudio
Four quotes modeling schemes are available for AlgoStudio users:
- 1 min – Close;
- 1 min – Open;
- 1 min – O H L C.
In case of selection the first modeling scheme – “Tick”, the Backtester will sequentially model the values of all ticks which are included in the simulated timeframe. This modeling scheme allows getting the maximum possible accuracy of the historical quotes modeling. At the same time it is the most resource-intensive and requires a high quality of tick history. This modeling schemeisperfectforshort-termtraders. Trading strategies which use high-frequency operations are extremely sensitive to the quality of quotes modeling and can be estimated with sufficient accuracy, using only tick quotes.
Scheme “1 min O H L C” is the second by the accuracy among the modeling schemes. When using this scheme the minimum allowable time period is minute. In turn every minute is modeled by four price values:
- Open price (“Open”);
- Maximum price (“High”);
- Minimum price (“Low”);
- Close price (“Close”).
If price information within the minute time interval is important for the trading strategy then it is important to hold testing on the tick history. If the strategy is not a high-frequency then the modeling on the scheme “1 min O H L C” will provide a sufficiently high degree of modeling accuracy. Modeling of 5 min timeframe on the scheme “1 min O H L C” is shown on the next screen. Each five-minute bar will consist of 20 price values of minute bars (Open, High, Low, and Close of each minute bar).
Modeling schemes “1 min – Close” and “1 min – Open” are the rudest, because the close price or the open price of minute bar can be used here as the minimum price change. This means that only ¼ of all price information about the minute bar is available. But it is not so important for higher timeframes modeling. For example, a five minute bar in this case, will be composed of five open/close prices.
Timeframes and multicurrency in AlgoStudio
Typically, high-level trading strategies use a large amount of information from different timeframes. (As an example, the trading strategy of 3 screens A. Elder). With the help of Backtester in AlgoStudio, the information about all timeframes is available for the trader and doesn’t matter on which timeframe the testing is performed. Thus, the price information and indicators data from all the available timeframes can be used when testing the strategy on any timeframe. Backtester immediately simulates all available timeframes and every new price tick changes the information on all timeframes.
The large class of trading strategies which use information about several trading symbols also exists. As an example, "steam trading" or "basket trading". The information about all loaded trading symbols is available for user when using the Backtester which is a part of AlgoStudio.
The problem of "peeping into the future"
Most traders when using personal software for testing of the trading strategies faced with the problem of "peeping into the future". This problem occurs in case when the historical data on which testing is performed is entirely generated before the testing process. Then, the Backtester passes consecutively by generated data and the logic error is possible upon which the trading algorithm uses data which relatively to the current moment are in the future. This produces inauthentic results of the trading algorithm work. The “future” data doesn’t exist for AlgoStudio backtester, the price information is generated in real time, the same as upon real trading. This approach avoids the problem of "peeping into the future".
In conclusion, it can be noted that AlgoStudio as a full-fledged environment of creating, testing and optimization of automatized trading systems has broad functionality that meets traders’ modern requirements to the software for trading.