Free Stock Market Basics course live hai — abhi join karein!
ForexProLesson 25 of 282 min read

Expert advisors, algorithms and backtesting

Learning content:

An Expert Advisor (EA) or trading robot is a program that places trades automatically on platforms like MetaTrader. Automation brings discipline and speed and removes emotion, but it brings risks: bugs, overfitting, poor execution, and strategies that work only in one market condition.

The safe process: write precise rules, backtest on quality historical data with realistic spreads and slippage, use out-of-sample and walk-forward testing, check maximum drawdown and consecutive losses, and then run on a demo and finally with very small live size. Be careful with martingale and grid systems that double the size after losses: they show beautiful equity curves for a long time and then one trend wipes out the account. Avoid buying EAs that promise monthly returns; many are fake or curve-fitted, and results in screenshots can be faked.

Remember again the legal point: automated trading on unauthorised overseas platforms is not made legal by automation. Use only permitted channels in India.

Go deeper

Quality data. Use tick or minute data with realistic spreads and swaps. Poor data hides slippage and creates fantasy results, particularly for scalpers. Model commission, variable spread, and execution delay.

Process. Define rules, test in-sample, then out-of-sample, then walk-forward; run a Monte Carlo shuffle of trades to see the drawdown range; check parameter sensitivity; run a demo forward test for at least a month.

Avoid overfitting. An EA with 12 optimised parameters and 30 trades is almost surely curve-fit. Prefer few parameters, many trades and stability across years.

Dangerous styles. Martingale and grid strategies show beautiful equity curves until one extended trend wipes the account; always examine the maximum adverse excursion and worst-case drawdown.

Live monitoring. Set a maximum drawdown at which the system is turned off (for example 1.5 times the backtest max), log trades, and compare live and test stats regularly.

VPS and execution. Run on a stable VPS, use a broker with consistent execution and watch latency.

Metrics. Profit factor above 1.3, Sharpe above 1, drawdown tolerable, at least 200 trades.

Common mistakes

  • Trusting a martingale equity curve.
  • Optimising many parameters on a short sample.
  • Running without a kill switch.

Key points

  • EAs automate rules but do not create an edge.
  • Test with real costs, out-of-sample data and then demo.
  • Avoid martingale and grid systems that hide tail risk.
  • Promised monthly returns are a red flag.

Test yourself

Why is a martingale backtest misleading?

It wins often with small gains but one long adverse move can cause a loss larger than all previous wins.

What is walk-forward testing?

Repeatedly optimising on one period and testing on the following unseen period to check stability.

Try it: Lot size · Pip value · Margin · Journal · My Path

Risk note: Education only, not investment advice. Trading and investing involve risk of loss. We are not SEBI-registered investment advisers or research analysts and we do not give buy/sell tips.

Risk note: Under FEMA and RBI rules, retail forex trading by Indian residents is permitted only on SEBI-recognised Indian exchanges in INR pairs (USD, EUR, GBP, JPY). Trading with unauthorised offshore platforms may violate FEMA. We do not promote unauthorised brokers. Check the RBI Alert List before you trade.

← All Forex lessons