Trade the News, but make your FOREX research! Part 3 — EDA, random forest, and parameter selection

Véber István
2 min readMay 14, 2019

--

The news trader FOREX trade system and strategy has lots of parameters. Because of the number of parameters, the combinations of the possible test scenarios easily can reach very large numbers. To test all promising scenarios would require a very very and really very long time. For example, if I want to change only six parameters, all of them with 10 different numbers, would give 1 million combinations, this means 1 million test runs.

If I want to run tests and trade my strategy in this century I need some techniques to reduce the number of test scenarios :) Here I show how I try to find the best parameter combinations for the tests and how I choose the combinations for trade.

Swarm plot of the performance of different parameter combinations

You can read the ipynb of the analysis, model fitting, parameter selections, and the results on Kaggle and Github:

The main idea is to build a sparse grid of parameter combinations in two steps, where the grid is denser in the space where the strategy has a better chance to be in profit. After that, I fit some estimators to this grid where the labels are different metrics of the trade. I use random forest classifiers and regressors because they gave a good fit. Then I build a more dense grid of parameters, where the metrics (for example finished deposit) are estimated by random forest models. With different metrics, I build a score for each grid. This score is proportional to the chance that the parameter combination (or the grid point) will be selected for trade. Obviously, better performing combinations will have a higher score, and losing combinations will have zero scores. From the score with a simple transformation, we get the probability mass function of the grid for selecting the given grid point. I randomly select multiple parameter combinations based on this probabilities and test them on a different year than the tests were run.

My trade system and the strategy:
https://medium.com/@istvan.veber/forex-news-trader-785ad0a1394c
https://medium.com/@istvan.veber/trade-the-news-but-make-your-forex-research-part-2-analysis-and-strategy-e0f2c84a3bdd
https://github.com/sinusgamma/Forex-News-Trader-Dukascopy-API

--

--

Véber István

Quantitative developer, meteorologist, deep learning, data analysis and algorithmic trading enthusiast. https://www.linkedin.com/in/istvanveber/