by ABXK.AI AI Trading

AI Trading Platform: From Losing to Winning - Our Optimization Story

machine-learningtradingbacktestingoptimizationpython

Where We Started

In our last post, we built a solid evaluation framework. We could now test our trades fairly. But there was a problem: we were still losing money.

Our honest numbers showed:

MetricValueStatus
Profit Factor0.94fail Below 1.0 = losing
Win Rate4%fail Very low
Average Loss-253%fail Huge losses
Risk/Reward0.59:1fail Bad ratio

A Profit Factor below 1.0 means you lose more than you win. We needed to fix this.

The Goal

We set clear targets:

  1. Profit Factor > 1.2 - Make more than we lose
  2. Win Rate > 50% - Win more trades than we lose
  3. Smaller losses - Each losing trade should hurt less
  4. Better Risk/Reward - Win more per trade than we lose

The Journey: 15 Versions

We did not find the answer quickly. We tested 15 different versions of our system. Here is what happened:

VersionChange MadeTradesProfit FactorResult
v1-v4Very strict filters0-No trades at all
v5Relaxed filters332-All breakeven
v6Tight stops (1.0 ATR)200+0.69fail Worse
v7No breakeven stop150+1.03success First profit!
v110.75 ATR stops180+1.09success Better
v13Very strict filters2-Too few trades
v14Earlier trailing160+0.94fail Back to losing
v150.6 ATR stops1712.77success Success!

As you can see, we tried many things. Some made it worse. Some made it better. Finding the right balance was not easy.

What Was Difficult

Problem 1: Stop Losses Were Too Wide

Our original stop loss was 2.0 ATR (Average True Range). This means the price could move a lot against us before we exit. When we got stopped out, we lost an average of -253% per trade.

This was our biggest problem.

Problem 2: We Traded Bad Time Periods

We found that some time periods were very bad:

Time PeriodAverage LossWhat Happened
1 week-33%Very bad
6 months-99%Disaster
1 year-78%Terrible
1 month-45%Poor

Weekly and monthly charts showed huge losses. We did not know this until we looked at the data.

Problem 3: Some Stocks Do Not Work

We also found that META (Facebook) performed poorly:

SymbolWin RateAverage Return
META33%-0.43%

Not every stock works with every system.

Problem 4: The Breakeven Stop Hurt Us

We had a feature that moved our stop loss to breakeven after a small profit. This sounds smart. But there was a problem: trading costs.

When you add fees, spread, and slippage, breakeven is actually a small loss. So many trades that hit breakeven were actually losing trades.

How We Fixed It

We made five key changes:

Fix 1: Tighter Stop Losses

We changed the ATR multiplier from 2.0 to 0.6:

ConditionOld ATRNew ATR
Normal2.00.6
High volatility2.00.85
Low volatility2.00.5

Result: Average stopped loss went from -253% to -0.81%. This was the biggest improvement.

Fix 2: Earlier Trailing Stop

We changed when the trailing stop activates:

SettingOld ValueNew Value
Trigger at profit1.0R0.7R
Trail distance0.5R0.4R

This means we lock in profits earlier and follow the price more closely.

Fix 3: Block Bad Time Periods

We added a blacklist for time periods that lose money:

Blocked: 1 week, 1 month, 2 months, 3 months, 6 months, 1 year

Now the system will not trade these time periods.

Fix 4: Block Bad Symbols

We added a blacklist for stocks that do not work:

Blocked: META

Fix 5: Disable Breakeven Stop

We turned off the breakeven stop feature completely. It was causing more harm than good.

The Final Results

After all these changes, our results look very different:

MetricBeforeAfterImprovement
Profit Factor0.942.77+194%
Win Rate4%61.4%+1435%
Total ReturnNegative+82.79%success
Average Loss-253%-0.71%+99.7% better
Risk/Reward0.59:11.74:1+195%

We went from losing money to making good profits.

Trade Statistics

Our final test ran 171 trades:

Exit TypeTradesPercentageAverage
Trailing stop (winners)11466.7%+1.13%
Stopped out (losers)5733.3%-0.81%
CategoryCountAverage
Winners105+1.23%
Losers66-0.71%

Lessons Learned

Here is what we learned from this optimization:

1. Tighter stops work better

We thought wide stops would give trades room to work. But in reality, wide stops just meant bigger losses. Tighter stops cut losses early.

2. Not all time periods are equal

Weekly and monthly charts were disasters for our system. Looking at data by time period showed us what to avoid.

3. Lock in profits early

Waiting too long to trail profits meant we gave back gains. Earlier trailing keeps more of what you earn.

4. Simple features can hurt you

The breakeven stop sounded like a good idea. But when you include trading costs, it was actually harmful. Always test features with real costs included.

5. Test many versions

We tested 15 versions before finding the right settings. Version 6 was worse than version 1. Version 7 was our first profit. Version 15 was our breakthrough. Do not stop after one or two tests.

Configuration Summary

Here are our final optimized settings:

ParameterValue
ATR Multiplier (normal)0.6
ATR Multiplier (high volatility)0.85
ATR Multiplier (low volatility)0.5
Trailing trigger0.7R profit
Trail distance0.4R
Breakeven stopDisabled
Min confidence50
Blocked time periods1w, 1M, 2M, 3M, 6M, 1Y
Blocked symbolsMETA

What Comes Next

We have achieved our first goal: Profit Factor > 1.2. Actually, we beat it by a lot (2.77).

Our next steps are:

  1. Walk-Forward Test - Test on completely new data
  2. Paper Trading - Trade with fake money in real time
  3. Real Trading - If paper trading works, try real money

The system is now ready for the next stage of testing.

Final Thoughts

Going from Profit Factor 0.94 to 2.77 was not easy. It took 15 versions and many hours of testing. But we learned something important: small changes can make big differences.

The biggest improvement came from one change: tighter stop losses. Cutting the ATR multiplier from 2.0 to 0.6 reduced our average loss from -253% to -0.81%. That single change transformed our system.

If your trading system is not working, look at your stop losses first. You might be surprised what you find.

Learn more about the platform: AI Trading Platform


Building a profitable trading system requires patience and systematic testing. The numbers do not lie—but you have to look at the right numbers.

Important: This is an experimental project. Past results do not guarantee future profits. Never invest money you cannot afford to lose.