Summary of "Advanced Algo Trading Series | Episode 2: How To Create A Scanner & Scanning Option Chain | Dhan"
Summary of “Advanced Algo Trading Series | Episode 2: How To Create A Scanner & Scanning Option Chain | Dhan”
Main Financial Strategies and Business Trends Presented
- Algorithmic Trading Automation: Differentiating between scanners (which identify entry points) and algos (which manage orders, trailing stops, and exits).
- Indicator-Based Scanning: Using technical indicators such as RSI and Super Trend to create buy/sell signals.
- Candlestick and Chart Pattern Scanning: Incorporating price action patterns like Bullish/Bearish Engulfing for refined entry/exit conditions.
- Advanced Chart Types: Creating and using Heikin Ashi and Renko charts for alternative price visualization and scanning.
- Option Chain Scanning: Real-time scanning of option chains using APIs to identify strikes based on parameters like LTP (Last Traded Price), volume, open interest (OI), and Greeks.
- Put-Call Ratio (PCR) Analysis: Calculating PCR from volume and OI to gauge market sentiment and potential trend direction.
- Debugging and Testing Methodology: Emphasizing the importance of print statements and stepwise debugging to ensure scanner and algo accuracy before live deployment.
- Handling Real-World Data Issues: Managing exceptions such as missing data or symbol changes gracefully in code to avoid runtime errors.
Methodology / Step-by-Step Guide
1. Creating a Scanner for Indicators and Patterns
- Import chart data (candlestick, Heikin Ashi, Renko).
- Apply technical indicators (e.g., RSI, Super Trend).
- Define entry conditions based on indicator values (e.g., RSI > 60, Super Trend green).
- Define candlestick pattern conditions (e.g., Bullish Engulfing = 100).
- Combine multiple buy/sell conditions using logical AND.
- Print or log signals for debugging.
- Test and debug by printing intermediate condition results.
- Temporarily disable difficult conditions to isolate issues.
- Adjust timeframes (e.g., 5 min, 15 min) for better signal detection during testing.
- Validate signals by cross-checking chart data manually.
2. Detecting Indicator Crossovers (Example: Super Trend Color Change)
- Compare current candle’s Super Trend color with previous candle’s color.
- Entry signal when color changes from red to green (buy) or green to red (sell).
- Code logic involves referencing current and previous candle Super Trend values.
3. Handling Errors and Exceptions
- Use try-except blocks to catch errors during data fetch or calculations.
- Use
pass
in exception handling to skip problematic symbols and continue scanning.
4. Scanning Option Chain Data
- Use API to fetch option chain data for a given underlying and expiry.
- Specify number of strikes above and below ATM to scan.
- Extract columns such as OI, volume, Greeks, strike price.
- Filter strikes based on criteria like LTP less than a threshold.
- Find strike with maximum/minimum LTP, volume, or open interest using Pandas methods (
max()
,min()
,sort()
). - Calculate Put-Call Ratio (PCR) using sums of volumes or OI for puts and calls.
- Use PCR as a sentiment indicator (PCR < 1 may indicate bullishness).
5. Testing and Validation
- Run scanners during off-market hours using longer timeframes (e.g., 15 minutes) to generate signals.
- Cross-verify scanner outputs with chart data to confirm accuracy.
- Use print/debug statements extensively to understand which conditions are passing or failing.
- Adjust scanning parameters and conditions iteratively for better performance.
Tools and Technologies Used
- Dhan API: For market data, charting, and option chain access.
- Python (Pandas): For data manipulation, filtering, sorting, and calculations.
- Technical Indicators: RSI, Super Trend.
- Candlestick Patterns: Bullish/Bearish Engulfing.
- Chart Types: Candlestick, Heikin Ashi, Renko.
- Debugging Techniques: Print statements, exception handling.
Key Takeaways
- Scanners identify potential entry points but do not place or manage orders.
- Combining multiple indicators and price patterns improves signal reliability.
- Real-time option chain data enables advanced option strategy development.
- PCR is a useful metric for gauging market sentiment.
- Robust error handling and debugging are essential for reliable algo trading.
- Testing on different timeframes and conditions is critical before live deployment.
- Pandas simplifies complex data filtering and sorting operations for scanning.
Presenter / Source
- Presenter: Dhan (Advanced Algo Trading Series)
- The session is part of a multi-episode series on advanced algorithmic trading using the Dhan platform and API.
This summary encapsulates the financial strategies, technical methods, and practical coding approaches discussed in the video, providing a clear framework for building and testing algorithmic trading scanners and option chain scanners.
Category
Business and Finance
Share this summary
Featured Products

Machine Learning for Algorithmic Trading: Predictive models to extract signals from market and alternative data for systematic trading strategies with Python
View on Amazon

Inventory Barcode Scanner, Wireless Barcode Scanner 1D 2D & PDF417 Data Collector Portable Data Terminal Inventory Device with 2.4G Wireless & USB Wired Connection Bar Code Scanners
View on Amazon