Need help to build strategies on renko chart with supertrend indicator

from kiteconnect import KiteConnect

import pandas as pd

api_key = "s5bdt3i026tf42bm"

api_secret = "0o1p75p7tu1pgzp1d8y0x2v39f5ko8o3"

kite = KiteConnect(api_key=api_key)

print(kite.login_url()) #use this url to manually login and authorize yourself

request_token = "k9nvLkpVKBp5IEve2lMFmxE55fR5xrjc" #Extract request token from the redirect url obtained after you authorize yourself by loggin in

data = kite.generate_session(request_token, api_secret=api_secret)

kite.set_access_token(data["access_token"])

kite.set_access_token("Mn1WfCv2q55oKjk9fL3JF5yXqXxX1GeM")

def ATR(DF,n):

    "function to calculate True Range and Average True Range"

    df = DF.copy()

    df['H-L']=abs(df['High']-df['Low'])

    df['H-PC']=abs(df['High']-df['Adj Close'].shift(1))

    df['L-PC']=abs(df['Low']-df['Adj Close'].shift(1))

    df['TR']=df[['H-L','H-PC','L-PC']].max(axis=1,skipna=False)

    df['ATR'] = df['TR'].rolling(n).mean()

    df2 = df.drop(['H-L','H-PC','L-PC'],axis=1)

    return df2



def renko_DF(DF):

    "function to convert ohlc data into renko bricks"

    df = DF.copy()

    df.reset_index(inplace=True)

    df = df.iloc[:,[0,1,2,3,5,6]]

    df.rename(columns = {"Date" : "date", "High" : "high","Low" : "low", "Open" : "open","Adj Close" : "close", "Volume" : "volume"}, inplace = True)

    df2 = Renko(df)

    df2.brick_size = round(ATR(DF,120)["ATR"][-1],0)

    renko_df = df2.get_bricks() #if get_bricks() does not work try using get_ohlc_data() instead

    #renko_df = df2.get_ohlc_data()

    return renko_df



def supertrend(DF,n,m):

    """function to calculate Supertrend given historical candle data

        n = n day ATR - usually 7 day ATR is used

        m = multiplier - usually 2 or 3 is used"""

    df = DF.copy()

    df['ATR'] = atr(df,n)

    df["B-U"]=((df['high']+df['low'])/2) + mdf['ATR'] 

    df["B-L"]=((df['high']+df['low'])/2) - m
df['ATR']

    df["U-B"]=df["B-U"]

    df["L-B"]=df["B-L"]

    ind = df.index

    for i in range(n,len(df)):

        if df['close'][i-1]<=df['U-B'][i-1]:

            df.loc[ind[i],'U-B']=min(df['B-U'][i],df['U-B'][i-1])

        else:

            df.loc[ind[i],'U-B']=df['B-U'][i]    

    for i in range(n,len(df)):

        if df['close'][i-1]>=df['L-B'][i-1]:

            df.loc[ind[i],'L-B']=max(df['B-L'][i],df['L-B'][i-1])

        else:

            df.loc[ind[i],'L-B']=df['B-L'][i]  

    df['Strend']=np.nan

    for test in range(n,len(df)):

        if df['close'][test-1]<=df['U-B'][test-1] and df['close'][test]>df['U-B'][test]:

            df.loc[ind[test],'Strend']=df['L-B'][test]

            break

        if df['close'][test-1]>=df['L-B'][test-1] and df['close'][test]<df['L-B'][test]:

            df.loc[ind[test],'Strend']=df['U-B'][test]

            break

    for i in range(test+1,len(df)):

        if df['Strend'][i-1]==df['U-B'][i-1] and df['close'][i]<=df['U-B'][i]:

            df.loc[ind[i],'Strend']=df['U-B'][i]

        elif  df['Strend'][i-1]==df['U-B'][i-1] and df['close'][i]>=df['U-B'][i]:

            df.loc[ind[i],'Strend']=df['L-B'][i]

        elif df['Strend'][i-1]==df['L-B'][i-1] and df['close'][i]>=df['L-B'][i]:

            df.loc[ind[i],'Strend']=df['L-B'][i]

        elif df['Strend'][i-1]==df['L-B'][i-1] and df['close'][i]<=df['L-B'][i]:

            df.loc[ind[i],'Strend']=df['U-B'][i]

    return df['Strend']





    

Hello Bhaskar,



You can connect with placement team if you need any help in strategy development.




Meanwhile, if you are getting any error then do let us know, we would be happy to help you.



Their email address is: 
placements@quantinsti.com

Please share any specific error which you are getting or any specific place where you are stuck.



The below link would be helpful to you:

https://kite.trade/forum/discussion/3746/renko-supertrend-atr-heiken-ashi-codes-available



Note: We don't provide any consulting service.



Many Thanks.