Strategy TestingWhy Is It Essential To Test My Strategy?
How can we invest our precious capital without knowing whether our strategy is really effective? How can you trade without knowing which results your strategy has delivered in the past?
In order to professionally and authoritatively participate in financial markets trading with real money, the trader needs a strategy that is at least profitable in back-tests. This method of strategy validation is useful in two ways: psychological and professional.
The former allows us to approach the market with peace of mind, being confident that the strategy we are going to deploy proves to be effective. From a professional perspective it allows us to approach the market in the best way where nothing is left to chance, but everything is intentionally studied and evaluated based on real numbers.
In order to validate a strategy and make it perform effectively in a live market, it needs to pass through a rigorous process of testing. The first part of this process is a back-test stage, followed by an optimization stage.
Back-testing is finding out through a simulation, what the results of our strategy would have been if we had traded in the past.
These tests may be carried out in two ways: Using a manual/discretionary approach or by automatic back-tests.
The discretionary method does not allow us to get consistent tests since the result is a graphic-visual test of our own trading idea. The first approach is mainly carried out "by eye" i.e. visually going through the charts, and it is easier for all to carry out. This visual method of back test does not provide a reliable feedback if there is insufficient out of sample data in the medium to long-term, for the chosen strategy. The test period depends on the time-frame: If it is short for example 5 minutes, 12 months of data will be sufficient for the search. For a 30 minutes time-frame for example, 2 to 3 years of history data would suffice. A visual search for such a long period is practically impossible, which therefore limits the trader to a shorter and consequently less reliable conclusion on the strategy.
The automatic method is by far more reliable than the first. Back-tests are carried out by special trading software which is able to analyze historical information and produce immediate results on the chosen period. Obviously, it is important to download historical price data reliable for the period you want to analyze.
Many people use the popular and complimentary MetaTrader software to perform such operations. Most traders forget that historical prices on the same (which are found in it by such brokers initially linked to it) MetaTrader platform are not reliable, therefore leads to a need to upload real ticks from a trusted source, such as "tick story". If it is your intention to follow this second and difficult path, our advice is to look around for any sector expert professional to trust.
If the strategy produced positive results, the next step is to figure out the best performance of the strategy by slightly modifying all or some of the input parameters of our strategy.
For example we can optimize the following if they are programed as input parameters in our strategy: Try to select certain time slots of the day only; change the time-frame; stop loss/take profit ratio; indicators values etc. etc.
Depending on how we want to improve and deepen our optimization, this stage could need extra time, and in some case more computational power. Running the tests in a discretionary manner on the screen will become an almost unbearable effort. Automating this process using software leads to both efficient and effective results. This is also because the MetaTrader software comes shipped with a special function for optimizations which lets you enter all the various inputs to be optimized, testing them in thousands of combinations, all automatically.
Haven selected the most profitable combination, before deploying it live with real money it must be tested on a demo account for a short period of time.
After extensive testing on the previous phases, the trader usually wants to start up and see the economic and practical results of his effort and he thinks that the forward test phase can be ignored. This error could be fatal as it often happens that a tested strategy with excellent results on the historical data may not perform satisfactorily when tested live. The following are the most common:
- Historic data of our tests were not as reliable as we supposed.
- Due to the complexity of the test, “hidden errors”” may exist in the calculations.
- Our broker platform is not so accurate in executing trade entry or exit signals as we calculated in our tests.
the Analyst's answerJean Grossett - Financial analyst
Carrying out back tests using the MetaTrader strategy tester can be very computationally intensive, especially when optimizing multiple parameters. In some cases, there might be need to rent extra computing power to speed up things.
Validating the reliability of data is very important in establishing the efficiency of a strategy. Strategies based on entering at the candle open, often suffer less problems with having tick data.
Data science techniques could also be applicable to strategy development. I will advise that the time series data, which includes the open, high, low, close, and preferential indicator data, should be exported into comma separated format (.csv). This can later be read into excel, or Python’s Pandas DataFrames. Further data cleaning technique should be carried out to avoid inconsistencies. After this stage is completed, the researcher/analyst should now embark on a stage called feature engineering. A popular method of feature engineering is using a time shift mechanism to achieve the features, so that a classification algorithm can be iterated over the features.
Popular machine learning algorithms for classification are decision trees, genetic programming algorithms, and neural networks etc.