
Chapter 2 | 2 min read
Understanding Data in Trading
If strategy is the brain of an algo, then data is the fuel. Without data, your algo is just sitting there — clueless.
In this chapter, we’ll understand what kind of data algos use, where it comes from, and how it helps in making trading decisions.
What is Market Data?
In trading, data simply means information about what’s happening in the market.
The most common data points are:
- Price – Open, high, low, close (OHLC)
- Volume – How many shares/contracts were traded
- Time – When exactly a trade happened
- Indicators – Calculated values like RSI, MACD, Moving Averages
Your algo looks at these data points and checks:
“Do they match the conditions I’ve set? If yes, take action.”
Two Types of Market Data
- Historical Data (Past)
a. This is data from the past — say, last 1 year’s price movement.
b. It is used for backtesting your strategy.
c. Helps answer: “If I had used this logic earlier, would it have worked?”
Note: Make sure historical data is adjusted for splits/dividends and has no missing timestamps—otherwise indicators and backtests will be wrong.
2. Live/Real-Time Data (Present)
a. This is near real-time market data (often 1-minute bars, sometimes tick-by-tick). Retail feeds may lag 1–15 minutes, so use a real-time source for live trades.
b. Algos use this to make decisions on the fly.
c. Helps answer: “Should I enter or exit this trade now?”
Example: Using Data in a Simple Strategy
Let’s say your rule is:
Buy a stock if its 5-day moving average crosses above the 20-day moving average.
To check this, your algo needs:
- The last 20 days’ closing prices (historical data)
- Current price (real-time data)
- Time stamps to see when the crossover happens
This data feeds into your logic and tells the system:
“Yes, crossover happened. Time to buy!”
Timeframes Matter
Data can come in different timeframes:
- 1-minute candles (intraday scalping)
- 15-minute (short-term)
- Daily (swing or positional trading)
- Weekly (longer-term investing)
The same stock can look totally different in different timeframes. So you need to choose a timeframe that matches your trading style.
Final Thought
The better your data, the better your decisions.
- Bad or laggy data = Missed trades, wrong entries
- Clean and timely data = Smooth algo performance
- Data is the language that algos understand. You don’t have to code to grasp it—just learn to use it well. (We’ll cover both no-code and code paths.)
In the next chapter, we’ll explore the platforms and tools that help you run algos in India — no coding required. Let’s go!
Recommended Courses for you
Beyond Stockshaala
Discover our extensive knowledge center
Learn, Invest, and Grow with Kotak Videos
Explore our comprehensive video library that blends expert market insights with Kotak's innovative financial solutions to support your goals.













