big difference between backtest and live

 
Hi guys, first of all I'm not a coder and so I tried to create a bot with deepseek. I managed  to create it , the strategy work on candle rejections based on pips. The problem is that in every tick backtest the bot is profitable but in every tick based on real tick and on live trading , the EA  it's not profitable and sometimes do not take trade as the backtest or takes different trade. Why? I mean I undestand the slippage and spread but theorycally should be profitable on live. 
 
manucaaa:
Hi guys, first of all I'm not a coder and so I tried to create a bot with deepseek. I managed  to create it , the strategy work on candle rejections based on pips. The problem is that in every tick backtest the bot is profitable but in every tick based on real tick and on live trading , the EA  it's not profitable and sometimes do not take trade as the backtest or takes different trade. Why? I mean I undestand the slippage and spread but theorycally should be profitable on live. 

A bot generated by AI begets AI results.

Inspect the code and edit it or better yet, code it anew from scratch.

 
manucaaa :

Forum on trading, automated trading systems, and simulation of trading strategies.

Reflection: Is it worth using EA generators or ChatGPT for coding?

Miguel Angel Vico Alba , 2025.03.16 23:42

If you're using tools like ChatGPT, fxDreema, EA Builder, Strategy Quant, ForexEAdvisor, Molanis, among many others, you probably think you're saving time.

The reality is that you will end up spending much more time trying to fix bugs than if you had learned MQL4/5 from the beginning.

The problem is that these generators create code without really understanding the logic behind it.

The result is a code full of errors:

  • Mix of MT4 and MT5 (MQL4/5).
  • Multiple OnCalculate/OnTick functions. Even OnInit! Hello? 😅
  • Badly initialized buffers.
  • Calls to non-existent functions.
  • Incorrect use of identifiers and values.
  • Digit mismatch.
  • Compilation errors , and so on ad infinitum.

In many cases, they don't even check return codes or handle errors properly.

If you haven't learned MQL4/5, there's no common language for communication. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it.

If you really want a functional and error-free EA, learn MQL4/5 and do it right from the start .

Final Recommendation : Since MT4 (MQL4) is obsolete and is currently being phased out (it has already served its purpose), I highly recommend you focus on MQL5 (MT5) , which is the future and offers many more advantages and functionalities.

    (Autotranslated from the Spanish forum)

     
    manucaaa:
    Hi guys, first of all I'm not a coder and so I tried to create a bot with deepseek. I managed  to create it , the strategy work on candle rejections based on pips. The problem is that in every tick backtest the bot is profitable but in every tick based on real tick and on live trading , the EA  it's not profitable and sometimes do not take trade as the backtest or takes different trade. Why? I mean I undestand the slippage and spread but theorycally should be profitable on live. 

    Nice work on your candle rejection EA! Here’s why it might perform differently live vs. backtest:

    Backtest Limits: "Every tick" backtests use simulated ticks, missing real market volatility. Even "real tick" tests can differ from live conditions.

    Slippage/Spread: Live trading has variable spreads and slippage, especially during volatility, unlike fixed backtest conditions.

    Broker Factors: Execution speed and order policies vary by broker, affecting trade outcomes.

    Code Sensitivity: Your rejection logic may rely on precise tick data, causing missed or different trades live.

    Market Changes: Live markets shift, and past patterns may not hold.


    Fixes:

    Backtest with real ticks from your broker.

    Code for dynamic spreads (e.g., MarketInfo(_Symbol, MODE_SPREAD)) and slippage.

    Add debug logs to compare live vs. backtest trades.