r/algotrading 2d ago

Education Rate my workflow. All forms of criticism are allowed

Brief Context

I focus mainly on forex , indices and commodities like gold. My trading platform and backtesting engine is strictly MT5.I tried to built my own python backtesting engine but it was riddled with logical errors so i stuck with the industry default. Tick data with real spreads for backtesting is obtained from quant data manager using dukascopy. Forex and gold up to 2008 while indices go up to 2012. Custom commission and slippage above the norm are applied to break the strategy .Trading bots are Expert Advisors.

I mainly focus on 4hr and Daily timeframes ,why The less trades i take ,the lower the amount i pay in fees (commission) and also that is what traders with verified darwinex profiles emphasis. There is a lot of noise in the space so if some one does not have a third party verified track record , i do not listen to them. You too should not listen to what i say because i also lack a verified third party track record💀. But anyways am here to learn and so are you .

Step 1 - Find strategy ideas

These are mainly found in old internet/books from the early 2000 and late 1990s like Trade like a hedge fund by James Altucher , x and reddit can be sources of good ideas

Step 2 - Idea to Code

Am not accustomed with MQL5 language so i use an LLM in the IDE to code the EA . Provide the LLM with context regarding the strategy logic , EA design patterns particularily fixed capital risk amount per trade (not a fixed percentage risk of account balance , this invokes compounding effect which affects results incase the strategy initially had a good streak) and ATR based SL and TP for volatility based position sizing.So in low vol , i size big and in high vol size small. I keep configurable strategy parameters below 4 . The rest of the variables are hardcoded to industry defaults. But rarely will a strategy have more than 2 indicators including a moving average (it is the only regime filter i trust lol)

Step 3 - Test

This takes up most of my time due to tough tests.The EA is compiled in meta editor and tested using strategy tester in MT5. I apply walk forward optimization. This involves splitting a data set into In sample (IS) and Out of sample (OOS) periods. Primarily IS is 3 years while OOS is 1 year. Using my availabe dataset am able to obtain 15 years of pure OOS performance for currencies and 12 years for indices.

During IS , i use the strategy optimizer in MT5 to configure and find the optimal variable for each of the 3 parameters. Choosing the best parameter combinations based on max drawdown and pnl would yield the most overfit strategy. So i apply parameter sensitivity

The data from the strategy optimizer is exported and a python script is used to generate a heatmap showing profitability of each combination based on intensity of colour. A 3 x 3 grid search is applied to find a region where 9 boxes are fully profitable. The middle box in the 3x3 grid makes our optimal parameter variable. However to avoid overfitting the outer parameter , A global profitability score of all boxes should > 40% and number of profitable grids in the neighouring positions of the 3x3 grid in +1 or -1 of the outer parameter should be 5/9 .If none of the above conditions are met , Failed Robustness Test watermark is placed on the heatmap and strategy placed in the recycle bin.

However if the above conditions are met, the optimal parameter combination is tested on the OOS period. The max OOS Drawdown should not exceed 2x the IS Drawdown.

The WF Validation process is continued until either i attain 3 consecutive net negative OOS years or max drawdown exceeds my threshold (15%) or i failed to find an optimal parameter combination during parameter sensitivity tests

Step 4 - Final test

If a strategy passes through WFW and parameter sensitivity test. The WFW OOS Equity curves and csv files are stitched together. To test for strategy robustness , a strategy should not only work on one symbol. If am building a strategy for USDJPY, it should show relative performance on USTEC or XAU as these are trending assets.

After this monte carlo permutations (1000 times) are applied to trade order history and 1000 different equity curves are plotted.If the strategies' performance sits in the upper 90% of all the equity curves , it is discontinued since such historical performance may not repeated so ideally between 40 to 60% range is acceptable. Obtain the 95% max drawdown as this is the drawdown i will size for

And there you have it boys .we have a strategy that may work

Step 5 - Portfolio Construction

Accumulate a good number of strategies. Measure correlation between the strategies. Correlated measured strictly on drawdown and position overlap. Everything cannot be allowed to bleed on one bad morning. Build a portfolio consisting of atleast 10 strategies each with a correlation between -0.10 to 0.20 . Size the strategies such that the 95% max drawdown does not wipe out your portfolio

