Trading Shastra Academy

building a simple algo strategy with moving average crossover in NSE

Building a Simple Algo Strategy | 2025 Proven Beginner’s Guide


Building a simple algo strategy doesn’t need rocket science. With a clear rule, basic coding, and proper backtesting, even beginners can automate trades. In 2025, NSE and SEBI regulations support retail algo traders, making it easier to design, test, and deploy strategies step by step.


From Idea to Backtest in 30 Minutes

Picture this: You notice that whenever the 50-day moving average crosses above the 200-day moving average, stocks like Infosys or Reliance tend to trend higher. Instead of manually checking charts, you write a rule, backtest it, and let an algorithm trade it for you.

That’s what building a simple algo strategy is about — turning an idea into a rule that executes consistently, without emotions.


What Makes an Algo Strategy “Simple”?

Simplicity in algo trading means:

  • One clear signal (e.g., SMA crossover).

  • One filter (volume > average).

  • One exit rule (stop-loss or target).

  • Fixed risk management (1–2% per trade).

👉 Example: Buy when SMA50 > SMA200, sell when opposite happens, with a 2% stop-loss.

For basics, see Investopedia on Moving Averages.


Core Example: SMA Crossover Strategy

The Simple Moving Average (SMA) crossover is a favorite for beginners.

  • Buy signal: 50-day SMA crosses above 200-day SMA.

  • Sell signal: 50-day SMA crosses below 200-day SMA.

  • Exit: Either opposite signal or stop-loss via ATR (Average True Range).

👉 This works on NSE stocks like TCS, Infosys, or even Nifty index futures.


Data & Tools Needed

You don’t need Wall Street servers. Start with:

  • Data: OHLC (Open-High-Low-Close) from NSE India.

  • Tools: Python, pandas, TA-Lib, or simple Excel.

  • Backtesting platform: Broker APIs, or even free Python libraries.

Documentation: TA-Lib for Python.


How to Backtest a Simple Algo Strategy

Backtesting = checking how your rule would have performed on past data.

Steps:

  1. Split data (train/test).

  2. Apply rules → generate buy/sell signals.

  3. Track metrics: CAGR, win rate, Sharpe ratio, max drawdown.

  4. Include brokerage and slippage costs.

👉 For deeper learning, explore Investopedia Backtesting.


Risk Management is the Real Strategy

An algo without risk control is dangerous. Always set:

  • Stop-loss: 1R (risk unit) or ATR-based.

  • Position sizing: fixed % per trade.

  • Capital allocation: never >10% on one stock.

  • Max daily loss: hard limit.

This ensures your algo doesn’t blow up capital on one bad trade.


From Paper Trade to Live Deployment
  • Step 1: Paper trade on demo accounts.

  • Step 2: Live trade with small capital.

  • Step 3: Scale gradually after consistent results.

Brokers like Zerodha and Upstox provide APIs for automation (check SEBI guidelines). Always log trades and review results weekly.


Common Mistakes Beginners Make
  • Overfitting: Making the strategy work “too perfectly” on past data.

  • Ignoring costs: Brokerage + slippage can eat profits.

  • Tiny samples: Backtesting on 6 months = unreliable.

  • No risk limits: One black swan event can wipe accounts.

👉 Discussions on Reddit AlgoTrading highlight how over-optimization destroys live results.


Key Takeaways

  • Building a simple algo strategy = clear rule + test + execute.

  • Use SMA crossover as a beginner-friendly starting point.

  • Always backtest with costs + risk control.

  • Deploy gradually (paper → live).

  • In 2025, SEBI/NSE make algo trading accessible for retail traders in India.


FAQs

Q1: What is the simplest algo trading strategy?
A: Moving average crossover (e.g., SMA50 vs SMA200) is the most beginner-friendly algo.

Q2: How do I backtest a simple algo strategy?
A: Use Python/pandas, split data, generate signals, and measure metrics like Sharpe ratio.

Q3: Which timeframe works best for simple algos?
A: Daily or hourly charts are best for beginners; avoid 1-minute noise.

Q4: Is algo trading legal for retail traders in India?
A: Yes, SEBI allows it, but only via registered brokers and approved APIs.

Q5: Can I start with small capital?
A: Yes, even ₹50,000 is enough to test small strategies, as long as risk is managed.


Why Trading Shastra Helps You Build Algos the Right Way

At Trading Shastra Academy, founded by Himanshu Gurha, we teach not just coding but live market-ready strategies.

  • Programs include ₹10–50 Lakh funded capital.

  • 100% loss covered + 50% profit share.

  • Algo worth ₹12,000/month — free for enrolled students.

  • Stipend internships (₹5,500–₹15,000).

  • SEBI-compliant strategies, taught live in Noida / Delhi NCR.

This is why our students not only learn theory but also deploy real algos safely.


See Our More Blogs

👉 Read More Blogs


Institute Info

Trading Shastra Academy
B-11, Sector 2, Noida – 201301
Website: www.tradingshastra.com
Email: info@tradingshastra.com
Phone: +91 9717333285

Disclaimer

This blog is for educational purposes only. Stock market investments are subject to risks. Please do thorough research before investing.