

Kotak
Stockshaala
Chapter 2 | 2 min read
Using Constraints: “Find stocks under ₹500 with SMA crossover”
One of AI’s big strengths is handling constraints — specific rules that tighten a search.
Constraints make sure your results actually fit what you need, instead of throwing up random lists.
They turn a broad prompt into a focused shortlist.
Let’s break this down with a simple example:
“Find stocks under ₹500 with SMA crossover.”
What Are Constraints?
A constraint is a condition or limit you give the AI. It forces the screener to work within your rules.
- “Stocks under ₹500” → a price constraint
- “With SMA crossover” → a technical constraint
Together, they filter out everything else and give you a focused list.
Breaking Down the Example
-
Stocks under ₹500: This makes sure you are only looking at affordable companies, maybe for small-ticket investments.
-
SMA Crossover: SMA means Simple Moving Average. A crossover happens when a short-term average (say 20-day) crosses above or below a long-term average (say 50-day).
-
When short-term crosses above long-term → it can signal a bullish trend.
-
When short-term crosses below long-term → it can signal weakness.
So, the prompt is asking AI to show only those stocks that meet both conditions.
Why Constraints Matter
Without constraints, AI might return too many results.
- Example of vague prompt: “Find good stocks to invest.” → Output will be messy and broad.
- Example with constraints: “Find Nifty 100 stocks under ₹500 with RSI < 30 and SMA 20 crossing above SMA 50.” → Output will be targeted and meaningful.
Constraints force discipline in your screening.
How to Write Constraints Clearly
-
Always mention numbers (₹500, 20-day, 50-day).
-
Use AND/OR logic where needed.
- “Under ₹500 AND with SMA crossover.”
- “Under ₹500 OR showing MACD bullish signal.”
-
Add time frames when possible: “In the last 10 trading days.”
This ensures AI knows exactly what to filter.
Example
Suppose you type:
“Show me Indian auto stocks under ₹500 where 20-day SMA has crossed above 50-day SMA in the last week.”
AI might return names like small-cap auto companies or mid-caps that fit both the price and technical pattern. Without constraints, you would have to manually scan dozens of charts.
Final Takeaway
Constraints are what make AI screening truly powerful.
By layering simple price rules with technical or fundamental conditions, you can cut down thousands of stocks into a shortlist that matches your strategy.
Think of constraints as guardrails — they keep your search focused, relevant, and practical, instead of letting it drift into random results.
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.