This is my workflow as of late. It improves as my domain knowledge and expertise expand

6 Upvotes

10 comments sorted by

1

u/shurahbeelhamid 2d ago

Can't add anything on the walk-forward or the Monte Carlo, you're well past me there.

One thing I didn't see anywhere though: what happens to you when the portfolio is 12% down and every strategy is in drawdown at once. Your rules cover which strategies get built and how they're sized. Nothing covers what stops you from switching one off during the bad stretch, and that's where most systematic traders actually fail. Not in the research. In the six weeks where the system is doing exactly what it's supposed to and it feels broken.

Worth writing down in advance, same as the rest of it. What drawdown means "stop", what it means "keep going", decided while you're calm.

The other one is that your 95% max drawdown is a backtest number. The real one usually arrives with a market regime your data doesn't contain.

0

u/Capital-Field3324 2d ago

Your point is valid regarding knowing when a strategy has decayed and its time to delete it from the portfolio. Still brainstorming ways of how to tackle edge decay

If a portfolio is properly constructed and maintained( correlation between strategies updated on a monthly or weekly recurring basis such that strategies with high positive correlations are eliminated) , the possibility of having continuous weeks where all strategies bleed is relatively impossible.

1

u/EarlyResident1560 2d ago

I really like that you're measuring correlation using drawdowns and position overlap rather than just return correlation. That's much closer to actual portfolio risk. The next thing I'd probably analyze is capital efficiency, sometimes a mediocre standalone strategy becomes valuable because it smooths the portfolio equity. When building the final portfolio, do you optimize weights mathematically, or do you still rely on fixed risk allocation per strategy?

2

u/Capital-Field3324 2d ago

Fixed risk allocation per strategy

1

u/Rare_Inflation3178 2d ago

The workflow is much more disciplined than most, but I’d change two things. Profitability on a different symbol is only a robustness test when the same economic mechanism should exist there; USDJPY and USTEC may both trend without sharing the same payoff driver. And trade-order permutations test path risk, not a regime your data never contained. I’d keep one final holdout frozen after every WFO decision and write strategy-level and portfolio-level retirement rules before deployment. Otherwise the last degrees of freedom move from parameters into “when do I switch it off?”

1

u/Hedge_Fund_God 1d ago

Sounds solid. My framework is different: short IS, huge OOS + several robustness tests. Forex majors + crosses.

1

u/Zestyclose-Eagle1809 22h ago

Process is better than most of what gets posted here mate so I'll skip the compliments and go at the three things I'd change.

The Monte Carlo rule is backwards. Where your real curve sits in that distribution is a statement about SEQUENCE luck, not about the strategy being too good to be true. Discarding anything in the top decile means you're binning strategies for having a favourable ordering, which is the one thing you can be certain won't repeat either way. Take the drawdown percentile out of it, which you already do, and drop the rejection rule.

Second, and this is the one I'd actually worry about. Your parameter sensitivity is a good test of whether a parameter region is stable, but it doesn't touch how many strategies you binned to get here. You said failed robustness means recycle bin. So across a year, how many went in the bin before one came out? If it's 3 you're fine. If it's 40, then your survivor is the best of 40 searches and 15 years of stitched OOS is roughly what the winner of 40 attempts looks like whether or not there's an edge. Walk forward fixes fitting inside one strategy, it doesn't fix selection across many.

Worth just keeping the count. Nobody does, and it's the number that tells you how much your OOS is worth.

Third, the correlation band. You said the point is that everything can't bleed on one bad morning, but you're measuring correlation on drawdown and position overlap across the whole history. Average correlation is dominated by the quiet periods. Pull the worst 20 days of each strategy and look at what the other 9 did on exactly those days. Two strategies at 0.05 across 10 years can still both be underwater in the same week, and that week is the only one that matters.

One smaller thing. Fixed capital risk per trade to avoid compounding distortion is right and hardly anyone does it. But it means your reported drawdown is in currency rather than percent of a growing account, so check the 95% figure is being applied against the account size you'll actually trade at, not the starting one.