Any indicator or trading system (paid, free, someone else’s or your own one) can be put on a real account only after a successful test in many ways and in a variety of trading environments. Optimization and competent testing of trading strategies is a necessary process for successful trading.
The development of a trading system requires a lot of time and effort, so empirical methods of parameter selection are no longer used. Today the testing stage became a necessary component of the technical analysis and allows to save capital for real trading.
The process of testing of trading strategies means running the algorithm on historical or simulated data. The test should "see" stock "signals" to generate buy/sell deals and issue the result of "possible" trading – the value of income/loss serves as an indicator of fitness for the real work.
The main objectives and methodology
First of all, you need to check:
- performance indicators laid down in the strategy;
- market models (assets, liquidity, costs, speed, slippage, risk) without real trading;
- optimal parameters by the backtesting results;
- program code for errors of development.
The test should include an analysis of the past/future outlook and issue a report with graphical and quantitative results. You can load the following to the tester:
- history – an array of previously formed bars with the parameters of prices, volumes, indicators: then the pricing "past" and "future" are formed for the analysis in order to assess the "future" reaction on the "past" dynamics;
- price values, simulated by the scenario: then feed the tester with the tick data (history or real) and receive forecast of the movement.
The first method gives the ease, speed, but poor accuracy, while the second strategy behaves in the tester exactly as in real trading. The simulated results can be stored as external files that can be downloaded to the terminal via the menu "File" – "Open offline".
Testing of trading strategies can be performed using:
- any mathematical software (Matlab or MS Excel with plug-ins for stock trading);
- mechanical systems design systems (MetaStock, Wealth-Lab, Omega);
- programming languages Java, Scala or C++/C# to create and test trading robots;
- testers, embedded in the trading platform.
Traditionally, to obtain stable and correct results in the testing process the following is consistently applied:
- A visual test of the system and indicator: requires to review price history over a long period (one or two years). This laborious process is simplified by using testing software for the manual strategies.
- Creating, testing and optimizing the advisor.
- Test for a long history in the automatic mode.
- Test on a demo account or on a cent account: carried out after obtaining stable results for the first two methods – long, but the most accurate calculation. The difference between the demo and cent accounts is only psychological.
In the case of unfavorable results, you should spend time on the selection of expert parameters, and the built-in optimization option is the most suitable mechanism to do so.
Testers of trading strategies
Multicurrency analytical tools to process history loaded from external files. The process iterates through quotes, analyzes the response of the algorithm and opens virtual transactions. It can calculate multiple assets to select a profitable option.
When testing trading strategies, the mode of arbitrary execution delays simulates real network problems at the real execution of orders by dealers. The rendering mode shows the process in real time: the price chart shows all open transactions, setting the following criteria: speed, quality, profits, period, different terms of trading.
The result is given in the form of graphical and statistical information: the percentage of profit/loss, the number of loss-making/profitable trades, indicators of risk factors, the expectation of winning and so forth.
The mechanism of "forward" testing of trading strategies helps get rid of the problems of "fitting" the parameters: history is divided into two parts – one half in used for optimization, and the second portion should confirm the result. Testers can support the methodology of distributed testing, i.e. include additional capacity in the process, including in the cloud.
The main requirements to the settings for testing of trading strategies:
- download data for all periods; range of history is at least 5 years, with the obligatory inclusion of periods with crisis/non-standard dynamics (e.g. 2008-2009);
- if you use a shorter period, it should include periods of trend and flat movements;
- number of simulated transactions is less than 300;
- testing the algorithm on several liquid instruments.
When configuring the test parameters, you should consider the following:
- trading costs (spreads, commissions);
- slippage/delays;
- the effect of assets liquidity (volume dynamics);
- change in market conditions;
- types of trading orders, which are planned to be used (market or limit orders).
While the market order is executed immediately, but its ultimate price for the test is undefined, the limit orders can "wait" for the most suitable price for the deal. Limit order is considered to be passive, as it may be not executed or partially executed, if there are not enough orders. If the behavior of the order book will be simulated inaccurately, the test in real time will show worse results than the baktesting.
Do not forget: before the closing of the sessions, the spread can be increased several times, so don’t carry out short tests with the weekend – you’ll get a lot more costs.
Typically, there are three ways to calculate:
- Using opening prices: the fastest, but the most inaccurate method: most of the strategies at testing for up to 1 year may not even open any transaction;
- Using reference points: the most balanced in terms of accuracy and time, but the credibility of the data obtained is low;
- Using all ticks: the most accurate method, close to reality.
At any testing method over a long period, the results over the last couple of years are the most accurate for both trending and sliding systems.
Do not forget: the implementation of real models and volumes of simulated data for accurate testing requires technical resources, and visualization slows down the process of calculation.
Testing of trading strategies correctly simulates all timeframes, including the volume data. During the test, the indicator calculation is done online.
After completing the test, you can open the chart model with all points of the entry/exit and indicator data, so that if the strategy or indicators have errors, they will show up. Indicator values calculated on history may differ from the values at the time of the test.
Test results can be downloaded in Excel or any other software in the form of a sequence of separated values.
Do not forget: you cannot use an incomplete set of quotations or partial import from various sources in the calculation. The minute quotes must be recalculated automatically and enter the calculation with no time gaps or shifts.
And as a conclusion...
Testing of trading strategies allows to evaluate the correctness and profitability of the algorithm without real trading on the market. Besides money, it saves time – test on quotations for a period of several years can take only a few hours, you can stop it at any moment, change the tool, the conditions of calculation and optimization parameters.
Source: http://dewinforex.com/trading-strategies/testing-of-trading-strategies.html
Post a Comment