fx-alert

Trading journal

I tried to automate my trading. The code was never the problem.

· 4 min read

A few years ago I wrote a trading bot. I want to describe how that went, because the part that broke was not the part I expected.

Writing it was the easy half

The bot read candle shapes — price action patterns — and decided from those. Nothing clever. It was an idea that has been written a thousand times.

I am not an MQL5 programmer. I knew some Python, and by then I had not touched it in a while. I built the thing by working through it with ChatGPT, and it worked. The bot compiled, ran, and did precisely what I had described.

That deserves saying plainly, because it changes who can attempt this now. Not long ago, an idea for a strategy died unless you could code it or pay someone who could. That gate is mostly gone. If you can state your rules clearly enough, you can get them running.

Which sounds like good news, and is, except that it moves the difficulty somewhere you cannot see it. The code stops being the test. Whether the strategy suits you becomes the whole test.

The backtest told me what I wanted to hear

I designed the bot for H1 and daily charts, because that is where I believed a slow, steady edge would live.

The backtest came back positive. Not spectacular — mildly profitable. Enough to make me want to run it for real.

What I did not think about was how few trades that result contained. On higher timeframes a strategy trades rarely. My test covered a stretch short enough that the whole outcome rested on a handful of positions. Three months would have been a minimum, and honestly far more. A backtest that thin is not a test. It is a sample so small that luck and edge look exactly alike.

Then it went live

I moved it to a real account. Few trades, as expected. Some lost, and several lost in a row.

I know now that a run of consecutive losses is completely ordinary. Take a method that is right half the time and write out twenty of its trades: a run of four or more losses appears in roughly half of all such sequences. At the time I did not carry that picture in my head. Each loss read as evidence that the strategy was broken.

Eight sequences of twenty coin-flip trades, with runs of four or more losses outlined

Eight sequences of twenty trades, each decided by a coin flip — a method that is right exactly half the time, with no skill and no edge. Three of the eight contain a run of four or more losses (outlined). Across every possible sequence the figure is 47.8%.

The mistake that actually cost money

I got impatient. I wanted to see results sooner, so I moved the bot down to a smaller timeframe.

That is when the account started to bleed. More trades, more spread and commission paid, and a strategy running in conditions it had never been designed or tested for. The code had not changed at all. Its reason for existing had.

What was actually missing

Looking back, the real problem sits nowhere near the chart.

I had no financial plan behind the experiment — no household budget accounting for it, no capital set aside specifically for testing, no timeline I had agreed with myself in advance. I had built something that needed months of patience, and I had neither the money nor the calendar to give it those months.

So the impatience was not a flaw that appeared from nowhere. It was the predictable result of running a long-horizon system inside a short-horizon life.

This is the part I would want anyone starting today to hear. When the coding was hard, it filtered people slowly and taught them something on the way. Now you can have a working bot in an afternoon, and nothing in that afternoon forces you to ask whether the strategy matches your money, your temperament, or your patience. The bot will not ask. It will run your rules faithfully, including the ones you never thought about.

What I kept

I stopped the bot. Not because the code failed. It did exactly what I told it to do.

My manual trading did not change much in method afterwards, but something else did. I learned that I am a fast-feedback person. Waiting days for one setup makes me restless, and a restless trader interferes with his own plan. Finding that out was worth more than the bot ever was.

My ambition for software also got smaller and much more specific. I no longer want a program to decide for me. I want it to watch a level I chose and tell me when price arrives there. That is a narrow job, and a computer is genuinely better at it than I am.

Three things I would tell myself

  • A backtest is measured in trades, not in dates. Eight trades over six weeks tells you nothing.
  • A losing streak is a property of probability before it is a verdict on a strategy.
  • Ask whether your money and your calendar can survive the strategy, before you write a line of it — or before you ask an AI to write it for you.

Nothing here is trading advice. It is one trader's account of his own mistakes.

Batdorj Byambadorj

Batdorj Byambadorj writes from nearly twenty years of trading forex.

← All articles