My own experience so far programming an strategy - 6 months learning

Got into Forex because of curiosity and as a programmer wanted to automate trading and build a consistent profitable system. So my first attempt was MetaTrader, which I gave up fast enough. Main reasons were a proprietary programming language which from my point of view, is not flexible enough and there’s a huge community with lots of scammers and system builders that will sell you a 1000 USD system that will ‘probably make your rich’ but end up losing all your money.

So decided to build my own system, .Net framework four implementing an open source indicators library which has more than 200 indicators programmed and ForexConnect API for communicating with a test account on FXCM. My idea was read all the possible theory, learn, program and algorithm and do a two phase testing: 1) tickdata backtesting (downloaded from Strategy Quant, tickdata downloader) 2) live testing, live demo account.

When this process was finished my plan was going live with a real account, Still on phase 1).

Learning process started researching basic systems and found many of them like you all probably have done, you know, bollinger bands 20-2 configuration with Stochastic indicator (14), when closing below lower band and stch below 20 , go long blah blah blah stuff like that. Came across of many of those and in they all have one thing in commmon: printscreen that reviewer or strategy builder suggest they all make sense and look really good. Tried many, programmed tens of them. But in the long term, they are ALL BULL****, no matter what. Tested years of these kind of strategies, different indexes (AUDUSD, EURUSD, USDJPY) and arrived to a first conclusion:

[B]No matter how analytic your system is and how good you implement indicators, the probability of a position to be closed the way you expected is 50% in LONG PERIOD runs.[/B]

This is a fact. Overbought/oversold in forex, means nothing at all because of market breakouts, which happen quite often in forex.

Continued researching and learning, started to pay more attention on stop loss/take profit configurations and analysis. Learned mostly on how to implement ATR (average true range) for setting fixed SL/TP, programmed a trailing stop functionality and become familiar with MFE/MAE (Maximum Favorable Excursion, Maximum Adverse Excursion). At this point, build up some good progress with some of my strategies, parametrization level started to increase and optimization seemed to be a very important process before running any strategy as each index, has a instrinsic nature that is not shared with others. So this is my second conclusion:

[B]Strategy should be based on setting stop loss / make profit levels correctly and should be done ADAPTATIVELY.[/B]

There are many articles on this forum that give support to the previous statement. One can make a profitable system out of a random decision strategy by setting those levels correctly. So my advice is discard indicators and full trust me in this one. Specially if you have a variable lot set up in your strategy. There will be one day in which all your indicators, let’s say, Bollinger Bands, %BB, Stch, MFI will say BUY you will go strong on this one and you will lose a huge amount of your balance because market breaks out in an opposite direction. This will happen, soon or after. 100% warrantied and tested in several years by a COMPUTER PROGRAM.

More on this, RRR or R/R (Risk reward ratio) is a very important variable to be determined before designing your strategy. Why? Because in accountability terms this will determine the amount of winning positions over lost positions that you will balance. Which you need to avoid is overcompensating your loses. And this is when my third conclusion takes part:

[B]DO NOT use MARTINGALE to compensate your losses. This will give you a false sense of wealth feeling but soon or after will break your account to zero. This is gambling, not investing.[/B]

If you want to do this then go to a casino. For real.

Suppose the following theoretical system: you set up a SL/TP pips based system. Positions are opened randomly (or let’s suppose you use some indicator that gives you enough emotional strength but, well, as my #1 statement says - long run nature will end up being random). R/R is 4/1, in terms of pips, you will execute a stop loss 40 pips away from your expected trend and 10 pips on the rend you will take losses. What does this tell you? First of all, that you will be profitable 75% of your trades but when you loss the remaining 25% it will draw your account balance’s down back to the starting. So this is why this setting should be adaptive, market conditions change dynamically, summarizing two more statements:

[B]A fixed SL/TP level is a zero sum game. This is why ATR is a good starting point for setting these levels dynamically.
[/B]

[B]It doesn’t matter how effective your system is in terms of percentage. What really matters is that the sum of winning trades are greater than the module of the losing trades.[/B]

This is what I have learned so far and is supported by long range computer testing, still working on creating or implementing a good money management strategy that will natural produce a growing balance curve without using martingale or trusting indicators as they were reliable. Pieces of advice, critics and thoughts are welcomed.
With time to time, I will post excel result files that support my statements.

Right now my system is a C# .Net solution with 5 projects, more than 100 classes. Implements two open source projects for analysis and communcation and has many thousands of code lines; this is a hobbie and I am not a professional trader.

I started out manually trading before ever finding MT4. I have been a .net programmer for the last 10+ years so naturally I went the same route as you. I am a big believer in PA so I built a system purely built on that. I would say don’t get discouraged and keep trying to find a good solution. It took me almost two years to build a program that performs to my standards. I have trades come up roughly 18-20 times a month and have a 78% success rate. Don’t really want to get into the details or share anything publicly, we can chat privately if you’d like. My most profitable time frames are 1m,5m,1h I think the 1m and 5m are just because there are more datapoints in the past for my program to analyse so it gives me better data.

Do you regularly post updates about your system? I would love to follow its progress! All the best, mate!

I don’t but I will start posting excel files about my premises, to support them.

I’m also a programmer, and am trying to get an EA that I wrote for MT4 working in recent year’s back testing. I got it to so a profit of about US$ 20M for 2003, 2004 and 2005, but then nose dives and crashes out after that.

If my back test results for the early years is anything to go by, it is possible, but making it change strategy on the fly is not easy.

Good luck with your attempts.

Just wondering, but how long does it usually take to design and backtest an EA? I do all of my backtests manually and it’s a real chore. :slight_smile:

your 18-20 trades per month – are they automatically entered by your EA or do you have to watch the charts and enter them manually?

I have written some functions, that I use often in all of my EAs that I write, into include files. This way, all I have to do is add them references to any new EA that I write. This allows me to put a simple EA together in a matter of minutes.

The back testing time depends on the complexity of the EA, but most of mine only take a matter of about 3 or 4 minutes to test 3 years in MT4. Keep in mind that I’m not genius trader and I am yet to make what looks like a positive gain in manual trading.

I do however have an EA that makes US$ 9M profit in a 3 year period in back testing between 2003 and 2005. Writing it was the easy part, testing and playing with settings is what takes a loooooong time.

I am on my phone right now so will keep it short.

I do all the grunt work and back testing using a combination of three different. Net programs I’ve written. As far as how dies it make trades one of the. Net programs is in charge of communicating with mt4 via an EA. The EA itself is very small and only listens for commands to either buy or sell and what to set the tp, sl, and trailing stop at. I replied back to your private message as well.