Member-only story
Making Inside Bar Scanner Using Python and Zerodha
In the world of trading and investing, candlestick patterns play a significant role in helping traders make informed decisions. One such pattern is the “Inside Bar,” which can signal potential changes in price direction.
In this article, we will explore how to use Python and the Zerodha Kite Connect API to detect Inside Bars for a specific stock, such as RELIANCE.
Iterating Every FNO Stocks in the Insider Bar Scanner
Let’s loop through multiple stock symbols and check if each of them had an Inside Bar pattern within the date range while also fetching the instrument data for each stock symbol, you can modify the code as follows:
for symbol in symbol_list:
# Fetch instrument data for the current stock symbol
instruments = kite.ltp([symbol])
# Check if the stock symbol is in the instruments dictionary
if symbol in instruments:
instrument_token = instruments[symbol]['instrument_token']
if instrument_token:
# Fetch historical data for the stock
historical_data = kite.historical_data(instrument_token, '2023-01-01', '2023-09-01', interval='day')
# Initialize variables to track inside bars
inside_bars = []
# Iterate through historical data to detect inside bars
for i in range(1, len(historical_data)):
current_candle = historical_data[i]
previous_candle = historical_data[i - 1]
if (current_candle['high'] <…






